users@jaxb.java.net

RE: Is it possible to use JAXB having a partial schema of the documents to be processed?

From: George Datuashvili <George.Datuashvili_at_Siebel.com>
Date: Fri, 21 May 2004 12:41:28 -0600

Put xs:any after first "deterninistic" element you don't care about,
which has minOccurs==maxOccurs
 
  _____

From: Jorge Medina [mailto:Jorge_Medina_Ang_Collan_at_symantec.com]
Sent: Friday, May 21, 2004 10:40 AM
To: users_at_jaxb.dev.java.net
Subject: Re: Is it possible to use JAXB having a partial schema of the
documents to be processed?




        I tried to use :
        
                        <xsd:any minOccurs="0" maxOccurs="unbounded"
processContents="lax" />
        
        to skip sections (elements) I dont want to define in the schema,
but I got the following error from JAXB when performing the binding:
        
        [ERROR] cos-nonambig: "http://www.abc.com/xml/schemas":comment
and WC[##any] (or elements from their substitution group) violate
"Unique Particle Attribution".
          line 61 of package.xsd
        
        Writing the full schema can require lot of time and I am not
sure I can even write the full schema given that there is few
documentation on the structure of the full document.
        
        Any hints ?
                
        
        
        
               Let me explain the problem:
               We can receive a document that contains multiple
"<elements>".
               For example:
                       <document attr1="value1" attr2="value3"
attr3="abc">
                               <sectionAAA>
                                       <something name="somevalue"
other="othervalue"/>
                                       <something name="somevalue2"
other="othervalue2"/>
                               </sectionAAA>
                               <sectionBBB someattr="valueXXX">
                                       <someOtherStructure/>
                               </sectionBBB>
                               <sectionCCC>
                                       <someotherElementsHere/>
                               </sectionCCC>
                       </document>
        
               Nevertheless, the application is only interested on a
couple of <elements> and for some elements, only in a few of all the
possible attributes.
        
               Is it possible to use JAXB without having to write the
schema for all the element declarations and/or attributes that are not
of interest for the application ?
        
               I found that I can write the schema using:
                       
                       <xsd:anyAttribute processContent="lax"/>
        
               after my list of "interesting" attributes, but JAXB
ignores the line and actually complains if the unmarshaller validation
is turned on and finds an attribute not included in the schema.
        
               Any hints ? I don't write to write a schema for the full
document since this particular application is never going to do anything
with the the rest of the document.
               
        -Jorge