SiteExperts.com Logo Home | Community | Developer's Paradise
User Groups | Site Tools | Site Information | Search
 Main Menu
 Forums
SiteExperts.com Forums
All Discussions

SiteExperts Feedback
The Lounge
Dynamic HTML
Site Design/ Critiques
HTML and CSS
XML Technologies
The Wireless Internet
Internet Explorer
Microsoft .NET
The Server
Technical Support

Sponsored Links

User Groups : Forums : SiteExperts : XML Technologies :

Previous DiscussionNext Discussion
 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

4 Response(s) | Reply

View All Replies
VBScab on Jul 11, 2007 at 4:08:59 AM

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"


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

User Name
Password
Copyright 1997-2000 InsideDHTML.com, LLC. All rights reserved.