473,657 Members | 2,579 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>
<ContainerHandl e>urn:epc:id:gi d:49603356.41P. 000001</ContainerHandle >
<Container>
<ContainerHandl e>urn:epc:id:gi d:49603356.41C. 000001</ContainerHandle >
</Container>
<Container> <ContainerHandl e>urn:epc:id:gi d:49603356.41C. 000002</ContainerHandle >
</Container>
</Container>

<Container>
<ContainerHandl e>urn:epc:id:gi d:49603356.51P. 000001</ContainerHandle >
<Container>
<ContainerHandl e>urn:epc:id:gi d:49603356.51C. 000001</ContainerHandle >
</Container>
<Container> <ContainerHandl e>urn:epc:id:gi d:49603356.51C. 000002</ContainerHandle >
</Container>
</Container>

Thanks in advance
Umeshnath
Jan 16 '08 #1
1 1251
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*******@disc ussions.microso ft.comwrote in message
news:58******** *************** ***********@mic rosoft.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>
<ContainerHandl e>urn:epc:id:gi d:49603356.41P. 000001</ContainerHandle >
<Container>
<ContainerHandl e>urn:epc:id:gi d:49603356.41C. 000001</ContainerHandle >
</Container>
<Container>
<ContainerHandl e>urn:epc:id:gi d:49603356.41C. 000002</ContainerHandle >
</Container>
</Container>

<Container>
<ContainerHandl e>urn:epc:id:gi d:49603356.51P. 000001</ContainerHandle >
<Container>
<ContainerHandl e>urn:epc:id:gi d:49603356.51C. 000001</ContainerHandle >
</Container>
<Container>
<ContainerHandl e>urn:epc:id:gi d:49603356.51C. 000002</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
9119
by: ahaideb | last post by:
I have a table (relation) in my database: --------------- | parent | child | --------------- | 1 | 2 | | 1 | 3 | | 2 | 4 | | 2 | 5 | | 3 | 6 |
6
10968
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; public: std::string& getStr(){return str;}
4
4562
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 adding to the child collection, eg: parent.Children.Add(child); child.Parent = parent;
9
2659
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 it on the client: Control.Attributes = "javascript:document.getElementById('"+this.ClientID+"X"+"').value= 'test';";
10
4008
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 application. What should happen, is that the main MDI form should close, taking the child forms with it. There is code to loop through the child forms, remove the controls on each of them, and then close the form, but this code should execute only...
7
2029
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'. How should I declare classes so that all three functions are executed when child class is called? Class Parent public function ONE 'code end fuction
3
2690
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 form sub in FormMain. In th FormMain, there is status bar label named statusBar; I'd like to add code in the sub form that can access statusBar of parent
10
19606
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 Class Parent '*** HOW TO DECLARE IT *** Dim Age As String = "1/1/2000"
4
8241
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: my child's pid = 10064 PARENT: Waiting for the child to exit... CHILD: Done sleeping... PARENT: child is dead.
0
8392
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8823
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8730
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8605
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7321
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6163
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1607
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.