JAXB problems unmarshalling

I used xjc to generate a set of elements from the schema shown below:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://www.doc.state.nc.us/doccodes" xmlns="http://www.doc.state.nc.us/doccodes" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
     <xsd:element name="codeTable" type="CodeTable"/>
     <xsd:element name="codeRequest" type="CodeRequest"/>
     <xsd:complexType name="CodeTable">
          <xsd:sequence>
               <xsd:element name="codename" type="xsd:string"/>
               <xsd:element name="codes" type="Codes"/>
          </xsd:sequence>
     </xsd:complexType>
     <xsd:complexType name="Codes">
          <xsd:sequence>
          <xsd:element name="code" type="Code" minOccurs="1" maxOccurs="unbounded"/>
          </xsd:sequence>
     </xsd:complexType>
     <xsd:complexType name="Code">
          <xsd:sequence>
                    <xsd:element name="identifier" type="xsd:string"/>
                    <xsd:element name="description" type="xsd:string"/>
          </xsd:sequence>
     </xsd:complexType>
     <xsd:complexType name="CodeRequest">
          <xsd:sequence>
               <xsd:element name="application" type="xsd:string"/>
               <xsd:element name="token" type="xsd:string"/>
               <xsd:element name="codename" type="xsd:string"/>
          </xsd:sequence>
     </xsd:complexType>
