473,503 Members | 1,657 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Identifying Parent and child Tag in XML

Hi,
I have a XML file which contains some Container and item information.
Both the tag identying by the same tag (Container).
But the outer is parent one and all other are child to that parent.

In this eg total 2 parent an 4 items are there.
.By programitilly how can i Distingush.
eg :
<Container>
<ContainerHandle>urn:epc:id:gid:49603356.41P.00000 1</ContainerHandle>
<Container>
<ContainerHandle>urn:epc:id:gid:49603356.41C.00000 1</ContainerHandle>
</Container>
<Container> <ContainerHandle>urn:epc:id:gid:49603356.41C.00000 2</ContainerHandle>
</Container>
</Container>

<Container>
<ContainerHandle>urn:epc:id:gid:49603356.51P.00000 1</ContainerHandle>
<Container>
<ContainerHandle>urn:epc:id:gid:49603356.51C.00000 1</ContainerHandle>
</Container>
<Container> <ContainerHandle>urn:epc:id:gid:49603356.51C.00000 2</ContainerHandle>
</Container>
</Container>

Thanks in advance
Umeshnath
Jan 16 '08 #1
1 1229
I think XPath can help you here.

Another (less optimized) way might be to loop through all nodes in an
recursive fassion, if parent-child will continue deep down to an unknown
level, if level known u can set the nesting likewise.

Thanks,
Harshal

"Umeshnath" <Um*******@discussions.microsoft.comwrote in message
news:58**********************************@microsof t.com...
Hi,
I have a XML file which contains some Container and item information.
Both the tag identying by the same tag (Container).
But the outer is parent one and all other are child to that parent.

In this eg total 2 parent an 4 items are there.
.By programitilly how can i Distingush.
eg :
<Container>
<ContainerHandle>urn:epc:id:gid:49603356.41P.00000 1</ContainerHandle>
<Container>
<ContainerHandle>urn:epc:id:gid:49603356.41C.00000 1</ContainerHandle>
</Container>
<Container>
<ContainerHandle>urn:epc:id:gid:49603356.41C.00000 2</ContainerHandle>
</Container>
</Container>

<Container>
<ContainerHandle>urn:epc:id:gid:49603356.51P.00000 1</ContainerHandle>
<Container>
<ContainerHandle>urn:epc:id:gid:49603356.51C.00000 1</ContainerHandle>
</Container>
<Container>
<ContainerHandle>urn:epc:id:gid:49603356.51C.00000 2</ContainerHandle>
</Container>
</Container>

Thanks in advance
Umeshnath
Jan 19 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
9110
by: ahaideb | last post by:
I have a table (relation) in my database: --------------- | parent | child | --------------- | 1 | 2 | | 1 | 3 | | 2 | 4 | | 2 | 5 ...
6
10960
by: jalkadir | last post by:
Let's say that I have this class: class Parent{ private: char* str; public: const char* getStr(){return str;} }; And then I create a child class class Child{ private: std::string str;...
4
4544
by: Danny Tuppeny | last post by:
Hi all, I've been trying to write some classes, so when I have a parent-child relationship, such as with Folders in my application, I don't have to remember to add a parent reference, as well as...
9
2647
by: kw | last post by:
What is the proper way to get the element ID for a client script? For example, suppose in the WebControl: TextBox t=new TextBox; t.ID=this.ClientID+"X"; .... Then elsewhere we want to access...
10
3983
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
7
2007
by: msxkim | last post by:
How to execute functions in the parent class first and then functions in the child class? For example, I have a parent class with functions 'ONE' and 'TWO' and child class has a function 'THREE'. ...
3
2670
by: Eddie | last post by:
If FormMain = MDI parent, FormSub = Child parent, I execute FormSub from the menu like this way. FormSub^ sub = gcnew FormSub; sub->MdiParent = this; sub->Show(); This can generate child...
10
19562
by: Goran Djuranovic | last post by:
Hi all, Does anyone know how to declare a variable in a class to be accessible ONLY from a classes instantiated within that class? For example: ************* CODE ***************** Public...
4
8237
by: jewel87 | last post by:
Hi everyone! I'm writing some code in C under UNIX, which should give some output like this: PARENT: pid = 10063 CHILD: my pid = 10064 CHILD: my parent's pid = 10063 CHILD: Sleeping... PARENT:...
0
7198
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7072
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
7271
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
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5570
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4998
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...
0
3149
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
373
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.