Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - msxml question

Reply
 
Old 10-08-2008   #1 (permalink)
James


 
 

msxml question

using vbscript/wsh

as shown below iterating through list of xml elements is simple enough.

For Each node In xmldoc.DocumentElement.Childnodes

msgbox "node: " & node.xml

Next

Assume the node element above has an attribute named ID which is a number.
What I need to do is process a list of nodes in the correct order, which is
determined by this ID attribute. Whats the simplest way to sort when working
with msxml in vbscript? I didn't see any sorting options when reviewing the
xpath information, which I use with the SelectNodes method... how do first
obtain a sorted collection of nodes to do my For Each on? The transformNode
method with xsl? If so could someone provide an example? I've been working
with msxml and vbscript recently but havn't touch xsl yet...




My System SpecsSystem Spec
Old 10-09-2008   #2 (permalink)
Joe Fawcett


 
 

Re: msxml question



"James" <noone@xxxxxx> wrote in message
news:ubsGFYYKJHA.4772@xxxxxx
Quote:

> using vbscript/wsh
>
> as shown below iterating through list of xml elements is simple enough.
>
> For Each node In xmldoc.DocumentElement.Childnodes
>
> msgbox "node: " & node.xml
>
> Next
>
> Assume the node element above has an attribute named ID which is a number.
> What I need to do is process a list of nodes in the correct order, which
> is determined by this ID attribute. Whats the simplest way to sort when
> working with msxml in vbscript? I didn't see any sorting options when
> reviewing the xpath information, which I use with the SelectNodes
> method... how do first obtain a sorted collection of nodes to do my For
> Each on? The transformNode method with xsl? If so could someone provide an
> example? I've been working with msxml and vbscript recently but havn't
> touch xsl yet...
>
>
>
You can't do it in MSXML as XPath (in version 1.0) doesn't have sorting
capability. So either sort the nodes using a standard sort algorithm or
transform the document first using XSLT and then select the nodes.
This can all be done in memory, no need to actually alter the original. If
you need help with the XSLT post a sample XML document.

MSXML questions are best asked on microsoft.public.xml.

--

Joe Fawcett (MVP - XML)
http://joe.fawcett.name

My System SpecsSystem Spec
Old 10-09-2008   #3 (permalink)
James


 
 

Re: msxml question

ok, thanks.

"Joe Fawcett" <joefawcett@xxxxxx> wrote in message
news:eNoQHpeKJHA.920@xxxxxx
Quote:

>
>
> "James" <noone@xxxxxx> wrote in message
> news:ubsGFYYKJHA.4772@xxxxxx
Quote:

>> using vbscript/wsh
>>
>> as shown below iterating through list of xml elements is simple enough.
>>
>> For Each node In xmldoc.DocumentElement.Childnodes
>>
>> msgbox "node: " & node.xml
>>
>> Next
>>
>> Assume the node element above has an attribute named ID which is a
>> number. What I need to do is process a list of nodes in the correct
>> order, which is determined by this ID attribute. Whats the simplest way
>> to sort when working with msxml in vbscript? I didn't see any sorting
>> options when reviewing the xpath information, which I use with the
>> SelectNodes method... how do first obtain a sorted collection of nodes to
>> do my For Each on? The transformNode method with xsl? If so could someone
>> provide an example? I've been working with msxml and vbscript recently
>> but havn't touch xsl yet...
>>
>>
>>
> You can't do it in MSXML as XPath (in version 1.0) doesn't have sorting
> capability. So either sort the nodes using a standard sort algorithm or
> transform the document first using XSLT and then select the nodes.
> This can all be done in memory, no need to actually alter the original. If
> you need help with the XSLT post a sample XML document.
>
> MSXML questions are best asked on microsoft.public.xml.
>
> --
>
> Joe Fawcett (MVP - XML)
> http://joe.fawcett.name

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
MSXML HTTP get command VB Script
MSXML 4.0 Vista Games
3 copies of MSXML 4.0 SP2 ??? Windows Updates
MSXML 4.0 SP2 Parse and SDK Vista performance & maintenance
getting error message...msxml 4.0 Vista Games


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46