i use it to read rss file, and i find that it can't read chinese character when the file encoding is utf-8, but when the encoding is utf-16, it can read well.
and i use c# vision.
here is the rss file,the last attribute <mb:description> has some chinese character
<?xml version="1.0" encoding="utf-8"?>
<!--Created by http://www.domerchant.com -->
<rss xmlns:mb="http://www.martbase.com/ns/1.0" version="2.0">
<channel>
<title>Products Of Long Lovesickness</title>
<description>Long Lovesickness</description>
<link>http://www.ssncshop.martbase.com</link>
<language>en-US</language>
<mb:currency>USD</mb:currency>
<generator><![CDATA[Rss Builder 1.0 for Domerchant V1.0 By <a
href="http://www.domerchant.com">Domerchant Inc.</a>]]></generator>
<item>
<title>Sampel Product 1</title>
<mb:subtitle>This is just a test</mb:subtitle>
<link>http://www.ssncshop.martbase.com/Sampel-Product-1-This-is-just-a-test_P1092/</link>
<mb:image_link>/images/newproduct_big.jpg</mb:image_link>
<category>Class 1</category>
<mb:price>99.99</mb:price>
<mb:expiration_date>Mon, 28 Apr 2008 00:00:00 PST</mb:expiration_date>
<description><![CDATA[<table width="100%" border="0"
cellspacing="0" cellpadding="0"><tr><td width="120"
align="center"><img alt="Sampel Product 1"
src="/images/newproduct_small.jpg"/></td><td><div><font
size="+1">Price: <strong>$99.99
USD</strong></font></div><div></div><div><a target="_blank"
href="http://www.ssncshop.martbase.com/Sampel-Product-1-This-is-just-a-test_P1092/#buy">Buy
Now</a></div></td></tr></table>]]></description>
<mb:description><![CDATA[Can You See How Beautiful Our Shop
is?中文显示]]></mb:description>
</item>
</channel>
</rss>
the follow is my rss reader,i modified from the vtd example
using System;
using System.Collections.Generic;
using System.Text;
using com.ximpleware;
namespace VTDTest
{
class Program
{
static void Main(string[] args)
{
try
{
// open a file and read the content into a byte array
VTDGen vg = new VTDGen();
if
(vg.parseFile("./c82ebc4258954b01aa938174ad26af7b.xml", true))
{
VTDNav vn = vg.getNav();
AutoPilot ap = new AutoPilot(vn);
//ap.selectElementNS("http://purl.org/dc/elements/1.1/", "*"); //
select name space here; * matches any local name
ap.selectElement("*");
int count = 0;
while (ap.iterate())
{
Console.Write("" + vn.getCurrentIndex() + " ");
Console.WriteLine("Element name ==> " +
vn.toString(vn.getCurrentIndex()));
int t = vn.getText(); // get the index of the
text (char data or CDATA)
if (t != -1)
Console.WriteLine(" Text ==> " +
vn.toNormalizedString(t));
Console.WriteLine("\n ============================== ");
count++;
}
Console.WriteLine("Total # of element " + count);
Console.ReadKey();
}
else
Console.WriteLine("ee");
}
catch (NavException e)
{
Console.WriteLine(" Exception during navigation " + e);
}
}
}
}
//thank you:)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
i use it to read rss file, and i find that it can't read chinese character when the file encoding is utf-8, but when the encoding is utf-16, it can read well.
and i use c# vision.
here is the rss file,the last attribute <mb:description> has some chinese character
<?xml version="1.0" encoding="utf-8"?>
<!--Created by http://www.domerchant.com -->
<rss xmlns:mb="http://www.martbase.com/ns/1.0" version="2.0">
<channel>
<title>Products Of Long Lovesickness</title>
<description>Long Lovesickness</description>
<link>http://www.ssncshop.martbase.com</link>
<language>en-US</language>
<mb:currency>USD</mb:currency>
<generator><![CDATA[Rss Builder 1.0 for Domerchant V1.0 By <a
href="http://www.domerchant.com">Domerchant Inc.</a>]]></generator>
<item>
<title>Sampel Product 1</title>
<mb:subtitle>This is just a test</mb:subtitle>
<link>http://www.ssncshop.martbase.com/Sampel-Product-1-This-is-just-a-test_P1092/</link>
<mb:image_link>/images/newproduct_big.jpg</mb:image_link>
<category>Class 1</category>
<mb:price>99.99</mb:price>
<mb:expiration_date>Mon, 28 Apr 2008 00:00:00 PST</mb:expiration_date>
<description><![CDATA[<table width="100%" border="0"
cellspacing="0" cellpadding="0"><tr><td width="120"
align="center"><img alt="Sampel Product 1"
src="/images/newproduct_small.jpg"/></td><td><div><font
size="+1">Price: <strong>$99.99
USD</strong></font></div><div></div><div><a target="_blank"
href="http://www.ssncshop.martbase.com/Sampel-Product-1-This-is-just-a-test_P1092/#buy">Buy
Now</a></div></td></tr></table>]]></description>
<mb:description><![CDATA[Can You See How Beautiful Our Shop
is?中文显示]]></mb:description>
</item>
</channel>
</rss>
the follow is my rss reader,i modified from the vtd example
using System;
using System.Collections.Generic;
using System.Text;
using com.ximpleware;
namespace VTDTest
{
class Program
{
static void Main(string[] args)
{
try
{
// open a file and read the content into a byte array
VTDGen vg = new VTDGen();
if
(vg.parseFile("./c82ebc4258954b01aa938174ad26af7b.xml", true))
{
VTDNav vn = vg.getNav();
AutoPilot ap = new AutoPilot(vn);
//ap.selectElementNS("http://purl.org/dc/elements/1.1/", "*"); //
select name space here; * matches any local name
ap.selectElement("*");
int count = 0;
while (ap.iterate())
{
Console.Write("" + vn.getCurrentIndex() + " ");
Console.WriteLine("Element name ==> " +
vn.toString(vn.getCurrentIndex()));
int t = vn.getText(); // get the index of the
text (char data or CDATA)
if (t != -1)
Console.WriteLine(" Text ==> " +
vn.toNormalizedString(t));
Console.WriteLine("\n ============================== ");
count++;
}
Console.WriteLine("Total # of element " + count);
Console.ReadKey();
}
else
Console.WriteLine("ee");
}
catch (NavException e)
{
Console.WriteLine(" Exception during navigation " + e);
}
}
}
}
//thank you:)
ok, will investigate and get back...