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

Similar Messages

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

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

  • 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

  • Need Debugging Help, Please

    Hi, I am going to bother you after my fruitless attempts to debug the code shown below. The message is "NoSuchMethodError: value" and I am very confused by the message.
    The message on the console is:
    Exception in thread "Main Thread" java.lang.NoSuchMethodError: value
         at com.sun.xml.bind.v2.model.impl.ClassInfoImpl.getAccessType(ClassInfoImpl.java:339)
         at com.sun.xml.bind.v2.model.impl.ClassInfoImpl.getProperties(ClassInfoImpl.java:228)
         at com.sun.xml.bind.v2.model.impl.RuntimeClassInfoImpl.getProperties(RuntimeClassInfoImpl.java:87)
         at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:127)
         at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:49)
         at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:41)
         at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:189)
         at com.sun.xml.bind.v2.model.impl.RegistryInfoImpl.<init>(RegistryInfoImpl.java:51)
         at com.sun.xml.bind.v2.model.impl.ModelBuilder.addRegistry(ModelBuilder.java:232)
         at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:201)
         at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:327)
         at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:198)
         at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:76)
         at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:55)
         at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:124)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:133)
         at javax.xml.bind.ContextFinder.find(ContextFinder.java:286)
         at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:372)
         at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:337)
         at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:244)
         at com.register.jaxb.JAXBUnMarshaller.unMarshall(JAXBUnMarshaller.java:18)
         at com.register.jaxb.JAXBUnMarshaller.main(JAXBUnMarshaller.java:64)
    and the source code is shown below:
    package com.register.jaxb;
    import generated.*;
    import javax.xml.bind.*;
    import javax.xml.validation.SchemaFactory;
    import javax.xml.validation.Schema;
    import org.xml.sax.SAXException;
    import java.io.*;
    import java.util.List;
    public class JAXBUnMarshaller {
         public void unMarshall(File xmlDocument) {
              try {
                   JAXBContext jaxbContext = JAXBContext.newInstance("generated");
                   Unmarshaller unMarshaller = jaxbContext.createUnmarshaller(); // this line is java:18
                   SchemaFactory schemaFactory = SchemaFactory
                             .newInstance("http://www.w3.org/2001/XMLSchema");
                   Schema schema = schemaFactory.newSchema(new File(
                             "gen_source/catalog.xsd"));
                   unMarshaller.setSchema(schema);
                   CustomValidationEventHandler validationEventHandler = new CustomValidationEventHandler();
                   unMarshaller.setEventHandler(validationEventHandler);
                   JAXBElement<CatalogType> catalogElement = (JAXBElement<CatalogType>) unMarshaller
                             .unmarshal(xmlDocument);
                   CatalogType catalog = catalogElement.getValue();
                   System.out.println("Journal Title: " + catalog.getJournalTitle());
                   System.out.println("Publisher: " + catalog.getPublisher());
                   List<JournalType> journalList = catalog.getJournal();
                   for (int i = 0; i < journalList.size(); i++) {
                        JournalType journal = (JournalType) journalList.get(i);
                        List<ArticleType> articleList = journal.getArticle();
                        for (int j = 0; j < articleList.size(); j++) {
                             ArticleType article = (ArticleType) articleList.get(j);
                             System.out.println("Article Edition: "
                                       + article.getEdition());
                             System.out.println("Title: " + article.getTitle());
                             System.out.println("Author: " + article.getAuthor());
              } catch (JAXBException e) {
                   System.out.println(e.toString());
              } catch (SAXException e) {
                   System.out.println(e.toString());
         public static void main(String[] argv) {
              File xmlDocument = new File("catalog.xml");
              JAXBUnMarshaller jaxbUnmarshaller = new JAXBUnMarshaller();
              jaxbUnmarshaller.unMarshall(xmlDocument);
         } // this line is java:64
         class CustomValidationEventHandler implements ValidationEventHandler {
              public boolean handleEvent(ValidationEvent event) {
                   if (event.getSeverity() == ValidationEvent.WARNING) {
                        return true;
                   if ((event.getSeverity() == ValidationEvent.ERROR)
                             || (event.getSeverity() == ValidationEvent.FATAL_ERROR)) {
                        System.out.println("Validation Error:" + event.getMessage());
                        ValidationEventLocator locator = event.getLocator();
                        System.out.println("at line number:" + locator.getLineNumber());
                        System.out.println("Unmarshalling Terminated");
                        return false;
                   return true;
    }

    user537770 wrote:
    Hi, I am going to bother you after my fruitless attempts to debug the code shown below. The message is "NoSuchMethodError: value" and I am very confused by the message. When you post code, please put it in code tags (you can find an example on the FAQ page, or in the welcome pages at the top of the thread).
    As for your problem, I'm way out of my comfort zone here, but the source code for ClassInfoImpl would suggest that the 'value' method is being invoked on an annotation called 'XmlAccessorType'; and since annotations only came in with version 5, I'm wondering if you have some sort of jar/jdk/jvm incompatibility. You might want to check that all of these are in sync.
    Winston

  • Toplink JAXB - ClassCastException after redeploy in OC4J

    Hi,
    I'm experiencing an issue casting an unmarshalled object after the application is being redeployed in the container.
    I'm trying to unmarshall an xml that I retrieve as a resource from the classloader (the xml is also in the jar)
    The ClassCastException is being thrown at the point where I try to cast the unmarshalled object. A sysout on the unmarshalled object prints a classtype that I expect, so my first impression is that the cast fails due the ClassLoader used by the JAXBContext (?) So I've tried to create the JAXBContext with the ClassLoader parameter using the class' classloader directly and the contextClassLoader, both unsuccessfull.
    The problem solves after I restart the OC4J container, but for convenience, I would like to solve this without having to restart, if possible.
    Has anyone experienced this problem, or know a solution?
    Thx!
    Bert
    Below, some example code and the console output on the server.
    Code:
    /* create the jaxb context */
    JAXBContext context = JAXBContext.newInstance(
              "be.cm.apps.tpb.common.helper",
         Thread.currentThread().getContextClassLoader());
    if (LOGGER.isDebugEnabled()) {
         LOGGER.debug("JAXBContext=" + context);
    /* create unmarshaller */
    Unmarshaller unmarshaller = context.createUnmarshaller();
    if (LOGGER.isDebugEnabled()) {
         LOGGER.debug("Unmarshaller=" + unmarshaller);
    /* open refac-config.xml as inputstream */
    URL url = Thread.currentThread().getContextClassLoader().getResource(CONFIGURATION);
    if (LOGGER.isDebugEnabled()) {
         LOGGER.debug("url: " + url);
    /* unmarshall the configuration */
    Object unmarshalledObject = unmarshaller.unmarshal(url);
    if (LOGGER.isDebugEnabled()) {
         LOGGER.debug("unmarshalled object: " + unmarshalledObject);
    * THROWS CLASSCASTEXCEPTION AFTER REDEPLOY
    configurationDefinition = (ConfigurationDefinition) unmarshalledObject;
    if (LOGGER.isDebugEnabled()) {
         LOGGER.debug("<- initialize()");
    Output:
    |DEBUG|JAXBContext=oracle.toplink.ox.jaxb.JAXBContext@675f26|º@#
    |DEBUG|Unmarshaller=oracle.toplink.ox.jaxb.JAXBUnmarshaller@97dadf|º@#
    |DEBUG|url: code-source:/C:/java/101310/j2ee/home/applications/tpb/tpb-online-1.0.0.jar!/refac-config.xml|º@#
    |DEBUG|unmarshalled object: be.cm.apps.tpb.common.helper.ConfigurationDefinition@8f310f|º@#
    |ERROR|Unable to create BusinessFacade instance named be.cm.apps.tpb.business.facade.SendingManager|
    Caused by: java.lang.ClassCastException: be.cm.apps.tpb.common.helper.ConfigurationDefinition
    at be.cm.apps.tpb.common.helper.ConfigHelper.initialize(ConfigHelper.java:93)
    ... 83 more

    Hello Bert,
    This is a known issue and there is a patch that is available from Oracle Support. When you contact support please indicate whether you are using TopLink 10.1.3 or 10.1.3.1. Also you can refer Oracle Support to me and I can help them find the correct patch.
    -Blaise

  • Namespace error with JAXB

    Hello everyone! This is my problem:
    I am using jaxb to unmarshall a xml file. When I unmarshall, the program doesn�t work at this point:
    JAXBContext jc = JAXBContext.newInstance("com.claynet.core.clom");
    Unmarshaller u = jc.createUnmarshaller();
    u.setValidating(true);
    Clom clom =
    (Clom)u.unmarshal(
    new FileInputStream( ".." + File.separatorChar +
    "webapps"+ File.separatorChar + "claybrary" + File.separatorChar
    + "objetosCLOM" + File.separatorChar + file_name.trim()) );
    The error I get is the following one:
    javax.xml.bind.UnmarshalException: Probably namespace URI of tag "clom" is wrong (correct one is "http://www.clayformacion.com/xsd/clomv1.0")
    - with linked exception:
    [com.sun.msv.verifier.ValidityViolation: Probably namespace URI of tag "clom" is wrong (correct one is "http://www.clayformacion.com/xsd/clomv1.0")]
    The problem seems to be a conflict with the namespace, but the schema has the namespace correctly set:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:clom="http://www.clayformacion.com/xsd/clomv1.0" xmlns="http://www.clayformacion.com/xsd/clomv1.0" targetNamespace="http://www.clayformacion.com/xsd/clomv1.0" elementFormDefault="qualified">
    The validation inside the unmarshalling crash.
    Is there any errors with the code? Can Anyone help me?
    Thanks

    Looks like error is clear namespace mismatch...try changing the following url in wsdl and regen the code
    http://example.ws found http://example.ws/xsd

  • Does unmarshall operation hold entire XML document in memory?

    Hi,
    When the unmarshall operation is done on a large XML file, does the root element Java object returned hold the entire XML document in memory? I have a large XML file that I want to unmarshall that contains many <product> elements for example. I want use up as less memory as possible. How would I achieve this?
    Thanks.

    Yes. I am going with Stax + JAXB to unmarshall. Stax so I could iterate over each element and then use JAXB to unmarshall an element at a time. But the solution is a bit involved. I wanted to do it with just JAXB and so I want to know if JAXB holds the entire content tree in memory if I unmarshall the root element.

  • JAXB : ClassCastException while using generated java objects

    Hi,
    I am using JAXB for unmarshalling my xml to set of java objects. It is working but when i use one child object and cast it i am getting ClassCastException.
    java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.ElementNSImpl cannot be cast to com.xyz.base.EmployeeType
    My XSD
    ======
    <xsd:complexType name="EmployeeType">
    </xsd:complexType>
    <xsd:complexType name="EmployeeList">
         <xsd:sequence>
              <xsd:element name="Employee" type="base:EmployeeType" maxOccurs="unbounded"/>
         </xsd:sequence>
    </xsd:complexType>
    JAXB Binding
    ==========
    In Binding i am direct schema compiler to use ArrayList for EmployeeList.. as i want to use this as ArrayList.
    <jxb:bindings node="//xs:complexType[@name='EmployeeList']">
              <jxb:class ref="java.util.ArrayList"/>
    </jxb:bindings>
    Everything works well but when i extract element from EmployeeList (i.e. ArrayList) and try to type cast it to EmployeeType, getting following exception:
    java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.ElementNSImpl cannot be cast to com.xyz.base.EmployeeType
    so at the time of unmarshalling how jaxb will know about the type of child element and use accordingly.
    Any help would be greatly appreciated.

    Hi,
    Could you try outputting the class type of the object you are trying to cast?
    Check the class of the object. Say use object.class.getName().
    I used jaxb quite a long time ago but I believe it resolves the classes correctly.

  • Validation in JAXB

    Hi Friends,
    We get a response from a third party server in the form of XML document. We have a schema for the XML and but we are not sure the responce we get is valid againist the scehma.
    But we are planning to use JAXB for unmarshalling the response. There is a chance of geting an extra element/attibute in the response(The reponse is well formed). In this case we are getting a exception. But still we want to unmarsahll the response XML.
    Can we supress all the validations completely in JAXB while unmarshalling? We tried using unmarshaller.setValidating(false); but it is not working.
    Please help us.
    Thanks,
    Omkar

    We have a schema for the XML and
    but we are not sure the responce we get is valid
    againist the scehma.
    But we are planning to use JAXB for unmarshalling the
    response. There is a chance of geting an extra
    element/attibute in the response(The reponse is well
    formed). In this case we are getting a exception. But
    still we want to unmarsahll the response XML.The premise of JAXB is that the input document is valid against the schema. Even if you could trick JAXB into parsing the XML without validating, no Object would have been generated to store the extra attributes. So if you marshall again, you would get a different document than the input document.
    According to the javadocs, Unmarshaller.setValidating(false) is the default, and has to do with having a SAXParser validate along with the JAXB Validation.
    DOM is a better choice for parsing unknown but well-formed XML documents, IMO.
    -Scott
    http://www.swiftradius.com

  • Problem with parsing large XML files chunked over HTTP

    I'm trying to isolate a bug that was introduced when upgrading the JRE in use from Java 7u51 to 7u71 without changing any code. The problem appears to be very similar to: Bug ID: JDK-8027359 XML parser returns incorrect parsing results.
    Further investigation showed that it was also introduced in the same versions (7u71) where that fix was applied. Unlike that bug though, my XML is marked as version 1.0. It also appears to be with only large XML files, on the order of 10MB or so.
    The closest I've been able to narrow it down to is the code is using JAXB to unmarshall a stream that the debugger tells me is a org.apache.http.com.EofSensorInputStream / org.apache.http.impl.io.ChunkedInputStream. The exception I get is not consistent, but typically appears to be from chunks being overwritten or shuffled, resulting in letters appearing in attributes that are actually numbers, or like the following where an attribute "testAttribute" gets partially overwritten by the end of a timestamp that was in a different section of the XML.
    javax.xml.bind.UnmarshalException
    - with linked exception:
    [javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,98748]
    Message: Attribute name "testAttribu00Z" associated with an element type "testElement" must be followed by the ' = ' character.]
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:421)
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:357)
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:334)
    Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,98748]
    Message: Attribute name "testAttribu00Z" associated with an element type "testElement" must be followed by the ' = ' character.
      at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:598)
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:181)
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:355)
      ... 6 more
    Here's some code that seems to reproduce it if you can connect to an XML server that returns a large chunked XML file:
      SchemeRegistry registry = new SchemeRegistry();
      registry.register(
                    new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
      HttpClient client = new DefaultHttpClient(new BasicClientConnectionManager(registry));
      String url = "http://someUrlReturningAlargeChunkedXML";
      HttpGet method = new HttpGet(url);
      HttpResponse response = client.execute(method);
      InputStream inputStream = response.getEntity().getContent();
      XMLStreamReader responseReader = factory.createXMLStreamReader(inputStream);
      JAXBElement<JaxBObjectOfResponse> wot = unmarshaller.unmarshal(responseReader, JaxBObjectOfResponse.class);
    If you connect using URL.openStream() to the same service there is no error. If I read bytes directly and write to a file, there is no error. The error only happens when I try to unmarshal it, and it's large, and I'm using Java 7u71 (or later). It can be consistently repeated with the jsp webapp that I'm using, but didn't show the error when I used the same code with a Wikipedia dump XML file.
    How can I unmarshal in a different way to avoid this problem? Or, how can I better isolate the bug so it can be posted to the appropriate bug system?

    Apparently, adding the Woodstox XML libraries avoids the bug. Is there anyone who can reproduce this on another system? Was there any changes to the Stax implementation between u67 and u71 that may have introduced a bug like this?
    Edit: When setting the logging level to DEBUG, I once saw the overwritten buffer being logged as if that was what was received (as in the testAttribu00Z example above). I can't repeat that anymore though, and very rarely it does parses with no exception (though it may have still been corrupted). Now the error seems to be consistently on one of the buffer boundaries, as in:
    17:08:09,705 DEBUG wire:63 - << "2000[\r][\n]"
    17:08:09,705 DEBUG wire:77 - << "trend>....OTHER XML...<trend hours=""
    17:08:09,705 DEBUG wire:77 - << "634.0972777777778" datetime="2013-05-21T00:43:48.350Z" t"
    17:08:09,705 DEBUG wire:63 - << "[\r][\n]"
    17:08:09,705 DEBUG wire:63 - << "2000[\r][\n]"
    17:08:09,705 DEBUG wire:77 - << "rend-mode="0">
    Exception in thread "main" java.lang.NumberFormatException: t34.0972777777778
      at com.sun.xml.internal.bind.DatatypeConverterImpl._parseDouble(DatatypeConverterImpl.java:213)
      at mypackage.Trend_JaxbXducedAccessor_hours.parse(TransducedAccessor_field_Double.java:48)
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.StructureLoader.startElement(StructureLoader.java:194)
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:486)
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:465)
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:60)
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleStartElement(StAXStreamConnector.java:231)
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:165)
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:355)
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:334)
    Or:
    17:19:12,563 DEBUG wire:63 - << "2000[\r][\n]"
    17:19:12,563 DEBUG wire:77 - << ...OTHER XML...<trend index="5"
    17:19:12,563 DEBUG wire:77 - << "" label="N"
    17:19:12,563 DEBUG wire:63 - << "[\r][\n]"
    Exception in thread "main" java.lang.NumberFormatException: Not a number: N
      at com.sun.xml.internal.bind.DatatypeConverterImpl._parseInt(DatatypeConverterImpl.java:106)
      at com.sun.xml.internal.bind.DatatypeConverterImpl._parseShort(DatatypeConverterImpl.java:118)

  • Running JAXB2 in a 10g Database

    Hi All,
    We have some java business logic which uses JAXB2. We now would like to be able to call / store this java code inside the database. It's a 10g database, which I understand has the 1.4 JVM, so I've retrotranslated the code (and the JAXB2 dependencies) and created a compatible jar. The loadjava command^1^ completes successfully, however when I try and execute the code which unmarshals the XML, I get the following error: Caused by: java.lang.RuntimeException: Provider com.sun.xml.bind.v2.ContextFactory could not be instantiated: javax.xml.bind.JAXBException: Provider com.sun.xml.bind.v2.ContextFactory not found
    The ContextFactory is definitely in the jar file. Looking through the generated DB trace file I see the following:
    creating : class com/sun/xml/bind/v2/ContextFactory with resolver ((* london) (* PUBLIC) (org/apache/* -) (jp/gr/xml/relax/* -) (com/bea/* -) (javax/management/* -) (com/thoughtworks/xstream/* -) (org/jvnet/* -) (com/sun/xml/fastinfoset/* -) (sun/misc/* -))
    but then, instead of resolving the class:
    skipping : class com/sun/xml/bind/v2/ContextFactory
    Why would the ContextFactory be skipped? Is there any way I can force the loadjava command to resolve it?
    1. The server-side loadJava command I use is: call sys.dbms_java.loadjava( '-force -verbose -resolve /scripts/p3/db_sql/cta23001.jar','((* london) (* PUBLIC) (org/apache/* -) (jp/gr/xml/relax/* -) (com/bea/* -) (javax/management/* -) (com/thoughtworks/xstream/* -) (org/jvnet/* -) (com/sun/xml/fastinfoset/* -) (sun/misc/* -))' );

    Hi:
    You can find Jaxb related classes implemented by Oracle into ${ORACLE_HOME}/lib/xml.jar but not all classes should be installed, please look at Ant task named unpack-jaxb-classes at:
    [http://dbprism.cvs.sourceforge.net/viewvc/dbprism/cms-2.1/tasks/cms.xml?revision=1.19&view=markup]
    this Ant task extract all Jaxb required classes which can be installed into an Oracle 10g/11g database, see the Task pre-install which install this jar into SYS's schema.
    To see how to use Jaxb marshall/unmarshall operation please take a look at the method processRequestAction, inside the code you can see how to instantiate the marshaller and unmarshaller:
    [http://dbprism.cvs.sourceforge.net/viewvc/dbprism/cms-2.1/src/com/prism/cms/action/Controller.java?revision=1.8&view=markup]
    Best regards, Marcelo.

  • Build page with screen definition in XML using XSLT in ADF 11.1.1.x

    Hi folks,
    I'm figuring out how best integrating Oracle Policy Automation/Webdeterminations in ADF. My idea is that in a ADF Taskflow I first call a Init-session webservice on OPA to initiate a session with facts queried from ADF Components.
    Then I would query a Determinations Server Webservice to get the next interview-screen definition. This gives me an xml with the definition of a screen to present. I could create an xslt that transform this to an HTML form. Then I would show a page with this (x)html form included in a container. The user could fill in the question-fields. Then on a command button I would read the values from the HTTP request and feed it into a webservice call to the Determinations Service.
    Is a scenario like this possible in ADF? And could you give me some hints to get me on track? Or would you suggest otherwise?
    The recommendation from OPA is to use data-adapters. But that are then java-classes based on an java-interface that are to be custom build on a datamodel. And I could imagine several security implications on that.
    Thanks in advance.
    Regards,
    Martien

    Can you use JAXB to unmarshall the XML document to a Java Class (and create a POJO data control out of the java class) and use it in the ADF pages as form or table or tree table?
    Take a look at the following sample how an XML document having a schema associated can be converted to a Java class and used in the UI:
    http://adftree.googlecode.com/svn/trunk/TreeSample.zip
    Thanks,
    Navaneeth

  • Parsing .xls(excel) file and creating a .xdat(xml) file out of it

    Hi All,
    need some tips on a task i am trying accomplish for some days now.
    I have a excel file, in which I have 10 columns with 40-50 rows of data.
    I have a xml structure in mind, in which I want to put all these data from excel file. But till now I haven't understood exactly how I should go about it step by step.
    Should I first parse the excel file and save each row (with the column names) in a list, and then read through each row and insert them in the xml format i have planned?
    And how do I open a .xdat data and tell my program to insert the data in the sequence of sets I want them to be saved?
    I know it's a pretty newbie question ... but will appreciate any help and tips provided. Would help me a lot to learn this new type of task.
    Thank you.
    with best regards,
    Newbie

    If you are using JAXB you unmarshall to read the xml. Then you marshall to write.
    So what you do is:
    1) Unmarshall your xml document. This means you now have your xml as Java objects.
    2) Read through the Java objects using loops, etc making any changes to the values. I think here you want to add values, so you can set your values
    3) Now in memory you have your new xml thats been updated, so you can marshall it (save it)
    I'd recommend a JAXB tutorial. But the basic steps are:
    1) Create an xml file and insure its valid
    2) Use a free online utility (http://www.hitsw.com/xml_utilites/) to convert the xml into an xml schema (xsd)
    3) Use xjc from the jaxb jar and run it over the xml schema (the command i use is xjc myxmlfile.xsd -p com.example
    4) Step 3 above creates all the java classes for you to use so then you can unmarshall. Process. Then marshall
    This is just a high level. I might have missed something, but the jaxb tutorial is really good and that's how I learned the process.

Maybe you are looking for

  • Certificate Name and Expirty Date is not saved in Certificate Manager

    The following scenario is happening for few cases: * Firefox shows "Add Exception" for the certificate * The certificate is added as permanent exception. * Go to Firefox -> Tools -> Options -> Advanced -> View Certificates * Go to Servers Tab * The c

  • How do you make a jar file for your program?

    Title says it all - I don't have software that automatically does it for me. Using text pad :O

  • What versions of systems are compatible with BI3.5

    Can anyone provide the following systems version information for BI3.5 compatible? R/3 - version? Solution Manager version ? CRM version ? Portal version ? Thanks in advance.

  • JCO Connector Value Converstion.

    Hi, We have developed a Function Module by using BAPI . And the Java People are calling that function Module and Sending the Data for MIGO Transaction. When they are sending Quantity field has been declared as String in JAVA . In SAP when are Collect

  • Creating a Text Effect

    Hello there, Can anyone help me in making a text effect the same as the one located at the top right-hand corner of the following site: http://www.heartinternet.co.uk/. I would be very greatful if anybody could help. Regards, Coxdabd.