|
| |
User Groups : Forums : SiteExperts :
XML Technologies
:  | How to create child nodes of multiple parents of same name I'm using the MS XML object model via Seth Juarez's XML class (http://xmlfiles.com/articles/seth/xmldatatransfer/default.asp), to create an ASX playlist but the principle will apply anywhere.
Here's the struture I want (obviously the brackets has been changed so that the code is viewable here):
{ASX version = "3.0"} {PARAM NAME = "Encoding" VALUE = "UTF-8" /} {ENTRY} {ref href = "\Music\Artist\Album\Track1.mp3" /} {/ENTRY} {ENTRY} {ref href = "\Music\Artist\Album\Track2.mp3" /} {/ENTRY} {/ASX}
I can get as far as this:
{ASX version = "3.0"} {PARAM NAME = "Encoding" VALUE = "UTF-8" /} {ENTRY} {ref href = "\Music\Artist\Album\Track1.mp3" /} {/ENTRY} {/ASX}
using these calls:
.createChildNode "ASX", "ENTRY" .createChildNodeWAttr "ASX//ENTRY", "REF", "href", "\Music\Artist\Album\Track1.mp3"
However, as soon as I add another call:
.createChildNode "ASX", "ENTRY" .createChildNodeWAttr "ASX//ENTRY", "REF", "href", "\Music\Artist\Album\Track2.mp3"
then Track2.mp3 is added twice because there are now 2 parent nodes called 'ENTRY'. How can I create an ENTRY node with a child node 'REF' for every track?Started By VBScab on Jul 9, 2007 at 8:22:21 AM This message has been edited. |  | | 4 Response(s) | Reply |
| Earlier Replies | Replies 4 to 4 of 4 | Later Replies |  | | VBScab on Jul 11, 2007 at 4:08:59 AM (# 4) Thanks for responding. Not. I got a much better response from webdeveloper.com
For those coming here from a Google or similar...
- create all your parent nodes first - add the children using the syntax shown BUT starting at zero:
.createChildNode "ASX", "ENTRY" .createChildNode "ASX", "ENTRY" .createChildNodeWAttr "ASX//ENTRY[0]", "REF", "href", "\Music\Track\Album\Track1.mp3" .createChildNodeWAttr "ASX//ENTRY[1]", "REF", "href", "\Music\Track\Album\Track2.mp3"
| | Earlier Replies | Replies 4 to 4 of 4 | Later Replies |
To respond to a discussion, you must first logon.
If you are not registered, please register yourself to become a member of the SiteExperts.community.
|