Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: selectNodes - How form query to get required data

From: brianharris@-----------.---------.---
To: NULL
Date: 8/8/2007 10:52:00 AM

That did answer my original question, but I have 2 others related to your 
response.
1) If I need to do same select with XSLPatterns what would syntax be
2) Do you know of any documentation that goes into better details on 
creating selection criterias.  All of the ones I have found are very basic 
and don't use more advance syntax of selection.  For example with syntax you 
gave me I could not find some of its definitions describes (specifically 
"contains").  The example I orginally sent was using "value" which I couldn't 
find documentaion on but, some where someone said you use this to ged CDATA 
data.

"Martin Honnen" wrote:

> brian_harris wrote:
> 
> > This is an example of what XML data looks likes:
> >  <?xml version="1.0" ?> 
> >  <headerDISCREPTABTYP xmlns:dt="urn:schemas-microsoft-com:datatypes">
> >    <DISCREPTABTYP heading="UNKNOWN" description="UNKNOWN EMPLOYEES IN UNIT" >
> >      <discrepancytype> <![CDATA[ UNKNOWN  ]]>  </discrepancytype>
> >      <empcode> <![CDATA[ 62009  ]]>  </empcode>
> >      <startscan> <![CDATA[ 02/10/2006 09:24:16 am  ]]>   </startscan>
> >    </DISCREPTABTYP>
> >    <DISCREPTABTYP heading="BELONG" description="EMPLOYEES WHO BELONG AND ARE 
> > WORKING IN UNIT" >
> >      <discrepancytype> <![CDATA[ BELONG  ]]>   </discrepancytype>
> >      <empcode> <![CDATA[ 114351  ]]>   </empcode>
> >      <startscan> <![CDATA[ 02/06/2006 08:56:01 am  ]]>  </startscan>
> >   </DISCREPTABTYP>
> >   <DISCREPTABTYP heading="BELONG" description="EMPLOYEES WHO BELONG AND ARE 
> > WORKING IN UNIT" >
> >     <discrepancytype> <![CDATA[ BELONG  ]]> 
> >     </discrepancytype>
> >     <empcode> <![CDATA[ 114351  ]]>   </empcode>
> >     <startscan> <![CDATA[ 02/07/2006 08:34:21 am  ]]>  </startscan>
> >   </DISCREPTABTYP>
> >   <DISCREPTABTYP heading="BELONG" description="EMPLOYEES WHO BELONG AND ARE 
> > WORKING IN UNIT" >
> >     <discrepancytype> <![CDATA[ BELONG  ]]>  </discrepancytype>
> >     <empcode> <![CDATA[ 189191  ]]>  </empcode>
> >     <startscan> <![CDATA[   ]]>  </startscan>
> >   </DISCREPTABTYP>
> >    <DISCREPTABTYP heading="FLOATOUT" description="EMPLOYEES FLOAT OUT OF 
> > UNIT" >
> >      <discrepancytype> <![CDATA[ FLOATOUT  ]]>  </discrepancytype>
> >      <empcode> <![CDATA[ 114351  ]]>  </empcode>
> >      <startscan> <![CDATA[ 02/10/2006 09:24:16 am  ]]>   </startscan>
> >    </DISCREPTABTYP>
> >  </headerDISCREPTABTYP>
> 
> Here is a sample with JScript using MSXML 3:
> 
> var xmlDocument = new ActiveXObject('Msxml2.DOMDocument.3.0');
> xmlDocument.async = false;
> if (xmlDocument.load('test2007080802.xml')) {
>    xmlDocument.setProperty('SelectionLanguage', 'XPath');
>    var nodes = 
> xmlDocument.selectNodes('headerDISCREPTABTYP/DISCREPTABTYP[contains(discrepancytype, 
> "BELONG") and contains(empcode, "114351")]');
>    alert('Found ' + nodes.length + ' node(s).');
> }
> else {
>    alert(xmlDocument.parseError.reason);
> }
> 
> For your XML input the alert shows that two nodes are being found.
> 
> -- 
> 
> 	Martin Honnen --- MVP XML
> 	http://JavaScript.FAQTs.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