</xsd:schema>
I have successfully been able to marshall an xml file using the following code:
jc = JAXBContext.newInstance( "nc.doc.nexus.code.jaxb.model");
CodeTable codeTable = new CodeTable();
Codes facilityCodes = new Codes();
List<Code> codeList = facilityCodes.getCode();
codeList.addAll(persistables); // where persistables is an ArrayList of Code objects
codeTable.setCodes(facilityCodes);
codeTable.setCodename("facilityCode");
JAXBElement<CodeTable> codeTableElement = (new ObjectFactory()).createCodeTable(codeTable);
Marshaller m = jc.createMarshaller();
m.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE );
m.marshal(codeTableElement, System.out);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
DocumentBuilder db;
try {
db = dbf.newDocumentBuilder();
Document doc = db.newDocument();
m.marshal(codeTableElement, doc);
return doc;
catch (ParserConfigurationException e) {
The marshalling works just fine, and results in the following xml:
<?xml version="1.0" encoding="UTF-8"?>
<ns1:codeTable xmlns="http://www.doc.state.nc.us/doccodes" xmlns:ns1="http://www.doc.state.nc.us/doccodes">
<ns1:codename>
facilityCode </ns1:codename>
<ns1:codes>
<ns1:code>
<ns1:identifier>
X001 </ns1:identifier>
<ns1:description>
DHO DISTRICT 1 </ns1:description>
</ns1:code>
<ns1:code>
<ns1:identifier>
X002 </ns1:identifier>
<ns1:description>
DHO DISTRICT 2 </ns1:description>
</ns1:code>
<ns1:code>
<ns1:identifier>
X003 </ns1:identifier>
<ns1:description>
DHO DISTRICT 3 </ns1:description>
</ns1:code>
</ns1:codes>
</ns1:codeTable>
My code to unmarshall this xml document is as follows:
JAXBContext jc;
try {
jc = JAXBContext.newInstance( "nc.doc.nexus.code.jaxb.model");
Unmarshaller unmarshaller = jc.createUnmarshaller();
JAXBElement<CodeTable> codeTableElement =
(JAXBElement<CodeTable>)unmarshaller.unmarshal(aDocument);
catch (JAXBException e) {
     throw new DeserializerException(e);
Now the problem. When I attempt to unmarshall this xml, I get the following UnmarshalException:
unexpected element (uri:"", local:"ns1:codeTable"). Expected elements are <{http://www.doc.state.nc.us/doccodes}codeRequest>,<{http://www.doc.state.nc.us/doccodes}codeTable>
I've made countless attempts to alter the unmarshal code in an attempt to determine if I had just coded it wrong, or whether jaxb is not able to interpret namespaces or schemas correctly. I have to assume the latter at this point. Can anybody shed any light on this?
By the way, below is the xjc generated class CodeTable:
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.0-b26-ea3
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2007.08.22 at 10:42:51 AM EDT
package nc.doc.nexus.code.jaxb.model;
import javax.xml.bind.annotation.AccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import nc.doc.nexus.code.jaxb.model.CodeTable;
import nc.doc.nexus.code.jaxb.model.Codes;
* <p>Java class for CodeTable complex type.
* <p>The following schema fragment specifies the expected content contained within this class.
* <pre>
* <complexType name="CodeTable">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="codename" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="codes" type="{http://www.doc.state.nc.us/doccodes}Codes"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
@XmlAccessorType(AccessType.FIELD)
@XmlType(name = "CodeTable", propOrder = {
"codename",
"codes"
public class CodeTable {
@XmlElement(namespace = "http://www.doc.state.nc.us/doccodes")
protected String codename;
@XmlElement(namespace = "http://www.doc.state.nc.us/doccodes")
protected Codes codes;
* Gets the value of the codename property.
* @return
* possible object is
* {@link String }
public String getCodename() {
return codename;
* Sets the value of the codename property.
* @param value
* allowed object is
* {@link String }
public void setCodename(String value) {
this.codename = value;
* Gets the value of the codes property.
* @return
* possible object is
* {@link Codes }
public Codes getCodes() {
return codes;
* Sets the value of the codes property.
* @param value
* allowed object is
* {@link Codes }
public void setCodes(Codes value) {
this.codes = value;
}

UPDATE: I changed the unmarshal code to unmarshal a File instead of a DOM Document, and it works. This is the revelation I was hoping not to come to. I really don't want to have to serialize my Document to a file and then unmarshal that file from disk. This would not be an acceptable solution for a large J2EE application with many web services servicing 10000 clients. Does anybody know why the unmarshal method that accepts a DOM Document does not work?

Similar Messages

  • JAXB Problem in Oracle9ias(9.0.3)

    Hi,
    I am getting following exception when i try to use JAXB in Oracle9ias(9.0.3).I have placed all latest JAXP and JAXB jars in j2ee\home also.
    Please help me to rectify this.
    Regds,
    Srini.
    PS:Stack trace is .....
    javax.xml.bind.JAXBException: Provider com.sun.xml.bind.ContextFactory could not be instantiated: java.lang.IncompatibleClassChangeError: Implementing class
    - with linked exception:
    [java.lang.IncompatibleClassChangeError: Implementing class]
    at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:118)
    at javax.xml.bind.ContextFinder.searchcontextPath(ContextFinder.java:233)
    at javax.xml.bind.ContextFinder.find(ContextFinder.java:153)
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:281)
    at ezcommerce.ezjumpins._srini._ezJaxb._jspService(_ezJaxb.java:50)
    [SRC:/EzCommerce/EzJumpins/Srini/ezJaxb.jsp:4]
    at com.orionserver[Oracle9iAS (9.0.3.0.0) Containers for J2EE].http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
    at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
    at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:560)
    at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
    at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
    at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.AJPRequestHandler.run(AJPRequestHandler.java:148)
    at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.AJPRequestHandler.run(AJPRequestHandler.java:72)
    at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:797)
    at java.lang.Thread.run(Thread.java:479)

    Unfortunately you are in a grey area here ... by replacing jars in the OC4J/Oracle9iAS distribution you may get a working configuration but typically this is not supported by Oracle Support - they only support certified configurations. Support typically wants a vanilla distribution if there are any problems or some
    sort of backport testing done by the engineering team.
    You may have seen that some folks on the list got a JAXB replacement to work with 9iAS 9.0.2 ... if you want to explore this see:
    JAXB Problem with App Server 9.0.2
    The one issue with the above response is the jaxp jar included in the OC4J distribution is set up to work with the Oracle XML parser so replacing this will likely break other aspects of the installation despite the poster above finding that it worked in his situation.
    Lastly, bear in mind in the Oracle XDK we are now shipping early versions of JAXB and plan to have a JAXB 1.0 implementation around JavaOne in the XML kit that is distributed with OC4J. This will eliminate the need to replace jar files. See:
    http://otn.oracle.com/tech/xml/xdk/content.html
    Hope this helps.
    Mike.

  • Problem unmarshalling xml using JAXB

    I am using JAXB for processing xml, which comes from an external source. Most often, the xml gets changed from external source which causes the error during unmarshalling as the xsd has not changed. Is there a way to process the xml in same way even if xsd hasn't changed, like converting new xml to one as per xsd etc. Someone has mentioned using xslt, but I would like to get more ideas on any other technologies or third party tools to overcome this issue so that I do not have to reply upon changing xsd everytime. Thanks

    Most often, the xml gets changed from external source which causes the error during unmarshalling as the xsd has not changed.So, you've got garbage input. Your goal should be to stop that from happening rather than trying to make it work.
    so that I do not have to reply upon changing xsd everytimeIf you have to keep changing the schema then perhaps JAXB wasn't a suitable technology choice here. Or maybe the design wasn't done properly. Or maybe (see earlier comment) the input files aren't being produced properly. At any rate you need to fix the underlying problem before writing code.

  • Problem Unmarshalling with JaxB

    I am running into a strange problem but I am sure there is a simple solution that I am overlooking. I currently have a Java application that uses JaxB. I build the application and run the jar file on my computer and everything runs fine. However when I try to run the jar file on another computer JaxB is unable to unmarshal the XML file. I am receiving a JAXBException with an error message stating:
    Provider com.sun.xml.bind.v2.ContextFactory not found
    I am unsure why the program runs fine on my computer but not on others. The computer the the program runs on is the computer that I used to develop the application. I am using Netbeans 5.5 if that matters.
    Any help with this would be well appreciated. Let me know if you have any additional questions.

    To make this problem even more difficult to figure out, I have determined that it does work on some computers, but doesn't work on some other computers.
    I have copied the dist folder that was created by Netbeans to a flash drive, and when I attempted to run it on one computer it failed with the above error. When I ran it on a second computer it worked exactly as intended. Any thoughts?

  • JAXB XML Unmarshalling validation problem

    Hello,
    I'm using toplink JAXB to map XML document to an object hierarchy. The set of objects was built using Toplink workbench from the corresponding XSD file. The XSD file is specified in <toplink:resource> element using an absolute path. If I use unmarshaller validation (Unmarshaller u = jc.createUnmarshaller(); u.setValidating(true)) it works fine in embedded oc4j, but fails withan UnmarshalException "An internal error condition occurred" for Line N 1.
    It looks like the cause of the exception is that toplink cannot find the XSD file. I've tried to put the XSD file into META-INF and into classes directly, and specify the relative path, but it has failed event locally in the embedded oc4j.
    Everything works if I do not turn the validation on.
    Has anybody gotten the same issue? What could be a solution if we have to perform the validation?
    Thanks
    Kate

    Hello Kate,
    One possible work around would be use the TopLink OXM specific APIs for this unmarshal. For the most part they mirror the JAXB APIs so there usage is pretty straight forward.
    XMLContext xmlContext = new XMLContext(YOUR_JAXB_CONTEXT_PATH);
    xmlUnmarshaller = xmlContext.createUnmarshaller();One API that we offer that is not part of the standard JAXB Unmarshaller is the ability to specify an EntityResolver. This class allows you to override where the XML Schema is loaded from.
    EntityResolver entityResolver = new YourEntityResolver();
    xmlUmarshaller.setEntityResolver(entityResolver);YourEntityResolver must implement org.xml.sax.EntityResolver. There is one method on this interface that returns an InputSource representing the XML Schema. You can implement this method to load the Schema from a ClassLoader.
    -Blaise

  • Validating datatypes with JAXB while unmarshalling

    Hi,
    is there in JAXB any method to check correct datatypes while JAXB unmarshalling
    For example, I tried to unmarshall an xml file to objects and in on element of this XML file there was the data "AAAA"
    <testElement>AAAA</testElement>
    in the XSD Shema this element was declared as type Integer.
    After unmarshalling the xml doc I've got an Object with an Attribut testElement which has the value "0" ... so can I test
    type while unmarshalling an throw an exception?
    Thanks a lot for your help!
    with best regards
    Rene
    Forget it ... problem almost solved ...
    Edited by: Gambler79 on Mar 10, 2008 2:48 PM

    I'm having what I think is a related problem to what's mentioned in this thread. Has anyone successfully used targetNamespace with JAXB? Below is the sample schema and xml I'm trying to unmarshal via JAXB version 1.02. Any help would be greatly appreciated.
    This is the schema:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema targetNamespace="http://foo.com/repository/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns="http://foo.com/repository/"
    elementFormDefault="unqualified"
    attributeFormDefault="unqualified">
    <xsd:element name="purchaseOrder" type="PurchaseOrderType"/>
    <xsd:complexType name="PurchaseOrderType">
    <xsd:sequence>
    <xsd:element name="poText" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>
    ====================================
    This is the XML:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <purchaseOrder xmlns="http://foo.com/repository/">
    <poText>foo</poText>
    </purchaseOrder>
    ====================================
    After calling unmarshal (with appropriate namespace), I get:
    DefaultValidationEventHandler: [ERROR]: Unexpected element {http://foo.com/repository/}:poText
    Location: line 3 of file:/C:/project/dev/prototype/repository/example/query.xml
    javax.xml.bind.UnmarshalException: Unexpected element {http://foo.com/repository/}:poText
    Can someone please let me know what I'm doing wrong here?
    Thanks.
    --S.

  • Debugging JAXB RI Unmarshalling

    Hello,
    I'm having some parsing issues with the Unmarshaller. If I have an input XML document that has an empty element where an xs:double should be, the Unmarshaller throws a NumberFormatException but the exception does not contain any useful information regarding what XML element was being parsed at the time of the error.
    When working with small XML docs this is ok as I can zero in on the problem quickly. However, for large XML docs the process of locating the value in error is quite time consuming.
    Is there a way to turn on trace/debug level debugging information in JAXB to help locate the problem in the XML doc?
    Thanks,
    Mark

    reading the jaxp api documentation a bit more closely shows that there is an unmarshall method that can be used to accept a character reader Reader via a decorator - the marshal(Source source) method

  • JAXB Problem: xjc gives an error

    Hello everyone,
    I would like to use JAXB to extract various information from a class of XML documents that conform to a schema. After tweaking the schema so that I avoid namespace conflicts with xjc, I settled the namespace conflicts, but I got the following error. Even if you don't have an answer, could you give me some pointers so that I can at least begin tackling the problem?
    Thank you very much!
    Here is the output of the command I ran:
    C:\Documents and Settings\Berk Kapicioglu\Desktop>xjc -p test.jaxb ownership4ADocument.xsd.xml -d work
    parsing a schema...
    java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.apache.commons.launcher.ChildMain.run(ChildMain.java:269)
    Caused by: java.util.MissingResourceException: Can't find resource for bundle ja
    va.util.PropertyResourceBundle, key parser.cc.8
    at java.util.ResourceBundle.getObject(ResourceBundle.java:314)
    at java.util.ResourceBundle.getString(ResourceBundle.java:274)
    at com.sun.msv.datatype.xsd.regex.RegexParser.ex(RegexParser.java:138)
    at com.sun.msv.datatype.xsd.regex.ParserForXMLSchema.parseCharacterClass
    (ParserForXMLSchema.java:291)
    at com.sun.msv.datatype.xsd.regex.RegexParser.parseAtom(RegexParser.java
    :736)
    at com.sun.msv.datatype.xsd.regex.RegexParser.parseFactor(RegexParser.ja
    va:638)
    at com.sun.msv.datatype.xsd.regex.RegexParser.parseTerm(RegexParser.java
    :342)
    at com.sun.msv.datatype.xsd.regex.RegexParser.parseRegex(RegexParser.jav
    a:320)
    at com.sun.msv.datatype.xsd.regex.RegexParser.parse(RegexParser.java:158
    at com.sun.msv.datatype.xsd.regex.RegularExpression.setPattern(RegularEx
    pression.java:3040)
    at com.sun.msv.datatype.xsd.regex.RegularExpression.setPattern(RegularEx
    pression.java:3051)
    at com.sun.msv.datatype.xsd.regex.RegularExpression.<init>(RegularExpres
    sion.java:3017)
    at com.sun.msv.datatype.xsd.PatternFacet.compileRegExps(PatternFacet.jav
    a:79)
    at com.sun.msv.datatype.xsd.PatternFacet.<init>(PatternFacet.java:67)
    at com.sun.msv.datatype.xsd.TypeIncubator.derive(TypeIncubator.java:261)
    at com.sun.tools.xjc.reader.xmlschema.DatatypeBuilder.restrictionSimpleT
    ype(DatatypeBuilder.java:82)
    at com.sun.xml.xsom.impl.RestrictionSimpleTypeImpl.apply(RestrictionSimp
    leTypeImpl.java:66)
    at com.sun.tools.xjc.reader.xmlschema.DatatypeBuilder.build(DatatypeBuil
    der.java:65)
    at com.sun.tools.xjc.reader.xmlschema.SimpleTypeBuilder.buildPrimitiveTy
    pe(SimpleTypeBuilder.java:161)
    at com.sun.tools.xjc.reader.xmlschema.SimpleTypeBuilder.access$100(Simpl
    eTypeBuilder.java:50)
    at com.sun.tools.xjc.reader.xmlschema.SimpleTypeBuilder$Functor.checkCon
    version(SimpleTypeBuilder.java:201)
    at com.sun.tools.xjc.reader.xmlschema.SimpleTypeBuilder$Functor.restrict
    ionSimpleType(SimpleTypeBuilder.java:276)
    at com.sun.xml.xsom.impl.RestrictionSimpleTypeImpl.apply(RestrictionSimp
    leTypeImpl.java:66)
    at com.sun.tools.xjc.reader.xmlschema.SimpleTypeBuilder.build(SimpleType
    Builder.java:93)
    at com.sun.tools.xjc.reader.xmlschema.cs.DefaultClassBinder.simpleType(D
    efaultClassBinder.java:130)
    at com.sun.xml.xsom.impl.SimpleTypeImpl.apply(SimpleTypeImpl.java:89)
    at com.sun.tools.xjc.reader.xmlschema.cs.ClassSelector._bindToClass(Clas
    sSelector.java:212)
    at com.sun.tools.xjc.reader.xmlschema.cs.ClassSelector.bindToType(ClassS
    elector.java:177)
    at com.sun.tools.xjc.reader.xmlschema.TypeBuilder.elementDeclFlat(TypeBu
    ilder.java:213)
    at com.sun.tools.xjc.reader.xmlschema.FieldBuilder.elementDecl(FieldBuil
    der.java:384)
    at com.sun.xml.xsom.impl.ElementDecl.apply(ElementDecl.java:174)
    at com.sun.tools.xjc.reader.xmlschema.FieldBuilder.build(FieldBuilder.ja
    va:76)
    at com.sun.tools.xjc.reader.xmlschema.DefaultParticleBinder$Builder.part
    icle(DefaultParticleBinder.java:399)
    at com.sun.tools.xjc.reader.xmlschema.BGMBuilder.applyRecursively(BGMBui
    lder.java:490)
    at com.sun.tools.xjc.reader.xmlschema.DefaultParticleBinder$Builder.mode
    lGroup(DefaultParticleBinder.java:462)
    at com.sun.xml.xsom.impl.ModelGroupImpl.apply(ModelGroupImpl.java:80)
    at com.sun.tools.xjc.reader.xmlschema.DefaultParticleBinder$Builder.buil
    d(DefaultParticleBinder.java:368)
    at com.sun.tools.xjc.reader.xmlschema.DefaultParticleBinder$Builder.part
    icle(DefaultParticleBinder.java:433)
    at com.sun.tools.xjc.reader.xmlschema.DefaultParticleBinder$Builder.buil
    d(DefaultParticleBinder.java:371)
    at com.sun.tools.xjc.reader.xmlschema.DefaultParticleBinder.build(Defaul
    tParticleBinder.java:70)
    at com.sun.tools.xjc.reader.xmlschema.ct.FreshComplexTypeBuilder$1.parti
    cle(FreshComplexTypeBuilder.java:48)
    at com.sun.xml.xsom.impl.ParticleImpl.apply(ParticleImpl.java:68)
    at com.sun.tools.xjc.reader.xmlschema.ct.FreshComplexTypeBuilder.build(F
    reshComplexTypeBuilder.java:35)
    at com.sun.tools.xjc.reader.xmlschema.ct.ComplexTypeFieldBuilder.build(C
    omplexTypeFieldBuilder.java:56)
    at com.sun.tools.xjc.reader.xmlschema.FieldBuilder.complexType(FieldBuil
    der.java:228)
    at com.sun.xml.xsom.impl.ComplexTypeImpl.apply(ComplexTypeImpl.java:194)
    at com.sun.tools.xjc.reader.xmlschema.FieldBuilder.build(FieldBuilder.ja
    va:76)
    at com.sun.tools.xjc.reader.xmlschema.cs.ClassSelector.build(ClassSelect
    or.java:340)
    at com.sun.tools.xjc.reader.xmlschema.cs.ClassSelector.access$000(ClassS
    elector.java:54)
    at com.sun.tools.xjc.reader.xmlschema.cs.ClassSelector$Binding.build(Cla
    ssSelector.java:107)
    at com.sun.tools.xjc.reader.xmlschema.cs.ClassSelector.executeTasks(Clas
    sSelector.java:240)
    at com.sun.tools.xjc.reader.xmlschema.BGMBuilder._build(BGMBuilder.java:
    118)
    at com.sun.tools.xjc.reader.xmlschema.BGMBuilder.build(BGMBuilder.java:8
    0)
    at com.sun.tools.xjc.GrammarLoader.annotateXMLSchema(GrammarLoader.java:
    424)
    at com.sun.tools.xjc.GrammarLoader.load(GrammarLoader.java:130)
    at com.sun.tools.xjc.GrammarLoader.load(GrammarLoader.java:79)
    at com.sun.tools.xjc.Driver.run(Driver.java:177)
    at com.sun.tools.xjc.Driver._main(Driver.java:80)
    at com.sun.tools.xjc.Driver.access$000(Driver.java:46)
    at com.sun.tools.xjc.Driver$1.run(Driver.java:60)

    Hi,
    A similar error occur to me twice.
    One because pattern specification error (The pattern was incorrectly written)
    The other one was because I had in the directory JAVA_HOME\jre\lib\endorsed the files that come from JWSDP_HOME\jaxb\lib.
    This files (jaxb-api.jar, jaxb-impl.jar, jaxb-libs.jar, jaxb-xjc.jar) should only be in the directory where they come from JWSDP_HOME\jaxb\lib
    If you have them in the JAVA_HOME\jre\lib\endorsed directory try removing them from there.
    Hope I help you.

  • JAXB cannot unmarshall and previous posts do not seem to be related

    Hello,
    Recently, we had to change some of our XSDs, so I went and downloaded the latest Java web services pack (v1.6) and made the changes to the schema (only one new element). First, I realized we were using a 0.75 EA1 release of JAXB and that I would have to re-generate all the classes for all our current XSDs because of 0.75 is so outdated.
    I regenerated all the classes and everything seemed to be in good order. When I started my application I received the following error (this is in jdk 1.5)
    Now, the XSD and the XML have not changed in 3 years... why is it that using this new version of JAXB seems to have messed things up? This errors is received when trying to unmarshall. I have been looking at this for three days and reading all the posts, i don;t think this is a namespaces issue because it used to work.... i just don't get it. any help is GREATLY appreciated.
    Thanks
    JAVA CODE HERE ********************************************
    JAXBContext jc = com.sun.xml.bind.ContextFactory.createContext("com.testbed.common.config", new JAXBClassLoader());
    Unmarshaller u = jc.createUnmarshaller();
    EXCEPTION HERE *********************************
    ./shorg.xml.sax.SAXParseException: unexpected root element ConfigInfo
    at com.sun.xml.bind.unmarshaller.SAXUnmarshallerHandlerImpl.startElement(SAXUnmarshallerHandlerImpl.java:94)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
    at com.sun.xml.bind.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:127)
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:131)
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:136)
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:145)
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:163)
    Here is the XML for the config file -
    XML HERE *************************************************
    <ConfigInfo>
    <LogFileConfig>logging.cfg</LogFileConfig>
    <HeartbeatTimeout>0</HeartbeatTimeout>
    <HeartbeatTopic>testTopic</HeartbeatTopic>
    <DatabaseConfig>
    <Name>TEST</Name>
    <Info>timmy/[email protected]:1521:DB1</Info>
    </DatabaseConfig>
    <JMSConfig>
    <MyName>TESTjms</MyName>
    <Connections>
    <connection id="1">
    <Address>192.168.1.2</Address>
    <Port>3035</Port>
    <Type>tcp</Type>
    <Factory>org.exolab.jms.jndi.mipc.IpcJndiInitialContextFactory</Factory>
    </connection>
    </Connections>
    </JMSConfig>
    <AgentProcessor>
    <MappingFile>test.map</MappingFile>
    <CommandFile>test.com</CommandFile>
    <EventQueueTime>15000</EventQueueTime>
    <SuppressionFile>supress.sup</SuppressionFile>
    </AgentProcessor>
    <StatusAlertTime>15000</StatusAlertTime>
    </ConfigInfo>
    And here is the XSD
    XSD HERE ***************************************************
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
         <xsd:annotation>
              <xsd:documentation xml:lang="en">Configuration file formats</xsd:documentation>
         </xsd:annotation>
         <xsd:element name="ConfigInfo" type="configInfoType">
              <xsd:annotation>
                   <xsd:documentation>The root element of the configuration file</xsd:documentation>
              </xsd:annotation>
         </xsd:element>
         <xsd:complexType name="configInfoType">
              <xsd:annotation>
                   <xsd:documentation>Contains the elements of a configuration file</xsd:documentation>
              </xsd:annotation>
              <xsd:sequence>
                   <xsd:element name="LogFileConfig" type="xsd:string"/>
                   <xsd:element name="HeartbeatTimeout" type="xsd:int"/>
                   <xsd:element name="HeartbeatTopic" type="xsd:string"/>
                   <xsd:element name="DatabaseConfig" type="dbConfigType" minOccurs="0" maxOccurs="unbounded"/>
                   <xsd:element name="JMSConfig" type="jmsConfigType" minOccurs="0"/>
                   <xsd:element name="NetsaintConfig" type="netsaintConfigType" minOccurs="0"/>
                   <xsd:element name="EventProcessor" type="epConfigType" minOccurs="0"/>
                   <xsd:element name="AgentProcessor" type="agConfigType" minOccurs="0"/>
                   <xsd:element name="DatabaseAgent" type="dbAgentType" minOccurs="0"/>
                   <xsd:element name="Heartbeater" type="hbConfigType" minOccurs="0"/>
                   <xsd:element name="StatusAlertTime" type="xsd:long"/>
                   <xsd:element name="RemoteConnection" type="remoteConnConfig" minOccurs="0"/>
              </xsd:sequence>
         </xsd:complexType>
         <xsd:complexType name="dbConfigType">
              <xsd:annotation>
                   <xsd:documentation>The Database configuration element, with a database name and connection info</xsd:documentation>
              </xsd:annotation>
              <xsd:sequence>
                   <xsd:element name="Name" type="dbInstanceType"/>
                   <xsd:element name="Info" type="xsd:string"/>
              </xsd:sequence>
         </xsd:complexType>
         <xsd:simpleType name="dbInstanceType">
              <xsd:annotation>
                   <xsd:documentation>Limits the database connections</xsd:documentation>
              </xsd:annotation>
              <xsd:restriction base="xsd:string">
                   <xsd:pattern value="TEST|TEST2"/>
              </xsd:restriction>
         </xsd:simpleType>
         <xsd:complexType name="jmsConfigType">
              <xsd:annotation>
                   <xsd:documentation>The base of the JMS configurations</xsd:documentation>
              </xsd:annotation>
              <xsd:sequence>
                   <xsd:element name="MyName" type="xsd:string"/>
                   <xsd:element name="Connections" type="connType"/>
              </xsd:sequence>
         </xsd:complexType>
         <xsd:complexType name="connType">
              <xsd:annotation>
                   <xsd:documentation>An individual JMS configuration with a priority ranked id and associated connection information</xsd:documentation>
              </xsd:annotation>
              <xsd:sequence>
                   <xsd:element name="connection" maxOccurs="unbounded">
                        <xsd:annotation>
                             <xsd:documentation>id attribute</xsd:documentation>
                        </xsd:annotation>
                        <xsd:complexType>
                             <xsd:sequence>
                                  <xsd:element name="Address" type="xsd:string"/>
                                  <xsd:element name="Port" type="xsd:int"/>
                                  <xsd:element name="Type" type="xsd:string"/>
                                  <xsd:element name="Factory" type="xsd:string"/>
                             </xsd:sequence>
                             <xsd:attribute name="id" type="xsd:int" use="required"/>
                        </xsd:complexType>
                   </xsd:element>
              </xsd:sequence>
         </xsd:complexType>
         <xsd:complexType name="netsaintConfigType">
              <xsd:annotation>
                   <xsd:documentation>Connection info for NetSaint alerting</xsd:documentation>
              </xsd:annotation>
              <xsd:sequence>
                   <xsd:element name="Address" type="xsd:string"/>
                   <xsd:element name="Port" type="xsd:int"/>
              </xsd:sequence>
         </xsd:complexType>
         <xsd:complexType name="epConfigType">
              <xsd:annotation>
                   <xsd:documentation>Event Processor base configuration</xsd:documentation>
              </xsd:annotation>
              <xsd:sequence>
                   <xsd:element name="TimeoutWarning" type="xsd:int"/>
                   <xsd:element name="TimeoutError" type="xsd:int"/>
                   <xsd:element name="Adaptors" type="adapType"/>
                   <xsd:element name="SuppressionTimeout" type="xsd:int" default="3600000"/>
                   <xsd:element name="EmailTimeoutWarning" type="xsd:int" minOccurs="0"/>
                   <xsd:element name="EmailTimeoutError" type="xsd:int" minOccurs="0"/>
              </xsd:sequence>
         </xsd:complexType>
         <xsd:complexType name="adapType">
              <xsd:annotation>
                   <xsd:documentation>The definition of the available adaptors</xsd:documentation>
              </xsd:annotation>
              <xsd:sequence>
                   <xsd:element name="EmailAdaptor" type="emailType" minOccurs="0"/>
                   <xsd:element name="DBAdaptor" type="dbType" minOccurs="0"/>
                   <xsd:element name="FrontEndAdaptor" type="feType" minOccurs="0"/>
                   <xsd:element name="MetricsAdaptor" type="metricsType" minOccurs="0"/>
                   <xsd:element name="NetsaintAdaptor" type="netsaintType" minOccurs="0"/>
              </xsd:sequence>
         </xsd:complexType>
         <xsd:complexType name="netsaintType">
              <xsd:sequence>
                   <xsd:element name="Enabled" type="YesNo"/>
              </xsd:sequence>
         </xsd:complexType>
         <xsd:complexType name="emailType">
              <xsd:annotation>
                   <xsd:documentation>Email adaptor definition</xsd:documentation>
              </xsd:annotation>
              <xsd:sequence>
                   <xsd:element name="SMTPHost" type="xsd:string"/>
                   <xsd:element name="Sender" type="xsd:string"/>
                   <xsd:element name="Recipient" type="xsd:string" minOccurs="0"/>
                   <xsd:element name="GPGCommand" type="xsd:string" minOccurs="0"/>
                   <xsd:element name="LookupEmails" type="YesNo" minOccurs="0"/>
                   <xsd:element name="XSL" type="xsd:string"/>
              </xsd:sequence>
         </xsd:complexType>
         <xsd:simpleType name="YesNo">
              <xsd:annotation>
                   <xsd:documentation>A "Y" or "N" type for use within the configuration file</xsd:documentation>
              </xsd:annotation>
              <xsd:restriction base="xsd:string">
                   <xsd:pattern value="Y|N"/>
              </xsd:restriction>
         </xsd:simpleType>
         <xsd:complexType name="dbType">
              <xsd:annotation>
                   <xsd:documentation>Database adaptor configuration</xsd:documentation>
              </xsd:annotation>
              <xsd:sequence>
                   <xsd:element name="Threads" type="xsd:int"/>
                   <xsd:element name="XSL" type="xsd:string" minOccurs="0"/>
                   <xsd:element name="Mode" type="dbProcessingMode"/>
                   <xsd:element name="DeviceServerAddr" type="xsd:string"/>
              </xsd:sequence>
         </xsd:complexType>
         <xsd:simpleType name="dbProcessingMode">
              <xsd:annotation>
                   <xsd:documentation>Defines the available Database Adaptor modes</xsd:documentation>
              </xsd:annotation>
              <xsd:restriction base="xsd:string">
                   <xsd:pattern value="NORMAL|XML"/>
              </xsd:restriction>
         </xsd:simpleType>
         <xsd:complexType name="feType">
              <xsd:annotation>
                   <xsd:documentation>FrontEnd adaptor definition</xsd:documentation>
              </xsd:annotation>
              <xsd:sequence>
                   <xsd:element name="Publish" type="xsd:string"/>
              </xsd:sequence>
         </xsd:complexType>
         <xsd:complexType name="metricsType">
              <xsd:annotation>
                   <xsd:documentation>Metrics adaptor definition</xsd:documentation>
              </xsd:annotation>
              <xsd:sequence>
                   <xsd:element name="Path" type="xsd:string"/>
              </xsd:sequence>
         </xsd:complexType>
         <xsd:complexType name="agConfigType">
              <xsd:annotation>
                   <xsd:documentation>AgentPeer configuration</xsd:documentation>
              </xsd:annotation>
              <xsd:sequence>
                   <xsd:element name="MappingFile" type="xsd:string"/>
                   <xsd:element name="CommandFile" type="xsd:string"/>
                   <xsd:element name="EventQueueTime" type="xsd:int"/>
                   <xsd:element name="SuppressionFile" type="xsd:string" minOccurs="0"/>
                   <xsd:element name="FWHourlyCommand" type="xsd:string" minOccurs="0"/>
                   <xsd:element name="FWDailyCommand" type="xsd:string" minOccurs="0"/>
              </xsd:sequence>
         </xsd:complexType>
         <xsd:complexType name="dbAgentType">
              <xsd:annotation>
                   <xsd:documentation>Database Agent configuration</xsd:documentation>
              </xsd:annotation>
              <xsd:sequence>
                   <xsd:element name="LowLevelAckTime" type="xsd:int"/>
                   <xsd:element name="LowLevelQueryWindow" type="xsd:int"/>
                   <xsd:element name="MessageQueryTime" type="xsd:int"/>
                   <xsd:element name="MaxMessagingRate" type="xsd:double"/>
              </xsd:sequence>
         </xsd:complexType>
         <xsd:complexType name="hbConfigType">
              <xsd:annotation>
                   <xsd:documentation>Heartbeater configuration</xsd:documentation>
              </xsd:annotation>
              <xsd:sequence>
                   <xsd:element name="HeartbeatTopic" type="xsd:string"/>
                   <xsd:element name="HeartbeatPeriod" type="xsd:int"/>
              </xsd:sequence>
         </xsd:complexType>
         <xsd:complexType name="remoteConnConfig">
              <xsd:annotation>
                   <xsd:documentation>Remote Connection configuration info</xsd:documentation>
              </xsd:annotation>
              <xsd:sequence>
                   <xsd:element name="RemoteHost" type="xsd:string"/>
                   <xsd:element name="RemotePort" type="xsd:int"/>
                   <xsd:element name="MyName" type="xsd:string"/>
              </xsd:sequence>
         </xsd:complexType>
    </xsd:schema>

    have you tried it with only 1 complexType in the xsd with the element?
    I have an xsd with many complexTypes and found that the root element was not what i thought it was (ie in your case ConfigInfo) and was having to append an xml tag at the start and end.
    Don't know if it's something to do with the new version of JAXB as the one with 1.6 is the only one i have used...
    m

  • JAXB problem generating java classes

    I'm doing some integration and have received a schema from the vendor the other day. When I try to generate java classes with the jaxb compiler I get this output
    parsing a schema...
    [ERROR] Property "Value" is already defined.
      line 14 of jar:file:/C:/win32app/Java/jdk6/lib/tools.jar!/com/sun/xml/internal/xsom/impl/parser/datatypes.xsd
    [ERROR] The following location is relevant to the above error
      line 384 of file:/C:/code/sca-ecr.xsd
    Failed to parse a schema.
        <xsd:complexType name="options">
            <xsd:sequence>
                <xsd:element name="option" maxOccurs="unbounded">
                    <xsd:complexType>
                        <xsd:simpleContent>
                            <xsd:extension base="xsd:string">
    (Line 384)                  <xsd:attribute name="value" type="xsd:string"/>
                            </xsd:extension>
                        </xsd:simpleContent>
                    </xsd:complexType>
                </xsd:element>
            </xsd:sequence>
        </xsd:complexType>So, googling about this I came across these to articles that almost describes my problem.
    http://weblogs.java.net/blog/kohsuke/archive/2005/05/compiling_mathm_1.html
    https://jaxb.dev.java.net/guide/Dealing_with_errors.htmlAdding the this code did not help. Downloading JAXB 2.1.4 did not help, adding the -extension parameter still same result.
            <xsd:annotation>
              <xsd:appinfo>           
                <jaxb:property name="someAttribute" />
              </xsd:appinfo>
            </xsd:annotation>      Why is jaxb failing ? Could it be that and attribute is not allowed to be called "value" ?
    Any answers will do
    regards abq

    Well, after hours of digging I found a solution which actually was right in front of me the whole time.
    This is how I edited the schema.
        <xsd:complexType name="options">
            <xsd:sequence>
                <xsd:element name="option" maxOccurs="unbounded" >
                    <xsd:complexType>
                        <xsd:simpleContent>
                            <xsd:extension base="xsd:string">
                               <xsd:attribute name="value" type="xsd:string" >
                                  <xsd:annotation><xsd:appinfo>
                                    <jaxb:property name="realValue" />
                                  </xsd:appinfo></xsd:annotation>
                                 </xsd:attribute>
                            </xsd:extension>
                        </xsd:simpleContent>
                    </xsd:complexType>
                </xsd:element>
            </xsd:sequence>
        </xsd:complexType>Before, I placed the <xsd:annotation> tag efter the first line but inside the <xsd:attribute> made much better if you would like it to work.
    When marshling an @XmlRoot object will produce valid xml code. So even though that the server have a different xml schema, they will be able to talk to each other.
    abq

  • Fetch error and jaxb problem in weblogic 12c

    Hi,
    I have a problem with running my webService in Weblogic 12c. The response of the webService is an entity which has an OneToMany relationship. After executing the service, its response could not be generated. I think there is a problem during MOXy’s unmarshalling operation of response entity (I haven’t had any problem in weblogic 11, because it don’t use MOXy ).
    What do you think about this problem and solution?
    Regards
    Edited by: Elham on May 27, 2012 12:51 AM

    Note that WebLogic 12c endorses JavaEE6.
    Look ups and how JNDI works is explained in the JavaEE6 tutorial: http://docs.oracle.com/javaee/6/tutorial/doc/gipjf.html

  • JAXB, problems trying to run a program

    Hi!
    I made a program similar to the create marshal example from the Java Web Services Tutorial. It compiled ok, but when I try:
    java Main
    I get the following error:
    Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
    Do you know what might be causing this problem?
    Thanks!

    I've got this problem before,
    as time limited,
    I simply extract and copy the <jwsdp_home>\jaxb\lib\jaxb_api.jar to the folder containing the Main.java.

  • JAXB: Problem generating java enums

    Hi
    I'm having som problems configuring JAXB to generate type safe enums. The schema I'm using has several structures similar to this simplified example:
        <xs:element name="Car">
            <xs:complexType>
                <xs:sequence>
                    <xs:element name="CarTypeEnumInComplexType">
                        <xs:simpleType>
                            <xs:restriction base="xs:string">
                                <xs:enumeration value="Truck"/>
                                <xs:enumeration value="Jeep"/>
                                <xs:enumeration value="SUV"/>
                            </xs:restriction>
                        </xs:simpleType>
                    </xs:element>
                </xs:sequence>
            </xs:complexType>
        </xs:element>In the resulting Java code CarTypeEnumInComplexType is just generated as a String value in the Car Interface.
    What I really want is a separate Java class for "CarTypeEnumInComplexType" - with constants for each enumeration value.
    However, I do not want to change the schema - as this is maintained by another company.
    For a moment I thought I'd found the solution: By setting the global binding setting "typesafeEnumBase" to "xs:string" I made JAXB generate this kind of enumeration classes in cases like this:
    <xs:simpleType name="CarTypeEnum">
            <xs:restriction base="xs:string">
                <xs:enumeration value="Truck"/>
                <xs:enumeration value="Jeep"/>
                <xs:enumeration value="SUV"/>
            </xs:restriction>
        </xs:simpleType>However, I still can't make this work for enumerations nested within a complex type as illustrated in the first example.
    I'm new to XML schemas and JAXB - so I may be missing something obvious here...
    Is there any way to make JAXB generate an enum class for "CarTypeEnumInComplexType" in my first example without altering the schema structure?
    Vidar

    Well I couldnt really find any clear documentation to this , however with this post I was able to get going in the right direction I thought I would post the solution here.
    This assumes you have some control of your schema , it doesnt solve the problem where you cant touch the schema at all.
    So first my bindings.xjb file looks like:
    <?xml version="1.0"?>
    <jxb:bindings version="1.0" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" jxb:extensionBindingPrefixes="xjc">
         <jxb:bindings schemaLocation="CMSOSS.xsd" node="/xs:schema">
              <jxb:globalBindings typesafeEnumBase ="xs:string">
                   <xjc:serializable uid="12343"/>
              </jxb:globalBindings>
              <jxb:schemaBindings>
                   <jxb:package name="com.cms.oss"/>
                   <jxb:nameXmlTransform>
                        <jxb:elementName suffix="Element"/>
                   </jxb:nameXmlTransform>
              </jxb:schemaBindings>
         </jxb:bindings>
    </jxb:bindings>
    First its necessary to have the enum type defined outside of the complex type:
    <xs:simpleType name="serviceTypeEnum">
              <xs:annotation>
                   <xs:documentation>Type of service being added (RES, BUS, FAX, POTS)</xs:documentation>
              </xs:annotation>
              <xs:restriction base="xs:string">
                   <xs:enumeration value="RES"/>
                   <xs:enumeration value="BUS"/>
                   <xs:enumeration value="FAX"/>
                   <xs:enumeration value="POTS"/>
              </xs:restriction>
         </xs:simpleType>
    Then you can use the enum in your complex type in the following manner
         <xs:element name="service">
              <xs:annotation>
                   <xs:documentation>Create a service tag for each new line of service</xs:documentation>
              </xs:annotation>
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="phone"/>
                        <xs:element name="type" type="serviceTypeEnum">
                             <xs:annotation>
                                  <xs:documentation>Type of service being added (RES, BUS, FAX, POTS)
                                  </xs:documentation>
                             </xs:annotation>
                        </xs:element>
                        <xs:element ref="lineDevice"/>
                        <xs:element ref="LNP" minOccurs="0"/>
                        <xs:element ref="VMPIN"/>
                        <xs:element ref="location"/>
                        <xs:element name="userService" minOccurs="0" maxOccurs="unbounded"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
    Some better documentation on this would sure help ... however I dont think this solves completely the original problem...
    I would think that type safe enums should be built into the specification without all this custom binding stuff.
    R
    S

  • JAXB problem with DTD file

    Hi All,
    I just started to learn JAXB and I come to a point in which I need to run xjc on a dtd file and jxs file. The problem is that is gives me an ERROR :
    "parsing a schema...
    [ERROR] The markup in the document preceding the root element must be well-forme
    d.
    line 1 of checkbook.dtd
    This is my dtd file:
    <!ELEMENT checkbook ( transactions, balance ) >
    <!ELEMENT transactions ( deposit | check | withdrawal )* >
    <!ELEMENT deposit ( date, name, amount )>
    <!ATTLIST deposit category ( salary | interest-income | other ) #IMPLIED >
    <!ELEMENT check ( date, name, amount, ( pending | void | cleared ), memo? )>
    <!ATTLIST check number CDATA #REQUIRED category ( rent | groceries | other ) #IMPLIED >
    <!ELEMENT withdrawal ( date, amount ) >
    <!ELEMENT balance (#PCDATA) >
    <!ELEMENT date (#PCDATA ) >
    <!ELEMENT name (#PCDATA) >
    <!ELEMENT amount (#PCDATA) >
    <!ELEMENT memo (#PCDATA) >
    <!ELEMENT pending EMPTY >
    <!ELEMENT void EMPTY >
    <!ELEMENT cleared EMPTY >
    What is the problem with it?
    Need your help and THANKS in advance
    A.B

    Try adding dom4j.jar (http://www.dom4j.org/) to your classpath and compiling with the -dtd switch. E.g.:
    xjc -dtd foo.dtd
    -- Ed

  • JAXB problem to manage nested complex types

    Hi!
    I've defined a XSD schema to design a folder structure. So I created a complex type which contains a sequence of 'folder' type elements.
    The folder type element includes several elements and a final one which is another 'folder' type element.
    So it is easy to model a general folder structure, no matter the depth and length.
    When I compile it with JAXB to have an OO view I catch the following error:
    Nested type Folder hides an enclosing type
    The fragment of code which caused the error is:
    * Java content class for Folder complex type.
    * <p>The following schema fragment specifies the expected content contained within this java content object. (defined at file:/C:/Progetti/folderschemaexample.xsd line 10)
    * <p>
    * <pre>
    * <complexType name="Folder">
    *   <complexContent>
    *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    *       <choice maxOccurs="unbounded" minOccurs="0">
    *         <element name="folder_name" type="{http://www.w3.org/2001/XMLSchema}string"/>
    *         <element name="security" type="{}ACL"/>
    *         <element name="folder" type="{}Folder"/>
    *       </choice>
    *     </restriction>
    *   </complexContent>
    * </complexType>
    * </pre>
    */The error is raised when JAXB tries to compile a Folder interface as inner in another Folder interface (generated.Folder.Folder).
    Is any JAXB guru able to suggest me how to exit from this situation to create succesfully a JAXB compliant schema which models this folder structure?
    TIA

    Hi!
    I've defined a XSD schema to design a folder structure. So I created a complex type which contains a sequence of 'folder' type elements.
    The folder type element includes several elements and a final one which is another 'folder' type element.
    So it is easy to model a general folder structure, no matter the depth and length.
    When I compile it with JAXB to have an OO view I catch the following error:
    Nested type Folder hides an enclosing type
    The fragment of code which caused the error is:
    * Java content class for Folder complex type.
    * <p>The following schema fragment specifies the expected content contained within this java content object. (defined at file:/C:/Progetti/folderschemaexample.xsd line 10)
    * <p>
    * <pre>
    * <complexType name="Folder">
    *   <complexContent>
    *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    *       <choice maxOccurs="unbounded" minOccurs="0">
    *         <element name="folder_name" type="{http://www.w3.org/2001/XMLSchema}string"/>
    *         <element name="security" type="{}ACL"/>
    *         <element name="folder" type="{}Folder"/>
    *       </choice>
    *     </restriction>
    *   </complexContent>
    * </complexType>
    * </pre>
    */The error is raised when JAXB tries to compile a Folder interface as inner in another Folder interface (generated.Folder.Folder).
    Is any JAXB guru able to suggest me how to exit from this situation to create succesfully a JAXB compliant schema which models this folder structure?
    TIA

Maybe you are looking for

  • Field-Symbols: How to retrieve data into an internal table from FS

    Hello All, I am working on field symbols.I have declared the field symbols as shown. FIELD-SYMBOLS: <gt_pos_data>  TYPE table,                            <wa_pos_data> like <gt_pos_data>. Data: Begin of itab occurs 0,            field1(5) type c,    

  • Map doesn't display in PS Elements 12 organizer

    I'm trying to add places to photos, and the map doesn't display in the organizer. It's just a blank white page. I can't add any locations. All other connectivity is fine. Program just auto updated today. Any help is appreciated.

  • IPC permission problems when starting Listener

    I have installed Oracle 8.0.5 on my Redhat 5.2 system. I am able to start the database instance and access it with SQL Plus. I am also able to start the listener and get a response back from the listener using tnsping. However, when starting the list

  • Lightroom wont import

    hi all for some very strange reason lightroom 1.4.1 has decided it doesnt want to import from anywhere to LR grid ?? i have tried from a variety of sources - compact flash through card reader also SD card, from external hard drive and from finder. i

  • Camera raw reducing image size

    All of a sudden Camera Raw is automatically reducing my image sizes. I cannot figure out why. The images were shot with a Nikon 5100 if that has any value. The original jpg size is 15MB (jpg) and have a NEF extension. I've tried opening the image in