 |
 |
 |
Default selectionLanguage in xml4.0 is xpath. So you need not to set
yourself. Try,
<html>
<body>
<xml id='island'>
<messages>
<message mid='1'>
</message>
<message mid='2'>
</message>
</messages>
</xml>
<script language=vbscript>
sub window_onload
msgbox island.selectnodes("//message[@mid='1']").length
end sub
</script>
</bode>
</html>
Either can you load it like "xml40.load island". The result should be same.
"Grand Mufti" <grandmufti@m...> wrote in message
news:pan.2004.03.31.14.16.31.181179@m......
> given:
>
> <xml id='island'>
> <messages>
> <message mid='1'>
> [more]
> </message>
>
> <message mid='2'>
> [more]
> </message>
> </messages>
> </xml>
>
> where xmlDoc is a properly configured (at least I think) msxml object
>
> <script>
> xmlDoc = new ActiveXObject("Msxml2.DOMDocument.4.0");
> xmlDoc.async = false;
> xmlDoc.resolveExternals = false;
> [optional, see below] -> xmlDoc.setProperty("SelectionLanguage",
"XPath");
>
> xmlDoc.load(island); // where island is an xml data island in my
> document.
> </script>
>
> [I say 'properly configured', because I can dump various properties of the
> xml object, and I get the expected results. Example, alert(xmlDoc.xml) or,
> alert(xmlDoc.selectNodes("//message").length), which results in '2',
> correct.]
>
> my javascript:
>
> <script>
> function myFoo(){
>
> objNodeList = xmlDoc.selectNodes("//message");
> alert(objNodeList.length); // results in "2". CORRECT!
>
> // But here's the mystery:
> objNodeList = xmlDoc.selectNodes("//message[@mid=1]");
> // I have even tried putting the 1 in single quotes, no change.
> alert(objNodeList.length); // the resulting alert says, "0", when, it
> // SHOULD result in 1. Right?
>
> [more code, exit function w/return]
>
> }
> </script>
>
> I have done xmlDoc.setProperty("SelectionLanguage","XPath"), but there
> was no change in results.
>
> I've been using XML/Xpath for quite some time now, and as far as I can
> tell, this predicate is formed properly.
>
>
> I'm hoping somebody can assist me in figuring this out. I haven't included
> *all* the details surrounding my code, so perhaps the Devil is in one of
> these details. I'm short on time, as I must depart to a meeting. I would
> be glad to fill in some of these details later. Regardless, this code,
> above, is a pretty simplified version of what i'm doing. AFAIK, this
> should all run by the book. it's not. TIA
>
>
>
|
 | 



|  |
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.
|  |
| |
 |
 |
 |