|
|
#1 (permalink) |
|
New Member
![]() Join Date: Mar 2005
Posts: 6
|
USing ASP to parse XML - Is there a reasonably simple and dynamic way to search the DOM Tree by node names? I realise that I may need more than one parameter to identify none unique nodes, just wondered if anyone had a function I could have a look at, or some advice.
I have made a small start: <% 'create the xml document object set XMLDoc = server.createobject("Microsoft.XMLDOM") 'Specifies whether asynchronous download is permitted. XMLDoc.async = false 'Load local test document - XMLDoc.load(server.mappath("weathertest.xml")) 'Create a root Node from the XML document element set rootNode = XMLDoc.documentElement 'Create a function to search the DOM tree by node name Function SearchDOMTreeByName(Input) 'Walk the tree, I presume I need to set up a loop that identifies the level of children.. 'and continues until it reaches the end leaves or finds the node with the required input name but don't know how '**HELP!** 'Return the required text value SearchDOMTreeByName=x.text End Function 'test the function response.Write(SearchDOMTreeByName("head")) 'Close the XML object set XMLDoc=nothing %> I have actually already wrote a function that works for my application but would like something less hard wired as it only searches to a set level of nodes and refers to there positions in the tree, the call look like this: GetNode(3,1,4,2,0) Thanks for your time if you can help. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|