Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: DOM Vs XPath + ancestor : whats the point?

From: "rvj" <md@----------.--->
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




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent