473,405 Members | 2,349 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Need to find a node

Hi,
i have written a VB script to find a node name in an XML.Now i need to search for that node name in another XML. How can i do it.
My XML looks like this

- <xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
- <s:Schema id="RowsetSchema">
- <s:ElementType name="row" content="eltOnly">
- <s:AttributeType name="HDR_HideTraneLogo" rs:number="1" rs:nullable="true" rs:writeunknown="true">
<s:dataType dt:type="string" dt:maxLength="50" rs:precision="50" />
</s:AttributeType>
- <s:AttributeType name="HideTraneLogo" rs:number="2" rs:nullable="true" rs:writeunknown="true">
<s:dataType dt:type="string" dt:maxLength="50" rs:precision="50" />
</s:AttributeType>
- <s:AttributeType name="HDR_NbrBlankPageHeaderSections" rs:number="3" rs:nullable="true" rs:writeunknown="true">
<s:dataType dt:type="string" dt:maxLength="50" rs:precision="50" />
</s:AttributeType>
- <s:AttributeType name="NbrBlankPageHeaderSections" rs:number="4" rs:nullable="true" rs:writeunknown="true">
<s:dataType dt:type="string" dt:maxLength="50" rs:precision="50" />
</s:AttributeType>
- <s:AttributeType name="HDR_TOPSS_Mode" rs:number="5" rs:nullable="true" rs:writeunknown="true">
<s:dataType dt:type="string" dt:maxLength="50" rs:precision="50" />
</s:AttributeType>
- <s:AttributeType name="TOPSS_Mode" rs:number="6" rs:nullable="true" rs:writeunknown="true">
<s:dataType dt:type="string" dt:maxLength="50" rs:precision="50" />
</s:AttributeType>

My code,
Set objXMLSearchDocument = Sys.OleObject("Msxml2.DOMDocument.4.0")

objXMLSearchDocument.async = False


' Load the files created earlier

objXMLSearchDocument.setProperty "SelectionLanguage", _
"XPath"
Call objXMLSearchDocument.loadXML(strXML)

set objXMLRoot = objXMLSearchDocument.DocumentElement

Set objXMLSearchElements = objXMLSearchDocument.getElementsbytagname("'//s'")

What should i populate in the get elements by tagname to fetch a value from XML
Nov 23 '07 #1
3 1951
jkmyoung
2,057 Expert 2GB
The Element name is not, s, rather it is Schema, or ElementType, or AttributeType, etc.. eg, <rs:Schema> and <s:Schema> would be 2 different types of nodes, but both with the same element Name Schema. The s: prefix ties these elements to a particular namespace.

I don't specifically know what elements you are looking for.
Try getElementsByTagName('Schema')
Nov 23 '07 #2
Hi,
Thanks for your response. i need further clarifications.
Supposing that i need to fetch the name "HDR_HideTraneLogo" from the following line,how can it be done.Do i need to create the XPATH from the root??

- <s:AttributeType name="HDR_HideTraneLogo" rs:number="1" rs:nullable="true" rs:writeunknown="true">


Also, getelementsbytagname('Schema') did not throw any error when it ran.But when i checked for the lenght of the object that fetched these nodes, Zero is what i can see.Any specific reasons why it did not work?? Kindly help me.
Nov 26 '07 #3
jkmyoung
2,057 Expert 2GB
You probably need to use the version of the function that takes in a namespace:
getElementsByTagName("Schema", "uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882")
Nov 26 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: MegaZone | last post by:
I'm having some issues with PHP DOMXML - in particular the get_elements_by_tagname method. Now, the PGP docs on this are, well, sparse, so maybe I'm just doing something stupid. I thought this...
2
by: LoserInYourFaceEngineer | last post by:
Hello All: I'm having trouble with a recursive function. The function is supposed to identify nested folders in a hierarchical folder structure. The function "searchForFolders()" is...
3
by: Robert Oschler | last post by:
What's a good way to find a specific text node element in a web page's DOM tree? I thought of traversing each node but there has to be a faster way. Is there a "find text node by nodeValue"...
5
by: Amadej | last post by:
Hello everyone, I need some advice on which class to use when working with an XML file in a specific way. Basically I am writing a program, that needs to save it's state into a file, so it can...
0
by: Henry | last post by:
I have a dataset dsMain in which I have two tables The table period has columns like period_id, name, root_org_id.... The table organization has org_id, name, parent_id, hier_path, level,...
66
by: genestarwing | last post by:
QUESTION: Write a program that opens and read a text file and records how many times each word occurs in the file. Use a binary search tree modified to store both a word and the number of times it...
7
by: tman | last post by:
I am generating a very large tree list in my program and while it's performance is great once loaded it takes a really long time to load. I create a root TreeNode "offline" and go through the...
10
by: Peter Michaux | last post by:
Hi, Today I have been testing the event models from Netscape 4.8 and IE 4 to the current crop of browsers. I'd like to write a small event library similar in purpose to the Yahoo! UI event...
27
by: comp.lang.tcl | last post by:
My TCL proc, XML_GET_ALL_ELEMENT_ATTRS, is supposed to convert an XML file into a TCL list as follows: attr1 {val1} attr2 {val2} ... attrN {valN} This is the TCL code that does this: set...
2
by: huiling25 | last post by:
I was given the pseudo code.. but i still cannot figure out how to do it... how can i find if the vertices are adjacent to the vertex on stack top? I know i have to have an array of true/false (to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.