Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: newbie :eof xpath ancestors syntax with typo corrections >Thread Next - Re: newbie :eof xpath ancestors syntax with typo corrections Re: newbie :eof xpath ancestors syntax with typo correctionsTo: NULL Date: 8/2/2004 9:01:00 AM Thanks I think you've put me on the right track.
http://msdn.microsoft.com/msdnmag/issues/0900/xml/
According the technical documenation axes are supported from MSXML3
var xmldoc = Server.CreateObject("MSXML2.DOMDocument.3.0");
xmldoc.async=false;
xmldoc.load(file);
xmldoc.setProperty( "SelectionLanguage", "XPath")
***************************
The problem now is that setProperty now generates the following error
Reference to undeclared namespace prefix: 'RDF'.
Any ideas what this is now complaining about?
......is it the top most node (as shown below) or the XML directive?
.... or can anyone point me at a simple example XPath ancestor example
which EXCLUDES any use of XSD or XSLT ?
"Chris Barber" <chris@b...> wrote in message
news:Oao#hRAeEHA.2376@t......
> 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
>
>
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
