This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Regarding reading using XMLbeans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Regarding reading using XMLbeans" Watch "Regarding reading using XMLbeans" New topic
Author

Regarding reading using XMLbeans

Priyakant Charokar
Ranch Hand

Joined: May 08, 2004
Posts: 58

Hi,
Please help me about this XMLbeans example.

I have an XSD, the person.xsd

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="person-group">
<xs:complexType>
<xs:sequence>
<xs:element name="person" type="person" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="person">
<xs:sequence>
<xs:element name="name" type="xs:string" />
<xs:element name="age" type="xs:int" />
</xs:sequence>
</xs:complexType>
</xs:schema>

person.xml

<?xml version="1.0" encoding="UTF-8"?>
<person-group>
<person>
<name>Mohan</name>
<age>12</age>
</person>
<person>
<name>Sohan</name>
<age>15</age>
</person>
<person>
<name>Rohan</name>
<age>16</age>
</person>
<person>
<name>Jane</name>
<age>20</age>
</person>
<person>
<name>PC</name>
<age>29</age>
</person>
</person-group>

I geneated the jar using scomp command

I want to read this XML using XMLBeans in one object and iterate it to all other person object.

Q: Is it possible to get all person object in one object say PersonGroup ?
Q: How to iterate over person object ?


Kindly reply.

Thanks,


SCJP, SCWCD, SCMAD, SCEA, OCPJP 7, CSM
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Regarding reading using XMLbeans
 
Similar Threads
XML valiadation using schema
newbie question: ref or complex type ?
[schema] Allow an element to have any content
Changing noNamespace to logical name in XMLbeans
Creating a JMS TextMessage From XML