Sign in to follow this  
Followers 0
Decker87

XML Wrapper: Select n'th child node's attributes?

1 post in this topic

#1 ·  Posted (edited)

I have an XML document similar in form to this:

<directory name="1.0">
    <file name="ahv.exe"/>
    <file name="help.html"/>
    <file name="help.jpg"/>
    <directory name="Resources">
        <directory name="en">
            <file name="crossProductLinkError.html"/>
            <file name="HelpViewerStrings.dat"/>
            <file name="linkError.html"/>
        </directory>
    </directory>
</directory>

Is there some syntax I am unaware of for selecting attributes from the N'th child node of specified type (type meaning file or directory in this example)? Clearly, a simple XPath like "directory/directory/directory/file" is not appropriate here.

EDIT: How embarassing! I figured out all I had to do was use [n] to specify the n'th child node in the XPath, like "directory[1]/directory[1]/directory[1]/file[1]"

BUUUUT...I do have another problem. I can't seem to use the XML DOM functions right to get, for example, the name of the first directory. What should I use in _XMLGetAttrib?

Edited by Decker87

Share this post


Link to post
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
Sign in to follow this  
Followers 0