logo       

Re: XmlBeans and sequence....: msg#00131

text.xml.xmlbeans.user

Subject: Re: XmlBeans and sequence....

HI,

There is one simple way associating level2 element with level22 elements by modifying your schema.
Embed all level22 in level2 element, as shown in following way,

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="root">
<xs:annotation>
<xs:documentation>Test </xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="level1" maxOccurs="unbounded"/>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="level2" type="level2Type" minOccurs="0"/>
</xs:sequence>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:complexType name="level2Type">
<xs:sequence>
<xs:element name="level22" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="text"/>
</xs:complexType>

</xs:schema>

Your XML may look like below,
<level1>Text</level1>
<level2 text="Text" >
<level22>Text</level22>
<level22>Text</level22>
</level2>

<level2 text="Text" >
<level22>Text</level22>
<level22>Text</level22>
<level22>Text</level22>
</level2>
</root>

Check if this helps you.

Thanks,
Jitesh


----- Original Message ----- From: "Sudesh Shetty" <shetty_sudesh@xxxxxxxxx>
To: <user@xxxxxxxxxxxxxxxxxxx>
Sent: Saturday, January 22, 2005 4:27 AM
Subject: XmlBeans and sequence....


Hi,
I've generated bindings for the following schema...
======================================
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v2004 rel. 4 U
(http://www.xmlspy.com) by Sudesh Shetty (Borland) -->
<xs:schema elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema";>
<xs:element name="root">
<xs:annotation>
<xs:documentation>Test </xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="level1"
maxOccurs="unbounded"/>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="level2" minOccurs="0"/>
<xs:element name="level22"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
===============================
the bindings that generated has the following api's
Root.getLevel1Array()
Root.getLevel2Array()
Root.getLevel22Array()
...

The problem I'm facing is given an xml instance of
================
<?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file generated by XMLSPY v2004 rel. 4 U
(http://www.xmlspy.com)-->
<root
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:noNamespaceSchemaLocation="C:\work\test.xsd">
<level1>Text</level1>
<level2>Text</level2>
<level22>Text</level22>
<level22>Text</level22>

<level2>Text</level2>
<level22>Text</level22>
<level22>Text</level22>
<level22>Text</level22>
</root>
========================
How do I associate the sequencing of levl2 and level22
elements. Lets say I want to display ech of the
level2/level22 sequences in their own
groups/messageboxes. If I do Root.getLevel2Array()
then I get all the level2 elements and I ave no way of
grouping them with their corresponding level22
counterparts. How does one achive this without using
the cursors ?




__________________________________
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xxxxxxxxxxxxxxxxxxx
For additional commands, e-mail: user-help@xxxxxxxxxxxxxxxxxxx



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise