Return-Path: Delivered-To: apmail-xmlbeans-user-archive@www.apache.org Received: (qmail 52896 invoked from network); 7 Jul 2009 21:58:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 Jul 2009 21:58:07 -0000 Received: (qmail 13988 invoked by uid 500); 7 Jul 2009 21:58:17 -0000 Delivered-To: apmail-xmlbeans-user-archive@xmlbeans.apache.org Received: (qmail 13927 invoked by uid 500); 7 Jul 2009 21:58:16 -0000 Mailing-List: contact user-help@xmlbeans.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: Reply-To: user@xmlbeans.apache.org List-Id: Delivered-To: mailing list user@xmlbeans.apache.org Received: (qmail 13919 invoked by uid 99); 7 Jul 2009 21:58:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Jul 2009 21:58:16 +0000 X-ASF-Spam-Status: No, hits=-1.8 required=10.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_MED,SPF_PASS,UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [129.55.12.41] (HELO ll.mit.edu) (129.55.12.41) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Jul 2009 21:58:04 +0000 Received: (from smtp@localhost) by ll.mit.edu (8.12.10/8.8.8) id n67LvgOx020513 for ; Tue, 7 Jul 2009 17:57:42 -0400 (EDT) Received: from lle2k7-hub01.llan.ll.mit.edu( ), claiming to be "LLE2K7-HUB01.mitll.ad.local" via SMTP by llpost, id smtpdAAAX6aapJ; Tue Jul 7 17:53:34 2009 Received: from LLE2K7-BE01.mitll.ad.local ([ ]) by LLE2K7-HUB01.mitll.ad.local ([ ]) with mapi; Tue, 7 Jul 2009 17:53:34 -0400 From: "Sanh, Ai-Hoa" To: "'user@xmlbeans.apache.org'" Date: Tue, 7 Jul 2009 17:53:33 -0400 Subject: Parsing and Substitution Groups Thread-Topic: Parsing and Substitution Groups Thread-Index: Acn/TV+Cxo2ryImOTvWiwFBH8C3jog== Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: multipart/alternative; boundary="_000_BE2E4CD25C69E948AF69AD4B77BBD9AF54387530B8LLE2K7BE01mit_" MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org --_000_BE2E4CD25C69E948AF69AD4B77BBD9AF54387530B8LLE2K7BE01mit_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I have the following in my xsd: gml:AbstractFeatureType extends gml:AbstractGMLType, which has a "gml:name"= element that is unbounded. After compiling the schemas, I get the following classes: public abstract interface net.opengis.gml.AbstractGMLType extends org.ap= ache.xmlbeans.XmlObject public class net.opengis.gml.impl.AbstractGMLTypeImpl extends org.apache= .xmlbeans.impl.values.XmlComplexContentImpl implements net.opengis.gml.Abst= ractGMLType public abstract interface net.opengis.gml.AbstractFeatureType extends ne= t.opengis.gml.AbstractGMLType public class net.opengis.gml.impl.AbstractFeatureTypeImpl extends net.op= engis.gml.impl.AbstractGMLTypeImpl implements net.opengis.gml.AbstractFeatu= reType public abstract interface mypackage.Alpha extends net.opengis.gml.Abstra= ctFeatureType public class mypackage.AlphaImpl extends net.opengis.gml.impl.AbstractFe= atureTypeImpl implements mypackage.Alpha public abstract interface mypackage.AlphaDocument extends net.opengis.gm= l.FeatureDocument public class mypackage.AlphaDocumentImpl extends net.opengis.gml.impl.Fe= atureDocumentImpl implements mypackage.AlphaDocument This is my xml snippet: " xmlns=3D"http://myserver/myns" xmlns:gml=3D"http://www.opengis.net/gml" gml:id=3D"alpha.A1"> This is my description http://myserver/myns/alpha> AA123 0,0 84,0 8= 4,48 0,48 0,0 aa123 I am testing this snippet of Java code: AbstractFeatureType feature =3D AbstractFeatureType.Factory.parse( xml = ); System.out.println( feature.getNameArray().length ); System.out.println( feature.getId() ); The code compiles, but I am getting "0" for the length and "null" for the i= d. However, if I were to use: AlphaDocument doc =3D AlphaDocument.Factory.parse( xml ); Alpha a =3D doc.getAlpha(); System.out.println( a.getId() ); System.out.println( a.getNameArray().length ); Then I get "1" and "alpha.A1", as I expect. Is this working as designed? Or am I doing something incorrectly. I would like very much to be able to get at these parts of the xml without = having to know that I am dealing with an Alpha or a Beta, as long as they b= oth extend the AbstractFeatureType. Is there another means of doing so if p= arsing is not the answer? Thank you for your help. Ai-Hoa Sanh --_000_BE2E4CD25C69E948AF69AD4B77BBD9AF54387530B8LLE2K7BE01mit_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

