OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   how to save an n-ary tree of nodes to and from an xml file?

[ Lists Home | Date Index | Thread Index ]
  • To: xml-dev@lists.xml.org
  • Subject: how to save an n-ary tree of nodes to and from an xml file?
  • From: Anil Philip <goodnewsforyou@yahoo.com>
  • Date: Mon, 12 Sep 2005 10:39:51 -0700 (PDT)
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=26upRDYtFNLGA9jV0Q1Tpr5Lq1f2n9bwBxRwIKs2jEdD9QY/3thffZinCBjSzx4Vjb1llG0nrkJxBoHtTazhxlco3+g/plFOr17dJQ1ZyaHUsJq6Yrui3LQkjECHoZpeksBlT/yk1PSWGf+4YuIXxs8/BrF9z0mSO7tb2i+P2kU= ;

Hello,
I am trying to find how to implement something in XML
and was disappointed and surprised to find not too
many in-depth tutorials or information; unlike in Java
where the Sun Java tutorial at java.sun.com is enough
to get one working productively...
[ok, rant over]

---
I am trying to represent a n-ary tree of nodes in xml.
More accurately, I am trying to save/instantiate a
tree of nodes to-from an xml file.
Am finding it difficult trying to represent the
parent-child relationships.

Java: (simplified)
-----

class Node {
Arraylist childNodes;
Node parent;
String data;
}

Qs:
In the instance document xml file; 
1) How would one display the parent node?
2) If a child has a reference to a parent node as in
the schema below, how can one know that the references
are the same?
i.e. when the parent node is first declared and when
it is referred to by the child.
Perhaps this raises a larger question - how does XML
handle recursive references?
--------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
targetNamespace="http://juwo.com/acd";
xmlns="http://juwo.com/acd";
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:annotation>
<xs:documentation>ACD nodes. juwo LLC
2005</xs:documentation>
</xs:annotation>
<xs:complexType name="Node">
<xs:sequence>
<xs:element name="parent" type="Node" minOccurs="0"/>

<xs:element name="childNodes" type="ListOfNodes"/>

<xs:element name="data" type="xs:string"/>
</xs:sequence>

</xs:complexType>
<xs:complexType name="ListOfNodes">
<xs:sequence>
<xs:element name="i" type="Node" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
----
Any help appreciated.
thanks,
Anil Philip
Olathe, KS


for good news go to http://members.tripod.com/~goodnewsforyou/goodnews.html


		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS