users@jaxb.java.net

FW: JAXB problem. ( PLEASE HELP , URGENT ).

From: Tim Davidson <tim.davidson_at_greenhatconsulting.com>
Date: Fri, 09 May 2003 11:08:47 +0100

 Can anyone help us with this ?

> -----Original Message-----
> From: Gustavo Cebrian
> Sent: Friday, May 09, 2003 11:07 AM
> To: Tim Davidson
> Subject: JAXB problem. ( PLEASE HELP , URGENT ).
>
>
> I have got a class generated from an xsd. See attached file. ( RegisterCustomerAccount.xsd )
>
> This is the xml file generated from the java class. ( After marshalling )
>
> //======================================================
>
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <ns1:RegisterCustomerAccountN xmlns:ns1="crisp-registerCustomerAccount">
> <sessionID></sessionID>
> <userID></userID>
> <stateTransitionRequest>10</stateTransitionRequest>
> <state></state>
> <logon>
> <userID>4</userID>
> <passCode></passCode>
> <reminder></reminder>
> <invalidLogonCount>0</invalidLogonCount>
> <maxInvalidLogon>0</maxInvalidLogon>
> </logon>
> <customer>
> <customerID></customerID>
> <title></title>
> <firstName></firstName>
> <lastName></lastName>
> <middleInitialOrName></middleInitialOrName>
> <dateOfBirth>2003-05-09+00:00</dateOfBirth>
> <daytimePhoneNumber></daytimePhoneNumber>
> <eveningPhoneNumber></eveningPhoneNumber>
> <mobilePhoneNumber></mobilePhoneNumber>
> <emailAddress></emailAddress>
> <currentAddress>
> <houseNumberOrName></houseNumberOrName>
> <streetName></streetName>
> <minorPostalArea></minorPostalArea>
> <mainPostalArea></mainPostalArea>
> <county></county>
> <postcode></postcode>
> <country></country>
> <residenceStartDate>2003-05-09+00:00</residenceStartDate>
> <matched>true</matched>
> </currentAddress>
> <previousAddress>
> <houseNumberOrName></houseNumberOrName>
> <streetName></streetName>
> <minorPostalArea></minorPostalArea>
> <mainPostalArea></mainPostalArea>
> <county></county>
> <postcode></postcode>
> <country></country>
> <residenceStartDate>2003-05-09+00:00</residenceStartDate>
> <matched>true</matched>
> </previousAddress>
> </customer>
> </ns1:RegisterCustomerAccountN>
>
> //=============================================================================
>
> Another tool, which does not use JAXB, generates the same file with slight differences.
>
> The file is this one:
>
> //==================================================================
>
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <RegisterCustomerAccountN xmlns = "crisp-registerCustomerAccount" xmlns:ns1 = "c
> risp-crispProcess" xmlns:ns2 = "crisp-logon" xmlns:ns3 = "crisp-customer" xmlns:
> ns4 = "crisp-address" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance">
> <ns1:sessionID>6694</ns1:sessionID>
> <ns1:userID></ns1:userID>
> <ns1:stateTransitionRequest>10</ns1:stateTransitionRequest>
> <ns1:state>10</ns1:state>
> <logon>
> <ns2:userID>4</ns2:userID>
> <ns2:passCode></ns2:passCode>
> <ns2:reminder></ns2:reminder>
> </logon>
> <customer>
> <ns3:firstName></ns3:firstName>
> <ns3:lastName></ns3:lastName>
> <ns3:middleInitialOrName></ns3:middleInitialOrName>
> <ns3:dateOfBirth>2003-05-09+00:00</ns3:dateOfBirth>
> <ns3:daytimePhoneNumber></ns3:daytimePhoneNumber>
> <ns3:eveningPhoneNumber></ns3:eveningPhoneNumber>
> <ns3:emailAddress></ns3:emailAddress>
> <ns3:currentAddress>
> <ns4:houseNumberOrName></ns4:houseNumberOrName>
> <ns4:streetName></ns4:streetName>
> <ns4:minorPostalArea></ns4:minorPostalArea>
> <ns4:mainPostalArea></ns4:mainPostalArea>
> <ns4:county></ns4:county>
> <ns4:postcode></ns4:postcode>
> <ns4:matched></ns4:matched>
> </ns3:currentAddress>
> </customer>
> </RegisterCustomerAccountN>
> //===============================================================
>
> I get an error when trying to unmarshal this file
>
> DefaultValidationEventHandler: [ERROR]: Unexpected element {crisp-crispProcess}:
> sessionID
> javax.xml.bind.UnmarshalException: Unexpected element > {crisp-crispProcess}:sessi
> onID
> at com.sun.xml.bind.unmarshaller.UnreportedException.createUnmarshalExce
> ption(UnreportedException.java:58)
> at com.sun.xml.bind.unmarshaller.SAXUnmarshallerHandlerImpl.reportAndThr
> ow(SAXUnmarshallerHandlerImpl.java:498)
> at com.sun.xml.bind.unmarshaller.SAXUnmarshallerHandlerImpl.startElement
> (SAXUnmarshallerHandlerImpl.java:112)
> at org.apache.xerces.parsers.AbstractSAXParser.startElement(AbstractSAXP
> arser.java:454)
> at org.apache.xerces.impl.XMLNamespaceBinder.handleStartElement(XMLNames
> paceBinder.java:876)
> at org.apache.xerces.impl.XMLNamespaceBinder.startElement(XMLNamespaceBi
> nder.java:568)
> at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidat
> or.java:756)
> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElemen
>
>
> I GUESS, THIS IS BECAUSE THE FILE IS SLIGHTLY DIFFERENT.
>
> I do not know what I can do, because I do not know how to control the display of this file.
> If the second file had the same structure as the first one, it would be possible to unmarshal.
> ( I have already tried this ). As you can see the difference is the name spaces. For some reason
> the generated file from the other integration tool specifies the name space for every single element.
>
> > <<RegisterCustomerAccount.xsd>> Gustavo.
>
>
>
>
>
> ***********************************************
> Gustavo Cebrian
> Analyst/Programmer
>
> Want to improve the ROI on your EAI project?
> Download RV Tester and reduce your development
> and testing timescales by as much as 50%.
> http://www.greenhatconsulting.com/rvtester
>
> Green Hat Consulting Ltd.
> 107 Fleet Street, London EC4A 2AB
> DDI +44 (0)20 7936 9495
> Mobile +44 (0)7788 922291
> http://www.greenhatconsulting.com
> gustavo.cebrian_at_greenhatconsulting.com
> ***********************************************
>
>
>