Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to selectsinglenodes with attribute value
Message
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Miscellaneous
Thread ID:
00961280
Message ID:
00961300
Views:
4
Martin,
Thanks. But now that I can do that how can I get the other attribute values:
(resources)
    (resource identifier="RESOURCE_INTRO" abc:Type="asset";
     type="webcontent" href="intro.htm")
Then I moved th pointer with your code:
oNd=oDocument.selectNodes('*/*[@identifier="'+transform([RESOURCE_INTRO])+'"]')

I was also able to set it a longhand way:
oR=oXML.documentelement.childnodes(2) && "resources"
oN=oR.selectSingleNode("//resources/resource/@identifier[.='RESOURCE_INTRO']")

And I set the pointer.
But, I cannot get the other attributes like "abc:Type" or "type" or "href"

Note when I point this:
oResource=oXML.documentelements.childnodes(2).childnodes(0)
*"resources/resource"
oResource.attributes(0).nodename returns "identifier"
oResource.attributes(0).text returns "RESOURCE_INTRO"
oResource.attributes(1).nodename returns "abc:Type"
oResource.attributes(1).text returns "asset"


So when I arrive at the resource node (above) with the identifier attribute = "RESOURCE_INTRO", my hope is to anticipate the node "resource" and use the DOM attributes of DOM getAttributes(preferred) to retrive the attribute values.

The top of the XML has stuff contained in an "organization" tag which would have an attribute value, "RESOURCE_INTRO", that I would like to use to point to a collection of attributes in the "resource" nodes. But, when I set the node with the selectNodes method I cant get a value for basename or parent node - those cannot achieve a reference to point to the attributes.

I guess the question is: Once the selectNodes using an attribute value to set the pointer is resolved how can I geet a handle for the node selected, or at least, reference the other attributes in the node?









>Hi Terry,
>
>
>oDocument.selectNodes('*/*[@attribute="'+transform(attribute_value)+'"]')
>
>
>MartinJ
>
>>Using the object:
>>ox=CREATEOBJECT("MSXML2.DOMDocument.3.0")
>>oDocument=ox.documentelements

>>
>>THe "resource" tagname is a child of oDocument.childnodes(2).
>>the path would be oDocument/resources/resource
>>
>>I have tried:
>>oDocument.selectSingleNode("resource" ;
>>child::para[attribute::identifier="RESOURCE_INTRO")

>>
>>I need guidance on how to point to a node (tag) based of the value of a specific attribute of the node.
Imagination is more important than knowledge
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform