JAXB unmarshalling error

We are getting a JAXB unmarshalling error:
while processing the following <condition> tag which is of type xsd:string
<condition> x < 100 </condition>
The error is probably happening due to "<" token as a part of string type.
xml.bind.JAXBException: Unexpected error in Unmarshalling
at oracle.xml.jaxb.JaxbUnmarshaller.unmarshal(JaxbUnmarshaller.java:224)
Any ideas how to resolve this issue?
Note
<condition> x >100 </condition> is getting unmarshalled successfully by JAXB unmarshaller.
Thanks

Hi,
Did you tried to put & lt; (without space) instead of < ?
Best Regards,
Paweł

Similar Messages

  • JAXB unmarshalling error for " " token as part of xsd:string type element

    JAXB unmarshalling error for "<" token as part of xsd:string type element
    We are getting a JAXB unmarshalling error:
    while processing the following <condition> tag which is of type xsd:string
    <condition> x < 100 </condition>
    The error is probably happening due to "<" token as a part of string type.
    xml.bind.JAXBException: Unexpected error in Unmarshalling
    at oracle.xml.jaxb.JaxbUnmarshaller.unmarshal(JaxbUnmarshaller.java:224)
    Any ideas how to resolve this issue?
    Note
    <condition> x > 100 </condition> is getting unmarshalled successfully by JAXB unmarshaller.
    Thanks

    Hi,
    Did you tried to put & lt; (without space) instead of < ?
    Best Regards,
    Paweł

  • [JAXB 2.0] Unmarshalling error if the XML contains w3c.Element nodes

    Hi!
    I'm using the JAXB 2.0 library to create an XML file according to a XML Schema (XSD).
    I use the JAXB 2.0 classes, that I have previuosly generated, to fill the data and finally I execute the marshal method to store a XML file with the object's info.
    The second step is unmarshalling the file. Alright in my first attempt: I get all the JAXB objects filled with the data of the file.
    Now I try to add w3c.dom.Element nodes underneath a JAXB object that accepts a list of w3c.dom.Elements:
    org.w3c.dom.Element cip = (org.w3c.dom.Element) doc.createElement("CIP");
    root.appendChild(cip);
    t = doc.createTextNode("CIP");
    t.setData("TEST");
    cip.appendChild(t);
    qpd3.getAny().add(cip);
    And the resulting XML file is marshalled correctly again. Moreover, the node QPD contains a list of simple nodes like 'CIP' (the w3c.dom.Element of the example).
    The second step, to try unmarshalling the XML file I just have generated:
    Using a main method in my class the file is unmarshalled with no problems.
    It's now, when I deploy the web service that calls the unmarshall method (sending the same XML file to the same function), I receive a parsing error!!
    2007-01-30 20:00:08.221 ERROR caught exception while handling request: java.lang.IllegalAccessError: void oracle.xml.parser.schema.XSDNode.<init>()
    Why does this error appear??? I supose JDeveloper tries to parser the w3c.dom.Element nodes like a XSDNode and therefore it fails (what is a XSDNode...?). But if I execute the same method from the "main" of my class it works! Maybe the problem is related with the libraries that OC4J loads when it starts...
    Can anyone help me?? Thanks in advance!
    Sergi

    Hi Blaise,
    The Document class I use to generate the w3c.dom.Element nodes in the marshaling procedure belongs to oracle.xml.parser.v2.XMLDocument class. And it is located in the jar file: file:/C:/Oracle/jdeveloper/jdk/jre/lib/rt.jar!/org/w3c/dom/Document.class
    I have also checked if the unmarshal method of my class has linked the same library, althought is not used in the unmarshalling process (but maybe is implicit...) and it's OK.
    Have you seen something wrong?
    Thank you!
    Sergi

  • JAXB Unmarshall Validation Error Handling

    Hello,
    During unmarshalling, if say a required element is missing, a ValidationEvent is created and passed to the handleEvent(ValidationEvent e) method of a custom class implementing the ValidationEventHandler interface.
    From the ValidationEvent, one can get the ValidationEventLocator, which allows you to find out the column and row numbers of where the validation failed in the XML file.
    The problem is, this XML file that is being unmarshalled/marshalled is hidden from the user and not allowed to be accessed directly. I would like to tell the user where the validation failed by referencing nodes instead of column/line numbers.
    For example, if an element called 'foo' requires one child 'bar', and if 'bar' is discovered as missing during unmarshalling, the message that comes with the ValidationEvent will say:
    uncompleted content model. expecting: <bar>
    I don't see a way to find out exactly where in the entire XML file that 'bar' is supposed to occure. How do I find out that the 'bar' element is expected to be under 'foo' element?
    Using the Eclipse debugger, I can see that the parent 'foo' is referenced somewhere deep within the JAXB impl classes, but I don't see any public methods that will allow me to get it.
    Any ideas?
    Thanks,
    AJ

    Try 'ValidationEventLocation.getObject()', and see if you can narrow it down from there.
    I'm also looking for a better solution, since I have a case where a child element is violating it's pattern restrictions, but all I get is a reference to the parent, with no apparent indication as to which child is at fault.

  • Problem with JAXB Unmarshall - javax.xml.bind.UnmarshalException

    Hi,
    I'm getting an expection while unmarshalling using JAXB. The error is as follows :
    DefaultValidationEventHandler: [ERROR]: unexpected element (uri:"http://www.etrade.com/ee/systemdomainao/search", local:"Context_Id"). Expected elements are <{}contextId>,<{}predicateInterceptor>,<{}isDefaultsearch>,<{}implicitContextSQL>,<{}contextName>,<{}searchId>,<{}implicitContextText>
    I've generated JAXB classes using xjc command from my schema. The root element is Search object which has a List of Searchcontext and Columlist object. When I'm trying to unmarshall the XML, I'm getting the above exception. What is baffling, if I comment out the <tns:SearchContext> entry from the XML, unmarshall doesn't throw any exception and populates the columnlist properly. Columnlist and Searchcontext have little difference except that columnlist contains more elements.
    Here'e the unmarshall code,
    URL metadataURL = this.getClass().getClassLoader().getResource("metadata/search/PARTICIPANT.xml");
    JAXBContext jc = JAXBContext.newInstance("com.etrade.ee.systemdomainao.search.domain");
    Unmarshaller unmarshaller = jc.createUnmarshaller();
    unmarshaller.setEventHandler(new javax.xml.bind.helpers.DefaultValidationEventHandler());
    Search search = (Search)unmarshaller.unmarshal(metadataURL);
    Any pointers will be highly appreciated.
    Thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    XSD :
    XSD :
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.etrade.com/ee/systemdomainao/search" targetNamespace="http://www.etrade.com/ee/systemdomainao/search" elementFormDefault="qualified" attributeFormDefault="unqualified">
         <!-- Searchcontext type definition -->
         <xs:complexType name="Searchcontext">
              <xs:sequence>
                   <xs:element name="Context_Id" type="xs:int"/>
                   <xs:element name="Search_Id" type="xs:string"/>
                   <xs:element name="Context_Name" type="xs:string"/>
                   <xs:element name="Implicit_Context_SQL" nillable="true">
                        <xs:simpleType>
                             <xs:restriction base="xs:string">
                                  <xs:maxLength value="500"/>
                             </xs:restriction>
                        </xs:simpleType>
                   </xs:element>
                   <xs:element name="Implicit_Context_Text" nillable="true">
                        <xs:simpleType>
                             <xs:restriction base="xs:string">
                                  <xs:maxLength value="500"/>
                             </xs:restriction>
                        </xs:simpleType>
                   </xs:element>
                   <xs:element name="Is_Defaultsearch" type="xs:boolean" nillable="true"/>
                   <xs:element name="Predicate_Interceptor" type="xs:string" nillable="true"/>
              </xs:sequence>
         </xs:complexType>
         <!-- Searchlist type definition -->
         <xs:complexType name="Columnlist">
              <xs:sequence>
                   <xs:element name="Columnlist_Id" type="xs:int"/>
                   <xs:element name="Search_Id" type="xs:string"/>
                   <xs:element name="Is_Quicksearchable" type="xs:boolean" nillable="true"/>
                   <xs:element name="Is_Advancesearchable" type="xs:boolean" nillable="true"/>
                   <xs:element name="Is_Quicksearchview" type="xs:boolean" nillable="true"/>
                   <xs:element name="Is_Fullview" type="xs:boolean" nillable="true"/>
                   <xs:element name="Is_Sortable" type="xs:boolean" nillable="true"/>
                   <xs:element name="Is_Defaultsort" type="xs:boolean" nillable="true"/>
                   <xs:element name="Default_SortOrder" type="xs:string" nillable="true" minOccurs="0"/>
                   <xs:element name="Display_Order" type="xs:int" nillable="true"/>               
                   <xs:element name="Default_Value" type="xs:string" nillable="true" maxOccurs="6"/>
                   <xs:element name="Default_Operator" type="xs:string" nillable="true"/>
                   <xs:element name="Is_Closedset" type="xs:boolean"/>
                   <xs:element name="Closedset_List_Name" type="xs:string" nillable="true"/>
                   <xs:element name="Is_RelatedMenu" type="xs:boolean" minOccurs="0"/>
                   <xs:element name="Column_Name" type="xs:string"/>
                   <xs:element name="Display_Name" type="xs:string"/>
                   <xs:element name="Is_UDF" type="xs:boolean" nillable="true"/>
                   <xs:element name="Table_Name" type="xs:string"/>
                   <xs:element name="Data_Type" type="xs:string"/>
                   <xs:element name="Column_Size" type="xs:int"/>
              </xs:sequence>
         </xs:complexType>
         <!-- Search declaration -->
         <xs:element name="Search">
              <!--<choice>
         <xs:interface name="java.io.Serializable" />
         </choice>-->
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="Search_Id" type="xs:string"/>
                        <xs:element name="Schema_Set">
                             <xs:simpleType>
                                  <xs:restriction base="xs:string">
                                       <xs:maxLength value="20"/>
                                       <xs:minLength value="1"/>
                                  </xs:restriction>
                             </xs:simpleType>
                        </xs:element>
                        <xs:element name="SearchContext" type="tns:Searchcontext" maxOccurs="unbounded"/>
                        <xs:element name="ColumnList" type="tns:Columnlist" maxOccurs="unbounded"/>
                   </xs:sequence>
              </xs:complexType>
              <xs:key name="Search_PrimaryKey_1">
                   <xs:selector xpath="."/>
                   <xs:field xpath="tns:Search_Id"/>
              </xs:key>
              <xs:keyref name="Searchcontext_ForeignKey_1" refer="tns:Search_PrimaryKey_1">
                   <xs:selector xpath=".//tns:SearchContext"/>
                   <xs:field xpath="tns:Search_Id"/>
              </xs:keyref>
              <xs:keyref name="Columnlist_ForeignKey_2" refer="tns:Search_PrimaryKey_1">
                   <xs:selector xpath=".//tns:ColumnList"/>
                   <xs:field xpath="tns:Search_Id"/>
              </xs:keyref>
              <xs:key name="Searchcontext_PrimaryKey_1">
                   <xs:selector xpath=".//tns:SearchContext"/>
                   <xs:field xpath="tns:Context_Id"/>
              </xs:key>
              <xs:key name="Columnlist_PrimaryKey_1">
                   <xs:selector xpath=".//tns:ColumnList"/>
                   <xs:field xpath="tns:Columnlist_Id"/>
              </xs:key>
         </xs:element>
    </xs:schema>

  • JAXB unmarshalling problem

    Hi
    I have a problem with unmarshalling.
    when my XML document is valide ,there is no probem but when the document is not valid(for exemple i put a String value in an element of type xs:decimal) i get a strange result:I thought that i will get a java.lang.NumberFormatException when i set the java attribute mapped with that element or i get the error value but this attribute get null as value and there is no NumberFormatException.

    riadhhwajdii wrote:
    Is there any way to modify this default behavior for jaxb to make it show the error value or get a java exceptionyes, see [this post|http://forums.sun.com/thread.jspa?messageID=11031834#11031834]
    Edited by: jtahlborn on Aug 8, 2010 10:01 AM

  • JAXB unmarshalling elements with xs:type explicitly set

    I am working with XML content where the XSD defines an element as being of a complexType (say "ParentType") but the content explicitly sets the element's xs:type attribute to an extension of that complexType (say "ChildType").
    As far as I can tell the XML is valid, but JAXB issues the following when unmarshalling:
    DefaultValidationEventHandler: [ERROR]: Unexpected element {}:child1
    javax.xml.bind.UnmarshalException: Unexpected element {}:child1
    Where <child1> is added via the extension.
    Is this a problem with JAXB or my XSD?
    (XSD and XML enclosed below)
    XSD ------------------
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:complexType name="ParentType">
    <xs:sequence>
    <xs:element name="parent1" type="xs:string"/>
    <xs:element name="parent2" type="xs:string"/>
    </xs:sequence>
    </xs:complexType>
    <xs:complexType name="ChildType">
    <xs:complexContent>
    <xs:extension base="ParentType">
    <xs:sequence>
    <xs:element name="child1" type="xs:string"/>
    </xs:sequence>
    </xs:extension>
    </xs:complexContent>
    </xs:complexType>
    <xs:element name="root">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="child" type="ParentType"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:schema>
    XML -----------------------
    <?xml version="1.0" encoding="UTF-8"?>
    <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="problem.xsd">
    <child xsi:type="ChildType">
    <parent1/>
    <parent2/>
    <child1/>
    </child>
    </root>

    JAXB doesn't handle OO schema design. I tried to do something similar where I defined a type called base and then defined that my document contained 1 or more base elements. Then I tried to unmarshall a document that contained elements that were of types extending from base. I ended up with the same issue.
    It seems that when the xjc compiler defines the classes it isn't smart enough to realize the element defined as parent could also contain a child element since child extends parent. Your XSD and XML are valid.
    I would think that JAXB should identify that because there is a type the extends the defined type, that an element of the sub-type might be subsituted i.e. check the actual type of the element in the XML before attempting to unmarshall it as the default type. It doesn't do that. I am not sure if this is as desinged, or a flaw in the implementation.

  • Jaxb unmarshalling and setvalidating()

    I am using jaxb 1.0 with jdk1.4 , i am trying to unmarshall the incoming request which a xml.
    It has a element called attachment list which is mandatory as per the schema. but i dont want my unmarshaller to validate request and throw error instead i just need to objects from unmarshaller. so i set the setvalidating(false).but i am still getting the validation error.Any help in this is highly appreciated.

    Check the date of the post dude - its months old and the dude who posted it hasn't been back since then (only one post, this one). If you want to help, focus on recent threads. Resurrecting old threads triggers other helpful people to unnecessarily invest time into them and creates extra work for the moderators.

  • JAXB Unmarshalling complexity

    Hello all,
    I need help on JAXB
    the situation is as below...
    i have to write a program that communicates with a server. the communication is request-response kind of communication which is to be carried out through XML.
    so everytime i have to send any request i need to create an XML and then send it to the server. i get the response in the form of XML. then i have to parse the XML to find out whats the response.
    previously i used DOM and SAX for creating XML and parsing XML respectively.
    now every response i get, i have to validate it against a DTD.
    now i'm trying out JAXB. so i first converted all the DTDs to XSD (xml schema docs). because JAXB doesn't support DTDs.
    now with JAXB, i'm creating the XML requests and sending it to the server and getting the response.
    but here is one problem.....
    as with JAXB, of i have to unmarshall the xml response i have to first create a JAXB context. and unmarshall it to that xml object that i'm expecting. but suppose i get some other response then how am i supposed to know that.
    i'll explain the above with a small example.
    suppose i have the following DTDs
    SearchRequest.dtd..............for search requests
    SearchResponse.dtd..............for search responses
    ErrorResponse.dtd.............for if the server sends any error.
    now first i convert this DTDs to XSDs and so i get
    SearchRequest.xsd, SearchResponse.xsd, ErrorResponse.xsd
    and then using the JAXB compiler i create the JAXB derived classes in the following package
    com.xyz.SearchRequest
    com.xyz.SearchResponse
    com.xyz.ErrorResponse
    now suppose i created the xml request and sent it to the server and i got the response. and i have to unmarshall it.
    (the server will send me SearchResponse.xml if everything if fine but ErrorResponse.xml it theres an error).
    now heres the problem. the server will send the SearchResponse or ErrorResponse. and ill have to determine what it is before i start to unmarshall.
    i hope i have communicated my problem....
    thankyou
    java-jones

    Not sure if this will help you or if this is what you are looking for, but from the JAXB Users' Guide:
    More About Unmarshalling
    The Unmarshaller class in the javax.xml.bind package provides the client application the ability to convert XML data into a tree of Java content objects. The unmarshal method for a schema (within a namespace) allows for any global XML element declared in the schema to be unmarshalled as the root of an instance document. The JAXBContext object allows the merging of global elements across a set of schemas (listed in the contextPath). Since each schema in the schema set can belong to distinct namespaces, the unification of schemas to an unmarshalling context should be namespace-independent. This means that a client application is able to unmarshal XML documents that are instances of any of the schemas listed in the contextPath; for example:
    JAXBContext jc = JAXBContext.newInstance( "com.acme.foo:com.acme.bar" );
    Unmarshaller u = jc.createUnmarshaller();
    FooObject fooObj = (FooObject)u.unmarshal( new File( "foo.xml" ) ); // ok
    BarObject barObj = (BarObject)u.unmarshal( new File( "bar.xml" ) ); // ok
    BazObject bazObj = (BazObject)u.unmarshal( new File( "baz.xml" ) ); // error

  • JAXB unmarshall problem - beginner

    Hi Im having real pain trying to get unmarshall to work with JAXB with a very simple set up..
    My DTD looks like
    <!ELEMENT CXMLRESULT (MESSAGE)>
    <!ELEMENT MESSAGE (#PCDATA)>
    and xjs like
    <xml-java-binding-schema version="1.0ea">
    <element name="CXMLRESULT" type="class" root="true">
    </xml-java-binding-schema>
    I create an object marshall it and output to a file.. All looks good. This results in the following in the file..
    <CXMLRESULT>
    <MESSAGE>hello</MESSAGE></CXMLRESULT>
    However when I try to read in that file and unmarshall it I run into problems.. Although I receive NO error during the unmarshall, when I do a toString() afterwards then it does not display the MESSAGE element, and similarly trying to validate the object says that MESSAGE hasn't been detected.. I cannot figure out why this is.. The file was written out by JAXB so how come it cant read it back in.. For my unmarshall I do ...
    CXMLRESULT cxmlresult=new CXMLRESULT();
    try{
    try{
    input=new File("/in.xml");
    fileInputStream=new FileInputStream(input);
    } catch (IOException e)
    { System.out.println("error with file"); }
    cxmlresult.unmarshal(fileInputStream);
    } catch(UnmarshalException e) {
    e.printStackTrace();
    System.out.println(cxmlresult.toString());
    Doing this just shows a CXMLRESULT and not the MESSAGE element..
    Any ideas ?
    Mark

    Try this:
    CXMLRESULT cxmlresult = CXMLRESULT.unmarshal(fileInputStream);Dave

  • Unmarshalling error when invoking a remote call in weblogic 9.1/jdk 1.5.

    Hi,
    We are trying to upgrade the weblogic from 7.1 to 9.1. I am getting the following error "java.lang.ClassNotFoundException: Failed to load class <b>void</b> ", when a remote method whose return type is void is invoked. Also I am using jdk 1.5.0_04. Any hints on what might be wrong here is appreciated. I have attached the stack trace below.
    thanks
    Sridhar Sidda
    ;;---------Stack Trace ----------------------------
    Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: java.lang.ClassNotFoundException: Failed to load class void at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:191) at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:176) at com.sabre.fltsked.util.security.ScheduleSecurityValidator3_910_WLStub.hasPermision(Unknown Source) at com.sabre.fltsked.util.security.FSSecurityInterceptor.invoke(FSSecurityInterceptor.java:48) ... 5 more Caused by: java.lang.ClassNotFoundException: Failed to load class void at weblogic.rmi.utils.WLRMIClassLoaderDelegate.loadClass(WLRMIClassLoaderDelegate.java:203) at weblogic.rmi.utils.WLRMIClassLoaderDelegate.loadClass(WLRMIClassLoaderDelegate.java:128) at weblogic.rmi.utils.Utilities.loadClass(Utilities.java:308) at weblogic.rmi.utils.Utilities.loadClass(Utilities.java:344) at weblogic.rjvm.MsgAbbrevInputStream.resolveClass(MsgAbbrevInputStream.java:395) at weblogic.utils.io.ChunkedObjectInputStream$NestedObjectInputStream.resolveClass(ChunkedObjectInputStream.java:255) at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1538) at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460) at java.io.ObjectInputStream.readClass(ObjectInputStream.java:1427) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1282) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339) at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:195) at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:555) at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:191) at com.sabre.fltsked.util.security.ScheduleSecurityValidator3_WLSkel.invoke(Unknown Source) at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:517) at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:407) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147) at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:403) at weblogic.rmi.internal.BasicServerRef.access$300(BasicServerRef.java:56) at weblogic.rmi.internal.BasicServerRef$BasicExecuteRequest.run(BasicServerRef.java:934) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207) at weblogic.work.ExecuteThread.run(ExecuteThread.java:179)<pre></pre>

    hi,
    I am also getting the same exception when making call to the server.
    If u get the solution for this problem.can u please tell me why this is happening.
    Thanks.

  • Unmarshalling error.........................plzzzzzzzzzz check it..........

    hi ..............
    plz help......... i am geting this kind of error................. i am doing client server connection using rmi..........................
    unmarshalling return: nested exception is:
    java.net.socket.exception: connection reset......................
    can u tel me whts error............. do i need set security...................

    actually i hve followed all procedures of rmi...................................
    but i am not getting reply from the server.......................
    thr is problem in unmarshalling in client side.............
    can u tel me wht may b the problem.....................
    my server runs on linux i hve jdk1.5.0_09..........
    my clint haz jdk1.5.0_08................
    i dont hve any firewall installed.......................

  • JAXB: Encoding error (Malformed UTF-8, trying to set ISO)

    Hi, I get this error when doing a Unmarshaller.unmarshal( anURL );
    DefaultValidationEventHandler: [WARNING]: Declared encoding "ISO-8859-1" does not match actual one "UTF-8"; this might not be an error.
    DefaultValidationEventHandler: [FATAL_ERROR]: Character conversion error: "Malformed UTF-8 char -- is an XML encoding declaration missing?" (line number may be too low).
    org.xml.sax.SAXParseException: Character conversion error: "Malformed UTF-8 char -- is an XML encoding declaration missing?" (line number may be too low).
         at org.apache.crimson.parser.InputEntity.fatal(InputEntity.java:1100)
    (...) etc..So far, I set the ISO-8859-1 encoding 4 places;
    1. the xml response from the servlet: xml.append("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n\n")
    2. the original XSD which the JAXB classes was generated from
    3. In the client, after recieving the string containing the XML: bytes b[] = xmlString.getBytes("ISO-8859-1");
    4. In the client; when posting to the server: httpConn.setRequestProperty("Content-Type","text/xml;charset=ISO-8859-1");
    Yet, JAXB still thinks I'm doing UTF-8 here! Did I forget something?
    thanks,
    bjorn

    bump .. no one knows why this happens?

  • JAXB compiler error : Complex Type Definition Representation Error

    Hi,
    I have a problem when I try to generate Java classes for the XML Digital Signature schema along with the XAdES extension. Apparently, we got an XML validation issue when the XAdES schema is parsed.
    Here is the xjc tool ouput :
    [ERROR] src-ct.1: Complex Type Definition Representation Error for type 'IdentifierType'.  When complexContent is used, the base type must be a complexType.
      line 33 of XAdES.xsd
    [ERROR] src-ct.1: Complex Type Definition Representation Error for type 'EncapsulatedPKIDataType'.  When complexContent is used, the base type must be a complexType.
      line 57 of XAdES.xsdNow these are the schema lines from XAdES.xsd that cause the problem :
    <xsd:complexType name="IdentifierType">
      <xsd:complexContent>
        <xsd:extension base="xsd:anyURI">
          <xsd:attribute name="Qualifier" type="QualifierType" use="optional"/>
        </xsd:extension>
      </xsd:complexContent>
    </xsd:complexType>
    <xsd:complexType name="EncapsulatedPKIDataType">
      <xsd:complexContent>
        <xsd:extension base="xsd:base64Binary">
          <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
        </xsd:extension>
      </xsd:complexContent>
    </xsd:complexType>The most disturbing thing is that those two schemas I used (e.g. xmldsig-core-schema.xsd and XAdES.xsd) come directly from the W3C, so they should be fully compliant to the XML schema spec, shouldn't they ?
    Moreover, I tried to validate these two schemas with XML Spy 4.3 and the problem occurs in slightly different way. In fact, the <xsd:complexContent> tags are replaced silently by XML Spy with <xsd:simpleContent> tags in order to validate the schema. So XML Spy seems to have a problem too with these complex type definitions. Besides, if I replace the <xsd:complexContent> tags the same way as XML Spy does, and if I run again the JAXB compiler, it works fine...
    Does anyone have any knowledge about this issue ? I'd like very much to hear about anyone who has experienced or better solved the same kind of issue.
    By the way, here is the version of JAXB that I use :
    xjc version "1.0.2-b15-fcs"
    JavaTM Architecture for XML Binding(JAXB) Reference Implementation, (build 1.0.2-b15-fcs)Any help appreciated.
    Thanks,
    Gregory

    <xsd:extension base="xsd:anyURI">
    <xsd:extension base="xsd:base64Binary">
    The base attribute of the xs:extension elements shoule refer to a complexType.
    For example,
    <xs:complexType name="complexTypeA">
    </xs:complexType>
    <xsd:complexType name="IdentifierType">
    <xsd:complexContent>
    <xsd:extension base="complexTypeA">
    <xsd:attribute name="Qualifier" type="QualifierType" use="optional"/>
    </xsd:extension>
    </xsd:complexContent>
    </xsd:complexType>

  • JAXB unmarshalling date

    I have used JAXB to marshall a java class for a date information. The resulting XML data looks fine. It contains the date I want. However, once I'm trying to unmarshall the XML file using JAXB I cannot retrieve the date back.
    For example, my object contain a startTime field that is java.util.Calendar.
    if I'm doing..... object.getStartTime() I would get null in return?
    Does anyone encounter this problem before? Or anyone know a solution to this? Any pointer would be highly appreciated.

    To give you more information.....
    i have debugged more into this.
    My code is able to retrieve the date string back from the XML data which is:
    2006-02-01-08:00
    This string is in a variable "lexval"
    However, this following statement return null value:
    oracle.xml.jaxb.JaxbDatatypeConverter.parseDate(lexval)
    Anybody has any idea on this issue? does parseDate method has any restriction?
    --Thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for