Jump to content

Access childnode


joecool2005

Recommended Posts

Hi,I'm not very good in XMLThis is my XML<Text><Banner display="false" >This is my Banner< /Banner><Banner display="true" >Another banner </Banner> </Text>How can I access the one that has attribut "display="true" "?Right now I'm using this to access to itset xmlDoc=CreateObject("Microsoft.XMLDOM")Response.Write(xmlDoc.childNodes.item(1).text);ThxJoe

Link to comment
Share on other sites

If you're using script then try the selectSingleNode method:

set xmldoc = CreateObject("Microsoft.XMLDOM")response.write(xmldoc.documentelement.selectsinglenode("Banner[@display='true']").text)

This allows you to tie your code in more closely with XSL where you would use :

<xsl:value-of select="Banner[@display='true']" />

I'd say this as well, a little XSL can replace a lot of script when it comes to displaying xml data (and you can even build script into XSL if you really need to!). Hope this helps.Dooberry

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...