Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: DOM Vs XPath + ancestor : whats the point? >Thread Next - Re: DOM Vs XPath + ancestor : whats the point? Re: DOM Vs XPath + ancestor : whats the point?To: NULL Date: 8/2/2004 4:17:00 PM
Look I hope we are not talking at cross purposes but by processing I assume
we just mean iterating the resulting nodeset which is fine for non-ancestor
nodesets
var nodes = xmldoc.selectNodes("//RDF:Description[@role:area='US']");
the nodes are simply dumped as xml using
for (i=0;i<nodes.length;i++ )
{
Response.write(nodes.nextNode().xml)
}
BUT if the ancestor::* is used the node set returned is virtually useless.
For example
var nodes =
xmldoc.selectNodes("//RDF:Description[@role:area='US']/ancestor-or-self::*")
;
generates
<?xml version='1.0'?>
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:role="http://www.rolemodels.net/rdf#">
<RDF:Seq about="search:providers">
<RDF:li>
<RDF:Description role:area="US" role:body="Excuuute"/>
<RDF:Description role:area="US" role:body="Yahoo Corp"/>
<RDF:Description role:area="UK" role:body="Yahoo Limited"/>
</RDF:li>
</RDF:Seq>
</RDF:RDF>
<RDF:Seq xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
about="search:providers">
<RDF:li>
<RDF:Description xmlns:role="http://www.rolemodels.net/rdf#"
role:area="US" role:body="Excuuute"/>
<RDF:Description xmlns:role="http://www.rolemodels.net/rdf#"
role:area="US" role:body="Yahoo Corp"/>
<RDF:Description xmlns:role="http://www.rolemodels.net/rdf#"
role:area="UK" role:body="Yahoo Limited"/>
</RDF:li>
</RDF:Seq>
<RDF:li xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<RDF:Description xmlns:role="http://www.rolemodels.net/rdf#" role:area="US"
role:body="Excuuute"/>
<RDF:Description xmlns:role="http://www.rolemodels.net/rdf#" role:area="US"
role:body="Yahoo Corp"/>
<RDF:Description xmlns:role="http://www.rolemodels.net/rdf#" role:area="UK"
role:body="Yahoo Limited"/>
</RDF:li>
<RDF:Description xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:role="http://www.rolemodels.net/rdf#" role:area="US"
role:body="Excuuute"/>
<RDF:Description xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:role="http://www.rolemodels.net/rdf#" role:area="US" role:body="Yahoo
Corp"/>
Whats the point in now having to write code to figure out which node in
the nodeset I have to dump ?
Looking at the above how do you know which nodes to dump ?
........and this is a simple example!!
"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:eheBngJeEHA.3988@t......
> rvj wrote:
>
> > why should anyone have to subsequently process the ancestor::* nodeset
to
> > create an XML subset????
>
> Because you want to modify nodes (remove some children). Somebody has to
> do that job - either DOM code or XSLT.
> --
> Oleg Tkachenko [XML MVP]
> http://blog.tkachenko.com
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
