请教:如何使用MSXML的SelectSingleNode方法处理RDF文档? ( 积分: 200 )

  • 主题发起人 主题发起人 vsharp
  • 开始时间 开始时间
V

vsharp

Unregistered / Unconfirmed
GUEST, unregistred user!
我有一个文档如下:
<?xml version="1.0"
encoding="iso-8859-1"
?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:admin="http://webns.net/mvcb/"
xmlns="http://purl.org/rss/1.0/">
<channel rdf:about="http://someplace.com/weblog/">
<title>News from Bob</title>
<link>http:// someplace.com/weblog/</link>
<description></description>
<dc:language>en-us</dc:language>
<dc:creator>Bob</dc:creator>
<dc:rights>Copyright 2003 Bob</dc:rights>
<dc:date>2003-03-19T22:30:34-07:00</dc:date>
<admin:generatorAgent rdf:resource="http://www.movabletype.org/?v=2.51"
/>
<admin:errorReportsTo rdf:resource="mailto:tbob@somewhere.com"
/>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
</channel>
<item rdf:about="http://somewhere/weblog/archives/2003/03/19.shtml#how_i_really_feel_about_cheese">
<title>How I really feel about Cheese</title>
<description><p>
I was asked in a comment why I reallydo
n't like cheese...</description>
</item>
</rdf:RDF>
但我在使用
SelectSingleNode("//channel")的时候,其结果都是空,访问其它节点SelectSingleNode("//title"),SelectSingleNode("//rdf:RDF/channle/title")也都是返回NULL,我看到有文章介绍在.Net里面可以通过nsMgr = new XmlNamespaceManager(feedXml.NameTable);
nsMgr.AddNamespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
nsMgr.AddNamespace("dc", "http://purl.org/dc/elements/1.1/");
nsMgr.AddNamespace("rss", "http://purl.org/rss/1.0/");
来实现,但我Javascript里面怎么处理呢?MSXML根本就没有XmlNamespaceManager这个接口
 
我有一个文档如下:
<?xml version="1.0"
encoding="iso-8859-1"
?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:admin="http://webns.net/mvcb/"
xmlns="http://purl.org/rss/1.0/">
<channel rdf:about="http://someplace.com/weblog/">
<title>News from Bob</title>
<link>http:// someplace.com/weblog/</link>
<description></description>
<dc:language>en-us</dc:language>
<dc:creator>Bob</dc:creator>
<dc:rights>Copyright 2003 Bob</dc:rights>
<dc:date>2003-03-19T22:30:34-07:00</dc:date>
<admin:generatorAgent rdf:resource="http://www.movabletype.org/?v=2.51"
/>
<admin:errorReportsTo rdf:resource="mailto:tbob@somewhere.com"
/>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
</channel>
<item rdf:about="http://somewhere/weblog/archives/2003/03/19.shtml#how_i_really_feel_about_cheese">
<title>How I really feel about Cheese</title>
<description><p>
I was asked in a comment why I reallydo
n't like cheese...</description>
</item>
</rdf:RDF>
但我在使用
SelectSingleNode("//channel")的时候,其结果都是空,访问其它节点SelectSingleNode("//title"),SelectSingleNode("//rdf:RDF/channle/title")也都是返回NULL,我看到有文章介绍在.Net里面可以通过nsMgr = new XmlNamespaceManager(feedXml.NameTable);
nsMgr.AddNamespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
nsMgr.AddNamespace("dc", "http://purl.org/dc/elements/1.1/");
nsMgr.AddNamespace("rss", "http://purl.org/rss/1.0/");
来实现,但我Javascript里面怎么处理呢?MSXML根本就没有XmlNamespaceManager这个接口
 
后退
顶部