JAXB Help

im looking to do following
I have a XSD . I want to manipulate JAva beans representing the XSD complex types in Java, at runtime , set values in the beans, and then easily generate a XML string out of the java bean
The xml string if written to file must be a valid XML document.
1) can i use JAXB for this
2) any code samples, or pointers to tutorials will really help
thanks

We are using JAXB through Top Link.
What you have to do is to generate the java bean class corresponding to your xml schema using the jaxb compilator in Jdeveloper.
We have seen that the element in the xml schema has to be defined as global or reference a simple or complex type to generated correctly as a class we will have to use later as data control.
Create a java bean that reference you main object class and load the document, by example in the getter.
public Classification getClassificationDocument() {
try {
//Create a JAXBContext instance
jaxbContext = JAXBContext.newInstance("classification.toplinkInterface");
// get the xml document file
file = new java.io.File(this.pathXML);
if (file.exists() == true) {
// create the unmarhaller objet to read the document
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
// read the document into the objet that represent the document structure
classificationDocument =
(Classification)unmarshaller.unmarshal(file);
} catch (Exception e) {
e.printStackTrace();
return classificationDocument;
Use that java bean to generate a data control.
Be careful to the interface that are generated with java.array.util.list that are not typped. For them you have typped manually or you declare the corresponding bean class in the data control xml file corresponding the that iterator.
<?xml version="1.0" encoding="UTF-8" ?>
<JavaBean xmlns="http://xmlns.oracle.com/adfm/beanmodel" version="10.1.3.39.84"
id="ClassificationLanguageType"
BeanClass="classification.toplinkInterface.ClassificationLanguageType"
Package="classification.toplinkInterface" isJavaBased="true">
<Attribute Name="classificationLanguageCode" Type="java.lang.String"/>
<Attribute Name="classificationLanguageLabel" Type="java.lang.String"/>
</JavaBean>
Note also that jdeveloper don't create a data control file for the implementation file and will need it at execution time. Be sure to create a data control manually for the implementation class you will use. classification.toplinkInterface.ClassificationLanguageType is the interface, so i will have to create a data control for classification.toplinkInterface.impl.ClassificationLanguageTypeImpl too.
<?xml version="1.0" encoding="UTF-8" ?>
<JavaBean xmlns="http://xmlns.oracle.com/adfm/beanmodel" version="10.1.3.39.84"
id="ClassificationLanguageTypeImpl"
BeanClass="classification.toplinkInterface.impl.ClassificationLanguageTypeImpl"
Package="classification.toplinkInterface.impl" isJavaBased="true">
<Attribute Name="classificationLanguageCode" Type="java.lang.String"/>
<Attribute Name="classificationLanguageLabel" Type="java.lang.String"/>
<ConstructorMethod IsCollection="false" Type="void"
id="ClassificationLanguageTypeImpl"/>
</JavaBean>
Hope this will help you ...
<?xml version="1.0" encoding="UTF-8" ?>
<JavaBean xmlns="http://xmlns.oracle.com/adfm/beanmodel" version="10.1.3.39.84"
id="ClassificationLanguageTypeImpl"
BeanClass="classification.toplinkInterface.impl.ClassificationLanguageTypeImpl"
Package="classification.toplinkInterface.impl" isJavaBased="true">
<Attribute Name="classificationLanguageCode" Type="java.lang.String"/>
<Attribute Name="classificationLanguageLabel" Type="java.lang.String"/>
<ConstructorMethod IsCollection="false" Type="void"
id="ClassificationLanguageTypeImpl"/>
</JavaBean>
Note that we are using jxpath too search node in the xml document with xpath. That is very very very useful.
Here is an example that search for all main-title in french as a pointer, get the title value and get the correponding identification to generate an alphabetic index from a hierarchical structure.
Hope this will help you

Similar Messages

  • JAXB help please

    Can i use JAXB to remove an Element in the XML file? For example, in the Purchase Order, is there anyway that i can delete
    <billTo country="US">
    <name>Robert Smith</name>
    <street>8 Oak Avenue</street>
    <city>Cambridge</city>
    <state>MA</state>
    <zip>12345</zip>
    </billTo>
    this whole junk from the XML file ?
    Thanx for your help
    _old man
    <?xml version="1.0"?>
    <purchaseOrder orderDate="1999-10-20">
    <shipTo country="US">
    <name>Alice Smith</name>
    <street>123 Maple Street</street>
    <city>Cambridge</city>
    <state>MA</state>
    <zip>12345</zip>
    </shipTo>
    <billTo country="US">
    <name>Robert Smith</name>
    <street>8 Oak Avenue</street>
    <city>Cambridge</city>
    <state>MA</state>
    <zip>12345</zip>
    </billTo>
    <items>
         <item partNum="242-NO" >
              <productName>Nosferatu - Special Edition (1929)</productName>
              <quantity>5</quantity>
              <USPrice>19.99</USPrice>
         </item>
         <item partNum="242-MU" >
              <productName>The Mummy (1959)</productName>
              <quantity>3</quantity>
              <USPrice>19.98</USPrice>
         </item>
         <item partNum="242-GZ" >
              <productName>Godzilla and Mothra: Battle for Earth/Godzilla vs. King Ghidora</productName>
              <quantity>3</quantity>
              <USPrice>27.95</USPrice>
         </item>
         </items>
    </purchaseOrder>

    Not directly, but yes.
    You can use JAXB to load the file (you'll need to have compiled the schema, so JAXB knows the format of the file), then delete the object from the Java object holding it, then use JAXB to write the file back out again.

  • JAXB help needed

    I have the following schema file...
    <?xml version="1.0"?>
    <xs:schema
    targetNamespace="lrpfull.namespace"
    xmlns:lrpfull="lrpfull.namespace"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    >
    <!--****************************************************************************************************************************************-->
    <xs:element name="FullApplication">
    <xs:complexType>
                   <xs:all>
         <xs:element name="ProjectTitle" type="lrpfull:ProjectTitle"/>
                        <xs:element name="AccessionNumber" type="xs:string"/>
                        <xs:element name="localProposalID" type="xs:string" minOccurs="0"/>
         <xs:element name="timestamp" type="xs:dateTime"/>
                        <xs:element name="MessageID" type="xs:string" minOccurs="0"/>
         <xs:element name="ApplicationAttachnment" type="lrpfull:FileIdentifierType"/>
                   </xs:all>
              </xs:complexType>
         </xs:element>
         <!-- ****************** Simple Types Definitions ****************** -->
         <xs:simpleType name="FileIdentifierType">
              <xs:restriction base="xs:string"/>
         </xs:simpleType>
         <xs:simpleType name="ProjectTitle">
              <xs:restriction base="xs:string"/>
         </xs:simpleType>
    </xs:schema
    and the coressponding xml file is :-
    <?xml version="1.0" encoding="UTF-8"?>
    <lrpfull:FullApplication xmlns:lrpfull="lrpfull.namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="lrpfull.namespace
    C:\lrp\lrpfullschema.xsd">
         <ProjectTitle>Test Project</ProjectTitle>
         <AccessionNumber>123112312</AccessionNumber>
         <localProposalID>0001 </localProposalID>
         <timestamp>2001-12-17T09:30:47-05:00</timestamp>
         <MessageID>DK92-20</MessageID>
         <ApplicationAttachnment>abstract </ApplicationAttachnment>
    </lrpfull:FullApplication>
    When I try to unmarshall the Stream using the JAXB
                   JAXBContext jc = JAXBContext.newInstance(getCONTEXT());
              // create an Unmarshaller
                   Unmarshaller u = jc.createUnmarshaller();
    u.setValidating(true);
    unmarshalledObject = u.unmarshal(istream);
    i get the following error..
         at hk.hku.cecid.phoenix.message.handler.Request$Monitor.run(Request.java:284)
    Caused by: javax.xml.bind.UnmarshalException
    - with linked exception:
    [com.sun.msv.verifier.ValidityViolation: unexpected attribute "xmlns:lrpfull"]
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(AbstractUnmarshallerImpl.java:306)
         at com.sun.xml.bind.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:134)
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:139)
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:186)
    Can anyone please help. The xml is well formatted and valid.

    hi srikant,
    u r using jaxb2.0 as part of jwsdp2.0.
    when u try to generate jaxb classes with .xsd file using jaxb2.0, u will never get those impl as well as runtime folders created and files under them. Jaxb2.0 has feature to bind these data in the few files generated.
    If u really want these files generated, try using jaxb1.0 or jaxb 1.0.x
    See the below topic pasted by me for compatability issues:
    http://forum.java.sun.com/thread.jspa?threadID=5235499&tstart=0
    topic name:what is the jaxb version compatible with jdk1.3
    reply back if u have any questions...
    hema

  • How do you Append XML to an existing document?

    Hi there, I need to to append an existing XML document to a new XML document. How is this done?
    Is there an easy way of attaching one XML document to another?
    If not, do I need to parse the existing XML and add it to the new document, element by element?
    My existing XML is received as an input string and I need to include it in the new document.
    Thanks in advance
    Michael

    Hi there, I need to to append an existing XML document
    to a new XML document. How is this done?
    you can use JAXB to do this. unmarshall(), validate() and marshall() belonging to java intepretion of xml document.
    To eloborate further, say u have xml document as
    <book>
    <author>...</author>
    </book>
    JAXB helps u to get java intepretion of xml document by converting it into Book class and Author class.
    And, say u want to add new authors, u need to add Author objects to Book object and then pass Book object to marshall() method.
    The xml document will be appended with the author u added.
    Hope this helps.
    Jatin

  • XSD to java class

    Anyone know an application that convert automatically a XSD file into a java class that can create and manipolate a XML file (based on my XSD)?
    Thanks
    MAuro

    The best method is to install java web service pack JWSD. It contains XJC and JAXB which helps to create java classes from XSD and JAXB helps in processing that DOM in your java program which uses the JAXB library.JWSD also provides many other tools like JAXP,JAXR etc which helps you to solve all the problems in domain related to the XML.

  • Need urgent help on JAXB !!

    I'm new to JAXB and in urgent need of help. Here's my problem.
    I have a schema which has a child node "node1".
    "node1" can occur once or multiple times.
    My Input
    Now, I receive an xml with 5 occurrences of "node1".
    My Required Output
    I need to create 5 xmls (same schema) with 1 occurrence of "node1".
    Please help me with solution(s).
    Thanks a ton in advance
    :)

    Also you can ask at Java Technology & XML forum:
    http://forum.java.sun.com/forum.jspa?forumID=34

  • Help in resolving JAXB issue.

    HI
    I have an element called currency which has a default value as "USD".
    The xml schema entry for this element is as shown below:
    <xsd:element name="currency" type="xsd:string" default ="USD" />
    when i generate JAXB objects, the default value for this element is not getting initialized to the variable defined for this element.
    can anyone help me in getting this information into the JAXB object that gets generated by xjc.
    do i need to provide any custom binging configuration for this.
    Thanks in advance.
    Bala

    I have the same problem.
    I tried to reset without resolving.
    I tried also to remove Whatsapp and viber, than changed the current date to a date in the past, I installed Whatsapp and Viber and accepted the push notification. Also in this the problem is not resolved.
    I confirm that the problem started after the update to ios 8.1
    Regards

  • JAXB  I realy need you help

    JAXB I realy need you help
    Dear friend
    We have next structure of XML file
    <order>
    <entities>
    <entity>1</entity>
    <entity>2</entity>
    <entity>3</entity>
    </entities>
    </order>
    according to xml we generate XSD
    after that use xjc.exe for generate JAXB Objects
    Class Order
    Entities entities
    Class Entities
    List<Entity> entity
    but I would like to be like that
    Class Order
    List<Entity> entity
    Class Entities make transient or use JAXB Custome mapping or other decision
    Thanks

    that is the standard way jaxb generates the model classes. i believe there is some sort of experimental "use simple mappings" switch (probably a vendor extension) which makes the xml files cleaner (similar to your desired implementation), but i don't have much experience with it.

  • Help needed on JAXB 2.0

    Hi,
    I am trying to generate java classes from a simple catalog.xsd file.
    The output is below.
    Directory of E:\jaxbsamples\schema
    11/13/2007 04:24 PM <DIR> .
    11/13/2007 04:24 PM <DIR> ..
    11/13/2007 04:12 PM 971 catalog.xsd
    11/13/2007 04:30 PM <DIR> generated
    11/13/2007 02:56 PM 1,647 Lesson.java
    2 File(s) 2,618 bytes
    3 Dir(s) 9,440,661,504 bytes free
    E:\jaxbsamples\schema>xjc catalog.xsd
    parsing a schema...
    compiling a schema...
    generated\ArticleType.java
    generated\CatalogType.java
    generated\JournalType.java
    generated\ObjectFactory.java
    The directory impl and runtime directory under impl and the respective java files never get generated.
    Not sure what the problem is . My class path is below
    CLASSPATH=E:\jaxbsamples;E:\Java\jwsdp-2.0\jaxb\lib\jaxb-api.jar;E:\Java\jwsdp-2
    .0\jaxb\lib\jaxb-impl.jar;E:\Java\jwsdp-2.0\jaxb\lib\jaxb-libs.jar;E:\Java\jwsdp
    -2.0\jaxb\lib\jaxb-xjc.jar;E:\Java\jwsdp-2.0\jswdp-shared\lib\namespace.jar;E:\J
    ava\jwsdp-2.0\jwsdp-shared\lib\jax-qname.jar;E:\Java\jwsdp-2.0\jwsdp-shared\lib\
    xsdlib.jar;E:\Java\jdk1.6.0_02\lib\tools.jar;E:\Java\jwsdp-2.0\jwsdp-shared\lib\
    relaxngDatatype.jar;E:\Java\jwsdp-2.0\jaxp\lib\jaxp.jar;E:\Java\jwsdp-2.0\jaxp\l
    ib\endorsed\dom.jar;E:\Java\jwsdp-2.0\jaxp\lib\endorsed\sax.jar;E:\Java\jwsdp-2.
    0\jaxp\lib\endorsed\xalan.jar;E:\Java\jwsdp-2.0\jaxp\lib\endorsed\xercesImpl.jar
    I am using jwsdp2.0 and JDK 1.6 update 2.
    Any help is greatly appreciated.
    Thanks
    Srikant

    hi srikant,
    u r using jaxb2.0 as part of jwsdp2.0.
    when u try to generate jaxb classes with .xsd file using jaxb2.0, u will never get those impl as well as runtime folders created and files under them. Jaxb2.0 has feature to bind these data in the few files generated.
    If u really want these files generated, try using jaxb1.0 or jaxb 1.0.x
    See the below topic pasted by me for compatability issues:
    http://forum.java.sun.com/thread.jspa?threadID=5235499&tstart=0
    topic name:what is the jaxb version compatible with jdk1.3
    reply back if u have any questions...
    hema

  • HELP GURU NEEDED!!!    JAXB NotSerializableException/NullPointerException

    Hi,
    This is one for the Gurus.
    I have a JAXB implementation that unmarshalls an xml stream into a instance of type HIEAIXMLDOC.
    The methods to create this are wrapped up in a session EJB and pass the unmarshaled HIEAIXMLDOC instance back to a client.
    On the client side I want to call methods on the unmarshalled doc HIEAIXMLDOC to get my data.
    The first problem I encountered was the NotSerializableException being thrown when I attempted to unmarshall my xml stream into the HIEAIXMLDOC class (on the server side).
    I then implemented the Serializable interface on this class and rebuilt the JAXB classes that seemed to work and I was allowed to call the unmarshall method to unmarshall the xml stream and so create the HIEAIXMLDOC instance.
    Now the what happens is that an object seems to be passed back to the calling client class but it contains no information and the NullPointerException is being thrown.
    The funny thing I noticed was that on the server side (ie within my session ejb) I called the same methods that I called on the client side and they return valid data on the server side?????
    So basically my HIEAIXMLDOC instance is working and valid on the server side but once it is passed to the client it looses all data within.
    I'm a bit stumped on this one and have no gurus to talk to about this.
    Any help is greatly appreciated.
    thanks in advance
    Paul

    I can't comment on your sepcific problem but we have just had a similar issue with converting a JAXB set of code into an EJB. What you need to know for this is here:
    http://java.sun.com/webservices/docs/1.2/jaxb/vendorCustomizations.html
    If you use a binding file, just put the customisations in there (thats what we did).
    (we didn't use the Uid= part of the serialise flag)
    Hope this helps.

  • Help in setting up JAXB

    I am trying to use JAXB, I am using eclipse IDE, if i copy the jar files from jaxb/lib to my project lib directory , is that good enough.
    Do i need anything else.
    I download the webservices jwsdk., but i really donot need all of it.. Please help

    Documentation would have help.... but...
    You would need some libs from $JWSDP_HOME/common/lib as well as $JWSDP_HOME/jwsdp-shared/lib.
    The jars i have in my project are :
    jaxb-api.jar
    jaxb-impl.jar
    jaxb-libs.jar
    jaxb-xjc.jar
    jax-qname.jar
    namespace.jar
    xsdlib.jar
    xercesImpl.jar
    and relaxngDatatype.jar

  • Help on jaxb

    I am new to JAXB, I would like to seek help from you guys.
    my requirement is, I would like to write an xsd schema for the xml file (tree structure )which is given below .
    Xml sample:
    <data language="English">-----------------1
         <datalink type="navigational" template="templateid">-------------1.1
              <name>String</name>
              <detaildescription>String</detaildescription>
              <image>String</image>
              <datalink type="navigational" template="templateid">-----------1.1.1
                   <name>String</name>
                   <detaildescription>String</detaildescription>
                   <image>String</image>
                   <datalink type="terminal" template="templateid">     
                        <name>String</name>
                        <detaildescription>String</detaildescription>
                        <image>String</image>
                        <page>
                             <header>String</header>
                             <shortdescription>String</shortdescription>
                             <image>String</image>
                             <imagedescription>String</imagedescription>
                        </page>
                   </datalink>
              </datalink>-------------end of 1.1.1
         </datalink>----------------end of 1.1
         <datalink type="terminal" template="templateid">-------------1.2
              <name>String</name>
              <detaildescription>String</detaildescription>
              <image>String</image>
              <page>
                   <header>String</header>
                   <shortdescription>String</shortdescription>
                   <image>String</image>
                   <imagedescription>String</imagedescription>
              </page>
         </datalink>----------end of 1.2
    </data>-----------------end of 1
    There are basically two nodes, one is navigational which contains description about the node (i.e. name, detaildescription, image) and also information about the child nodes.
    Second one is a Terminal node, which is some what similar to leaf node.
    Navigational node must contain atleast one terminal node and it can have 'n' number of either navigation node or Terminal nodes (similar to tree structure).
    I would like to write an xsd for above mentioned tree structure and would like to use jaxb to create java equivalent objects. I would like to know how can I implement schema for recursive loop (tree structure) and would like to know whether I can use jaxb for this purpose or I have to use anything else?.
    Thank you.
    Regards,
    Ramki.

    A schema element with elements with same name and different complexType
    generates error:
    "Elements with the same name and in the same scope must have the same type."
    <?xml version='1.0' encoding='UTF-8'?>
    <!DOCTYPE xs:schema PUBLIC '-//W3C//DTD XMLSCHEMA 200102//EN'
    'http://www.w3.org/2001/XMLSchema.dtd'
    >
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="data">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="datalink" type="navigational"/>
    <xs:element name="datalink" type="terminal"/>
    </xs:sequence>
    <xs:attribute name="language"/>
    </xs:complexType>
    </xs:element>
    <xs:complexType name="navigational">
    <xs:sequence>
    <xs:element name="datalink" type="navigational" minOccurs="0" maxOccurs="1"/>
    <xs:element name="datalink" type="terminal" minOccurs="0" maxOccurs="1"/>
    <xs:element name="name"/>
    <xs:element name="detaildescription"/>
    <xs:element name="image"/>
    </xs:sequence>
    <xs:attribute name="type" type="xs:string"/>
    <xs:attribute name="template" type="xs:string"/>
    </xs:complexType>
    <xs:complexType name="terminal">
    <xs:sequence>
    <xs:element name="name"/>
    <xs:element name="detaildescription"/>
    <xs:element name="image"/>
    <xs:element name="page">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="header"/>
    <xs:element name="shortdescription"/>
    <xs:element name="image"/>
    <xs:element name="imagedescription"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    <xs:attribute name="type" type="xs:string"/>
    <xs:attribute name="template" type="xs:string"/>
    </xs:complexType>
    </xs:schema>

  • Help with Jaxb - AnyType access to sub-elements?

    Hi All,
    I am reading an XML file (defined with XML Schema) using Jaxb.
    I need one particular element to hold an arbitrary, but well formed, XML document (with any tags).
    As such I've defined this element to be of the type xs:anyType. (See payload)
    The AnyType Jaxb class however only appears to be giving me access to the text node strings (not sub-elements). (Notice its don't see <b> needs help </b>)
    I need the whole thing so I can pass it on to another parser.
    Any ideas? Is this supported in jaxb? Is this supported by XML Schema? Am I doing something wrong?
    See details below.
    Thanks!
    mike
    THE SCHEMA:
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema elementFormDefault="qualified"
               attributeFormDefault="unqualified"
               jaxb:version="1.0"
               xmlns:xs="http://www.w3.org/2001/XMLSchema"
               xmlns:jaxb="http://java.sun.com/xml/ns/jaxb">
            <xs:element name="message" type="message"/>
            <xs:complexType name="message">
                    <xs:annotation>
                            <xs:appinfo>
                                    <jaxb:class name="XmlMessage"/>
                            </xs:appinfo>
                    </xs:annotation>
                    <xs:sequence>
                            <xs:element name="from" type="xs:string"/>
                            <xs:element name="to" type="xs:string"/>
                            <xs:element name="send-date" type="xs:date"/>
                            <xs:element name="payload" type="xs:anyType"/>
                    </xs:sequence>
            </xs:complexType>
    </xs:schema>
    THE DOCUMENT:
    <?xml version="1.0" encoding="UTF-8"?>
    <message xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:noNamespaceSchemaLocation="message.xsd">
         <from>Mike</from>
         <to>Java Community</to>
         <send-date>2006-03-23</send-date>
         <payload>Mike<b> needs help </b>parsing the AnyType</payload>
    </message>
    THE CODE:
            // get the fields
            String from = xmlMessage.getFrom();
            String to = xmlMessage.getTo();
            Calendar date = xmlMessage.getSendDate();
            AnyType payload = xmlMessage.getPayload();
            // print out the values
            System.out.println("FROM: " + from);
            System.out.println("TO: " + to);
            System.out.println("DATE: " + date.getTime());
            System.out.println("PAYLOAD: " + payload);
            // print out details regarding the payload (The AnyType list)
            System.out.println("\tAnyType list length = "
                    + payload.getContent().size());
            for (Iterator i = payload.getContent().iterator(); i.hasNext();) {
                Object o = i.next();
                System.out.println("\t" + o.getClass() + " : \"" + o + "\"");
            } THE OUTPUT:
    FROM: Mike
    TO: Java Community
    DATE: Wed Mar 22 19:00:00 EST 2006
    PAYLOAD: org.w3._2001.xmlschema.impl.AnyTypeImpl@1c99159
         AnyType list length = 2
         class java.lang.String : "Mike"
         class java.lang.String : "parsing the AnyType"

    Ok.
    source message:
    root
    - node0 (first instance)
    --- node1
    name="<b>key</b>"
    value="<b>my_key_value_1</b>"
    --- /node1
    --- node1
    name="attribute1"
    value="attribute1_value"
    --- /node1
    --- /node0
    - node0 (second instance)
    --- node1
    name="<b>key</b>"
    value="<b>my_key_value_2</b>"
    --- /node1
    --- node1
    name="attribute1"
    value="attribute1_value"
    --- /node1
    - /node0
    /root
    Desired destination message:
    root
    - node0 (first instance)
    - key_value=<b>my_key_value_1</b> <- does exist
    --- node1
    name="<b>key</b>"
    value="<b>my_key_value_1</b>"
    --- /node1
    --- node1
    name="attribute1"
    value="attribute1_value"
    --- /node1
    - /node0
    - node0 (second instance)
    - key_value=<b>my_key_value_2</b>  < should exist but does <u>not</u> exist
    --- node1
    name="<b>key</b>"
    value="<b>my_key_value_2</b>"
    --- /node1
    --- node1
    name="attribute1"
    value="attribute1_value"
    --- /node1
    - /node0
    /root

  • Urgent Help on JAXB Validation - Please Help

    I have an application that needs validation before marshalling a content tree. If the tree is not valid, I need to marshall the tree and look at the problem in the XML file itself.
    If it's a valid XML file, then continue as usual...
    These is the pseudo code.. But don't know if I can implement it with JAXB or not....And how to implement it..
    populate XML tree
    check if the tree is valid or not
    if it is valid continue processing
    if not valid, marshall the tree into an XML file and analyze the
    problem
    Any input is welcome...
    Thanks in advance..

    svenkatesh s, thanks for your reply. In addition to your suggestion,
    I found this method:
    public class ValidationHelper implements ValidationEventHandler {
    public boolean handleEvent(ValidationEvent arg0) {
         System.out.println("The message is: " + arg0.getMessage());
         System.out.println("The severity is: " + arg0.getSeverity());
         ValidationEventLocator locator = arg0.getLocator();
         System.out.println("The column number: " + locator.getColumnNumber());
         System.out.println("The line number: " + locator.getLineNumber());
              Node nd = locator.getNode();
              log.write(Logger.LOG_INFO, "The node: " + nd);
              String st = nd.getNodeName();
              log.write(Logger.LOG_INFO, "Node Name " + st);
              String stt = nd.getNodeValue();
              log.write(Logger.LOG_INFO, "Node Value: " + stt);
              return true;
    I noticed that Node is null, but it might be a test data problem...

  • Help in Java XML Binding (JAXB)

    Looking for a JAVA written program that will provide interface to complex XML files using JAXB.
    Requirement : JAVA progam will report on existing XML using a simple GUI that will run on Windows. Program should be able to be emailed and installed with all components including XML files and schema. Purpose of this program is twofold.

    Sir,
    It is bad to expect people to solve assignments for you. Would you elaborate on where you are stuck?

Maybe you are looking for

  • Payment terms in Sales order by default

    Hi, I have configured in payment terms in customer master as AB11 for description blank . but when i took printout for sale order its showing by default "Paybale immediatly by deduction" so please guide me this is Abap issue or any other config i mii

  • Facetime not working

    facetime is not working on my new ipad2. it works on iphone.

  • Profit Centre Report Print Out

    Hello, I would like to change the print layout design of the profit centre report and add account names and transaction dates as well. The problem is I can't see how the values are being pulled from the database even for the original data in the repo

  • Sharing internet with xp

    Is there a simple way this can be done? The pc is connected to the net. thank you!

  • HT4898 Why is Apple downgrading sync support for Mail with iCloud?

    In the past, if I didn't move forward when Apple moved forward, all that happened was that I did not have access to new features. This time, with the demise of MobileMe and the introduction of iCloud, if I don't move forward I lose features, but even