You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Sudesh Shetty <sh...@yahoo.com> on 2005/01/21 20:27:59 UTC

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@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


Re: XmlBeans and sequence....

Posted by Eric Vasilik <er...@vasilik.com>.
You can use the DOM, but this scenario is one of the reasons that
XmlCursor exists.

- Eric

> 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@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


Re: nullpointer with latest source

Posted by Marius Gleeson <xm...@subscribe.audumla.net>.
It is definitly the right version. However it is probably class loader
related. All of my xmlbeans are being loaded through a OSGI framework
which strictly manages class loaders and class dependancies. Even though
the class is loaded at this point it would appear to not be initialized.
Is there any other way of doing this check, because I think it could
cause issues in other strict classloading frameworks.
Marius.

On Tue, 25 Jan 2005 11:12:34 +0100, "Jean-Christophe Pazzaglia"
<Je...@eurecom.fr> said:
> Are you sure that the *right* version of the 'compiled schema'
> is in your classpath (package schema.system.s589xxxxxxxxxxxxx) ?
> 
> Maitre Panisse (jc) !
> 
> >Hi there,
> >
> >I just grabbed the latest source code and am now getting the following
> >exception when I try and start my app.
> >
> >Caused by: java.lang.NullPointerException
> >        at
> >        org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.<clinit>(SchemaTypeSystemImpl.java:149)
> >        ... 22 more
> >
> >
> >Is anyone else seeing this?
> >Marius.
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> >For additional commands, e-mail: user-help@xmlbeans.apache.org
> >
> >  
> >
> 
> 
> -- 
> Jean-Christophe.Pazzaglia@eurecom.fr
> Corporate communications
> Tel: (+33) 4-93-00-26-78 
> PGP Key available : http://www.eurecom.fr/~pazzagli/publickey.pgp
> --
> Institut Eurécom - Office 029
> http://www.eurecom.fr/
> 2229 Route des Crêtes 
> BP 193 
> 06904 Sophia Antipolis, France
> Fax: (+33) 4-93-00-26-27
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
> 
-- 
  Marius Gleeson
  audumla@fastmail.fm


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


Re: nullpopinter with latest source

Posted by Jean-Christophe Pazzaglia <Je...@eurecom.fr>.
Are you sure that the *right* version of the 'compiled schema'
is in your classpath (package schema.system.s589xxxxxxxxxxxxx) ?

Maitre Panisse (jc) !

>Hi there,
>
>I just grabbed the latest source code and am now getting the following
>exception when I try and start my app.
>
>Caused by: java.lang.NullPointerException
>        at
>        org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.<clinit>(SchemaTypeSystemImpl.java:149)
>        ... 22 more
>
>
>Is anyone else seeing this?
>Marius.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
>For additional commands, e-mail: user-help@xmlbeans.apache.org
>
>  
>


-- 
Jean-Christophe.Pazzaglia@eurecom.fr
Corporate communications
Tel: (+33) 4-93-00-26-78 
PGP Key available : http://www.eurecom.fr/~pazzagli/publickey.pgp
--
Institut Eurécom - Office 029
http://www.eurecom.fr/
2229 Route des Crêtes 
BP 193 
06904 Sophia Antipolis, France
Fax: (+33) 4-93-00-26-27
















---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


nullpopinter with latest source

Posted by mg <xm...@subscribe.audumla.net>.
Hi there,

I just grabbed the latest source code and am now getting the following
exception when I try and start my app.

Caused by: java.lang.NullPointerException
        at
        org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.<clinit>(SchemaTypeSystemImpl.java:149)
        ... 22 more


Is anyone else seeing this?
Marius.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


default values for created beans

Posted by mg <xm...@subscribe.audumla.net>.
Hi there,

I am creating new beans using the addNewXXX methods in the compiled
beans. However I was really hoping that the default values that I have
specified in the schema would be used to fill in the new bean. Also if a
child element is specified as having a minOccurs of 1 I would think that
the element would be automatically created as well.

What do you think?
Marius.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


Re: XmlBeans and sequence....

Posted by Kalyani Jitesh <j-...@kj.cnt.jp.nec.com>.
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" <sh...@yahoo.com>
To: <us...@xmlbeans.apache.org>
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@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org