I have the following in my xsd:

 

   <xs:c= omplexType name=3D"Al= pha>

      <xs:c= omplexContent>

      =    <xs:extension base=3D"gm= l:AbstractFeatureType">

      =       <xs:sequence>

      =          <xs:element name=3D"al= phaString" type=3D"xs= :string"/>

      =          <xs:element ref=3D"gm= l:Polygon"/>

      =          <xs:element name=3D"aS= tring" type=3D"xs= :string"/>

      =       </xs:sequence>

      =    </xs:extension>

      </xs:= complexContent>

   </xs:= complexType>

 

   <xs:e= lement name=3D"al= pha" type=3D"tn= s:Alpha" substitutionGroup=3D"gml:_Feature"/>

 

 

gml:AbstractFeatureType = extends gml:AbstractGMLType, which has a “gml:name” element that is unbounded.

 

After compiling the sche= mas, I get the following classes:

 

   public abstract interface net.opengis.gml.AbstractGMLType extends org.apache.xmlbeans.XmlObject<= /o:p>

   public class net.opengis.gml.impl.AbstractGMLTypeImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements net.opengis.gml.AbstractGMLType

 

   public abstract interface net.opengis.gml.AbstractFeatureType extends net.opengis.gml.AbstractGMLType=

   public class net.opengis.gml.impl.AbstractFeatureTypeImpl extends net.opengis.gml.impl.AbstractGMLTypeImpl implements net.opengis.gml.AbstractFeatureType

 

   public abstract interface mypackage.Alpha extends net.opengis.gml.AbstractFeatureType

   public class mypackage.AlphaImpl extends net.opengis.gml.impl.AbstractFeatureTypeImpl implements mypackage.A= lpha

 

   public abstract interface mypackage.AlphaDocument extends net.opengis.gml.FeatureDocument

   public class mypackage.AlphaDocumentImpl extends net.opengis.gml.impl.FeatureDocumentImpl implements mypackage.AlphaDocument=

 

 

This is my xml snippet:

 

<alpha =

    xmlns:xsi=3D"http://www.w3.org/2001/X= MLSchema-instance"

    xsi:schemaLocat= ion=3D"http://myserver/myns ../../xsd/polygon.xsd"

    xmlns=3D"http://myserver/myns"

    xmlns:gml=3D"http://www.opengis.net/gml"

    gml:id=3D"al= pha.A1">

    <gml:= description>This is my description</gml:description>

    <gml:= name>http://myserver/myns/alpha&= lt;/gml:name>

    <alph= aString>AA123</alp= haString>

    <gml:= Polygon srsName= =3D"&q= uot;>

      =   <gml:outerBoundaryIs>

      =       <gml:LinearRing>

      =           <gml:coordinates decimal= =3D".&= quot; cs=3D",&= quot; ts=3D" &= quot;>0,0 84,0 8= 4,48 0,48 0,0</gml:coordinates>

      =       </gml:LinearRing>

      =   </gml:outerBoundaryIs>

    </gml= :Polygon>

    <aStr= ing>aa123</aSt= ring>

</alpha>

 

 

I am testing this snippet of Java code:

 

    AbstractFeatureTy= pe feature =3D AbstractFeatureType.Factory.parse( xml );

    System.out.printl= n( feature.getNameArray().length );

    System.out.println( feature.getId() );

   

 

The code compiles, but I am getting “0” fo= r the length and “null” for the id.

 

However, if I were to use:

 

    AlphaDocument doc =3D AlphaDocument.Factory.parse( xml );

    Alpha a =3D doc.getAlpha();

    System.= out.println( a.getId() );    System.= out.println( a.getNameArray().length );

 

Then I get “1̶= 1; and “alpha.A1”, as I expect.

 

Is this working as desig= ned? Or am I doing something incorrectly.

 

I would like very much t= o be able to get at these parts of the xml without having to know that I am deal= ing with an Alpha or a Beta, as long as they both extend the AbstractFeatureTyp= e. Is there another means of doing so if parsing is not the answer?=

 

Thank you for your help.=

Ai-Hoa Sanh

 

--_000_BE2E4CD25C69E948AF69AD4B77BBD9AF54387530B8LLE2K7BE01mit_--