Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: newbie :eof xpath ancestors syntax with typo corrections

From: "Chris Barber" <chris@----------.--.--.------>
To: NULL
Date: 8/1/2004 9:16:00 PM
Have you set:

pobjXMLDOC.setAttribute "SelectionLanguage", "XPath"

on the document before trying the selectNodes()?

I believe that MSXML4 defaults to the XPattern syntax making the XPath your are using invalid
(doesn't support axes).

Chris.

"rvj" <md@r...> wrote in message news:Orwjo9$dEHA.4048@T......
Corrected Version :

I want to select nodes from an XML file (RDF) but I dont understand the
syntax
for including the containing elements into the node set

For example, if I use

       var nodes = xmldoc.selectNodes("//RDF:Description[@role:area='US']");

 I get valid results for the US apart from the fact I havent generated any
containing elements especially the root node so I assume I need something
like

      var nodes =
xmldoc.selectNodes("//RDF:Description[@role:area='US']/ancestor-or-self::*")
;

or

       var nodes =
xmldoc.selectNodes("//ancestor-or-self::RDF:Description[@role:area='US']");

and then simply dump the xml using

    for (i=0;i<nodes.length;i++ )
     {
         Response.write(nodes.nextNode().xml)
     }

but all my attempts generate token errors in my asp page

Expected token 'eof' found ':'.

Any ideas?

********
input file
********
<?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="Excute" />
       <RDF:Description  role:area="US"  role:body="Yahoo Corp"  />
       <RDF:Description  role:area="UK"  role:body="Yahoo Limited"    />
    </RDF:li>
  </RDF:Seq>
</RDF:RDF>

************
required output
*************

<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="Excute" />
       <RDF:Description  role:area="US"  role:body="Yahoo Corp"  />
     </RDF:li>
  </RDF:Seq>
</RDF:RDF>








---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.732 / Virus Database: 486 - Release Date: 29/07/2004




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