Y
yanfei0891_firs
Unregistered / Unconfirmed
GUEST, unregistred user!
xml源文件:
<?xml version="1.0" encoding="GB2312"?>
<bookstore>
<book category="COOKING">
<title lang="en">Everyday Italian</title>
<author>张三</author>
<year>2005</year>
<price>30.00</price>
</book>
<book category="CHILDREN">
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.00</price>
</book>
<book category="WEB">
<title lang="en">Learning XML</title>
<author>Erik T. Ray</author>
<year>2003</year>
<price>39.95</price>
</book>
</bookstore>
程序代码:
xml := CoDOMDocument.Create;
xml.load('c:/a.xml');
node:=xml.documentElement;
query:='//book[author='+#39+'张三'+#39+]';
nodelist:=node.selectNodes(query);
//上面这句话delphi就会报错,但如果改成 query:='//book[author='+#39+'J K. Rowling'+#39+]';就没有问题,然道查询条件里不能有中文?
望高手告之!
<?xml version="1.0" encoding="GB2312"?>
<bookstore>
<book category="COOKING">
<title lang="en">Everyday Italian</title>
<author>张三</author>
<year>2005</year>
<price>30.00</price>
</book>
<book category="CHILDREN">
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.00</price>
</book>
<book category="WEB">
<title lang="en">Learning XML</title>
<author>Erik T. Ray</author>
<year>2003</year>
<price>39.95</price>
</book>
</bookstore>
程序代码:
xml := CoDOMDocument.Create;
xml.load('c:/a.xml');
node:=xml.documentElement;
query:='//book[author='+#39+'张三'+#39+]';
nodelist:=node.selectNodes(query);
//上面这句话delphi就会报错,但如果改成 query:='//book[author='+#39+'J K. Rowling'+#39+]';就没有问题,然道查询条件里不能有中文?
望高手告之!