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

Similar Messages

  • 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

  • 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ł

  • 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ł

  • 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>

  • Help: problems with JAXB unmarshalling

    Hi all,
    I've got a DOM Document object, which I wish to unmarshall. It all works great, but I wish to do some better validation handling, and this is where I see something weird: whenever a ValidationEvent comes into my custom ValidationEventHandler, it practically contains no info on the location of the event. This is the typical content of event.getLocator():
    columnNumber = -1
    lineNumber = -1
    node = null
    object = null
    offset = -1
    url = null
    This is the code:
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = factory.newDocumentBuilder();
        InputStream is = new FileInputStream("d:/temp/file1.xml");
        Document doc = builder.parse(is);
        is.close();
        JAXBContext jaxbContext = JAXBContext
                  .newInstance("com.company.xml");
        Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
        unmarshaller.setEventHandler(new MyValidator(unmarshaller
                  .getEventHandler()));
        Object result = unmarshaller.unmarshal(doc.getDocumentElement());thanks

    Found a solution. I added:
    unmarshaller.setValidating(true);
    I also had to make sure that the xml file did not contain schema info (i.e. shcemaLocation, etc), otherwise, I get a NullPointerException - I don't yet know why, but it's good enough for me at the moment :-)
    Now, the ValidationEventLocator contains a ref to the Node in my DOM.

  • 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 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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • 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 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.

  • JAXB compiler problem in handling xsd:any and nillble = "true"

    Dear all,
    i am using jdeveloper 10.1.3.1 production release version.
    i am designing a xml schema that contain element of attribute nillable="true", for extensible, contain tag <xsd:any>.
    but i encounter 2 problem:
    1. for xml schema element with attribute nillable="true", no corresponding isNil(), setNil
    method is generated (refer to jaxb 1.0 spec. 5.7.1)
    2. cannot handle tag <xs:any> that generate incorrect java source code (cannot compile) [refer to jaxb 1.0 spec 5.9.5)
    *** i have add jaxb customization tag inside the <xs:any> tag
    ***   <xs:annotation><xs:appinfo>
    ***               <jaxb:property name="Extension"/>
    ***</xs:appinfo></xs:annotation>
    Does oracle's JAXB implementation conform to the JAXB 1.0 spec?
    Is it a known bug?
    Could anybody help me?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Refer to section
    E.2 Not Required XML Schema
    concepts
    "A JAXB implementation is not required to support the following XML Schema
    concepts for this version of the specification. A JAXB implementation may
    choose to support these features in an implementation dependent manner."
    E.2.2 Not supported while manipulating the XML
    content
    Schema component: wildcard
    (any)
    how can i know if an xml element with xsi:nil="true" (unmarshal)
    and set xsi:nil="true" for an element (marshal) ?
    According to the JAXB 1.0 specification:
    If {nillable} is "true", the methods setNil() and isNil() are
    generated.

  • Unmarshalling problem with special characters (Trademark, French

    I'm using a DefaultHandler class to create a StringBuffer which contains a single (though very complex) element from an XML file. I am unmarshalling this StringBuffer object to a JAXBContext like this:
    u.unmarshal( new StreamSource( new StringReader( sb.toString() ) )
    My special characters are going way out of whack (please read (TM) as the Trademark symbol)
    T-Force(TM) Ring(TM) Bonded iron construction for durability and longer life
    becomes
    T-Force���Ring ��� Bonded iron construction for durability and longer life
    Before I put anything else into the StringBuffer I put this in:
    sb.append("<?xml version=\"1.0\" encoding=\"iso-8859-15\"?>");
    But I've tried:
    sb.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
    and
    sb.append("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>");
    with different, but wrong, results.
    It's true that I'm viewing these results on a web page, so it's possible that the problem is occurring on the back end once I persist the data, but it looks like my database is set for UTF-8 (that's what I put for this new installation of Oracle 9i R2).
    Is there something basic I am missing. Like, perhaps, I need to do some sort of XML entity coding?
    Thank you very much for any help you can offer.

    Actually I had forgotten one additional thing. I have
    tried testing one thing at a time, and I have sent the
    special characters to the log file with logger.debug
    statements (log4j). The characters are screwed up in
    the log files, which is what makes me think I need to
    do some sort of entity encoding. (?)I don't think that log4j provides any way to declare the encoding it uses for your files. My guess is that it's using the default encoding for your system, which could be a problem for things like the trademark character. So log4j really gives you just another thing to test, rather than acting as a testing tool.
    I was thinking of a more low-level test, where you take your trademark character, which is 2022 or some such number (check the Unicode charts) and you write it to the database and read it back. Do you get the same character back? That sort of testing.

  • JAXB (XJC) problem with Java 1.4.2_02

    Hi,
    I am trying to migrate our system to Java version 1.4.2_02 (currently using 1.4.1_02). We use XJC from JAXB to compile XML schema files into java classes. JAXB is packaged in JWSDP (we are using version 1.3). I am currently experiencing a problem whereby if I use java version 1.4.2_02 and run XJC on the xml schema file its not generating any of the inner classes. All classes including inner are generated properly if I am pointing 1.4.1_02.
    Just wondering if you came across this problem before and would know of a possible solution.
    thanks for your help
    Manish

    I was having this problem as well. I extracted the MSI from the InstallShield and found that it's looking for a property called "SystemFilesLocked" to equal 1. If you pass it as a parameter and give it a value of 0, this error message doesn't appear. I've installed now to 15 W2K desktops without any issues.
    The 'silent installation' documentation for this product is sorely lacking. The install string I'm using is below:
    j2re-1_4_2_03-windows-i586-p.exe /S /v/qn"ADDLOCAL=jrecore SYSTEMFILESLOCKED=0 CONTROLPANELLOCKED=1 SKDSILENT=1 IEXPLORER=0 SYSTRAY=0 REBOOT=Suppress JAVAUPDATE=0 JAVAJAVAWLOCKED=0 WEBSTARTICON=0 /L C:\TEMP\LogFiles\JRE_JWS_142_03.log"
    Hope this helps...

  • 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: how to ignore unknown elements?

    Hi,
    I use jaxb 1.1 for communication with an external partner. (Took schema, compiled it, used generated classes for unmarshalling like this:
    Document doc = /* some document building */
    JAXBContext jaxbContext = JAXBContext.newInstance(MyConstants.JAXB_PACKAGE);
    Unmarshaller unMarshaller = jaxbContext.createUnmarshaller();
    myObject = (MyObject) unMarshaller.unmarshal(doc);) Everything worked fine until they decided to add new elements to their xml-Document without notifiing me (nothing very unusual I think...). Now I get a javax.xml.bind.UnmarshallingException with Message "Unexpected Element". Is there any way to ignore such elements and just take the known Elements from the xml-stream?
    Thanks in advance
    Thomas

    Update your schema with the following after you known elements.
    <xs:any namespace="##any" processContents="skip" minOccurs="0" maxOccurs="unbounded">
    <xs:annotation>
    <xs:documentation>An extension point for arbitrary xml value fragments</xs:documentation>
    </xs:annotation>
    </xs:any>
    Hunter

Maybe you are looking for

  • Is there a way to automate an indesign catalogue so that it populates fields from excel?

    A client has seen a competitor present a catalogue and shows how from an excel or database file this indesign template can be populated with text and with images from a filename listed in the the excel.  Does anyone know how to do this or can you sug

  • Prompt error message difference is too large

    Need help, how to clear vendor open item in foreign currency. When we try to clear vendor open item using T-code F-44 the error message display prompt error message difference is too large.

  • Screen blank at startup

    I was watching 4OD this afternoon, and I paused the video to use the bathroom. I was away from my screen for less than 5 minutes and I came back to find that my keyboard and trackpad were unresponsive. I've had this problem before so I did what I nor

  • T.code MIGO: how to valorize the filed BUSINESS AREA?

    Hi All, in a document created by MIGO, I can see valirized the field BSUSINESS AREA. Could anyone when (by which t.code) this field has been filled in? Thanks

  • How to run test cases in a jar file using junit?

    Hi, I want to run test cases in a jar file using junit and the jar file is not in the class path. I wrote the following code, but it does not work. import java.net.URL; import java.net.URLClassLoader; import junit.framework.TestResult; import junit.t