Marshalling and Unmarshalling on xml

is this the one of the way of parsing xml??

If by "marshalling and Unmarshalling on xml" you mean converting between XML and Java, then yes, JAXB can be a viable alternative to SAX or DOM, depending on your requirements.
It is a simpler solution if it's the binding that you actually need.
If Java representation of XML isn't relevant and you're only concerned about firing events when a particular XML artifact is detected, then SAX would be more indicated.
Take the good habit of listing your actual requirements before considering a range of options.

Similar Messages

  • File marshalling and unmarshalling exception

    Hello All,
    I just want to know that if I have an object which is serialized and another object which is not serialized then it is mandatory to serialize that object in the current example
    For example
    ArrayList is serialized by default.
    So can this particular example run.
    class ABC {
    void go(){
    ArrayList a = new ArrayList();
    a.add(new ABC());
    Do I need to serialize ABC also ?.
    Thanks and regards,
    Sachin

    Why it has to be serialize. If ArrayList is
    serializable then can't it hold the ABC object with
    it ?. It can hold it but it can't serialize it.
    The concept is dead simple really. If you want to Serialize a class then it must implement Serializable. It doesn't matter what the class is inside of or how many classes you have or anything else. Each and every class you want to serialize must implement Serializable.
    Means seems I am confused with serialization.
    Does anyone have a good tutorial on serialization ?.I don't think you really need a tutorial for a straightforward concept like this but http://java.sun.com/docs/books/tutorial/essential/io/providing.html

  • Marshaling and xml generation

    Hi
    Can any one pls tell for generating an xml file from fetching data from database do i have to use marshalling.
    Why exactly marshalling is being used.?How is DomBuilder useful and diferent from marshaller?
    Thanks
    Swaroopa

    Thanks for ur reply.
    Let me make myself clear ...
    I have to generate a flat xml file by pulling the data from db.
    Now i want to use a dom builder where as one if my collegue who is fresher wants to use castor's marshalling process to generate xml.
    I know the concept of marshalling which is used for serilaizing the object graph so that it is unmarshalled on the other end.But iam unable to convince her.
    It would be great if u can give me 2 lines answer which is convincing enough to make her understand.
    Thanks

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

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

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

  • How do i marshall to send the xml?

    i have to send a xml
    through JMS
    i have the lib where i can build the object, but
    how do i marshall it into a XML?...
    for sending?
    i am using 1.5

    There's a bit in here on marshalling.
    http://java.sun.com/webservices/docs/1.4/tutorial/doc/index.html
    Problem with JAXB (and I could be wrong - try posting on the Web Services / XML forum) is that you can only marshal the generated classes. This may mean that you need to create the object, and populate it using the setter / getter methods.
    Castor is much more friendly for this as it can marshall objects using reflections. You may also want to look into XMLBeans (which I have no exp of)

  • Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the rows? Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the records?
    Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    The Oracle documentation has a good overview of the options available
    Generating XML Data from the Database
    Without knowing your version, I just picked 11.2, so you made need to look for that chapter in the documentation for your version to find applicable information.
    You can also find some information in XML DB FAQ

  • Advantage and disadvantage of xml publisher, report builder and discoverer

    Hi,
    anyone can explain advantage and disadvantage of xml publisher, report builder and discoverer?
    thanks in advance!

    The best way i found was to put a equals and then double quotes... this only works for excel however it will allow you to cut and paste (ie to use the value to search in Oracle) and also to do vlookups.
    In a bit more detail:
    - I used word to generate my default table
    - this created a field INVOICE_NUM
    - in the cell in the table i put = " before the INVOICE_NUM field and then put the closing " afterwards.
    The theory is that excel will concatenate the values together... because it has quotes around it, it will treat it as a string rather than simply a value.
    For any other formats this will not work.
    I'm guessing most people have moved on and resolved this some other way, but just thought I'd share the wealth!

  • How to read the data from Excel file and Store in XML file using java

    Hi All,
    I got a problem with Excel file.
    My problem is how to read the data from Excel file and Store in XML file using java excel api.
    For getting the data from Excel file what are all the steps i need to follow to get the correct result.
    Any body can send me the code (with java code ,Excel sheet) to this mail id : [email protected]
    Thanks & Regards,
    Sreenu,
    [email protected],
    india,

    If you want someone to do your work, please have the courtesy to provide payment.
    http://www.rentacoder.com

  • How Can I Attach and Link an XML file to a 3D Model in a PDF?

    How Can I Attach and Link an XML file to a 3D Model in a PDF?
    What I am trying to do is find out how to have a 3D model and a parts list linked to it within the PDF file.  I would also like to be able to add to the parts list if at all possible once the pdf has been created.  A template to create future PDF's with the 3D model and list might also be useful.
    I am not entirely sure if this is all possible within a PDF file, but I have viewed a PDF (Adidas Trainer) example which has a Excel file attached to it which links to the 3D model.  I have also had a look at partner products such as Lattice, Tetra4D, Anark, which can do animations and all sorts, but frankly it seems a bit overkill for what I am looking to do.
    Please, any help would be appreciated.  Thanks

    AlliCT59 wrote:
    > Shared Object sounds like it would work, but hten agian,
    I'm really stuck!
    >
    > Thanks for any help.
    >
    > Allison
    I wrote about it while ago, let me paste the whole thing.
    This example has simple
    buttons which upon click go to new sites and in the same time
    place record in form
    of *.SOL file on user drive. That record is read when you hit
    the next button and
    based on that the button will be selected as the one last
    clicked.
    You could use the very same thing just instead of suppressing
    button simply gotoAndPlay frame
    to continue the part you need.
    http://groups.google.com/group/macromedia.flash.actionscript/browse_thread/thread/36649453 1f4fd02d/245a57d0cdaa1d29?lnk=st&q=&rnum=3&hl=en#245a57d0cdaa1d29
    The source is in a different place, i re-upload for you :
    http://www.flashfugitive.com/stuff/SharedObj_urlcheck/
    fla file
    http://www.flashfugitive.com/stuff/SharedObj_urlcheck/beentourl.fla
    Best Regards
    Urami
    <urami>
    If you want to mail me - DO NOT LAUGH AT MY ADDRESS
    </urami>

  • Import and flow the xml text in a indesign document

    pls,anyone give me a solution for import and flow the xml text in a document.
    thanks,
    screen410099

    See http://forums.adobe.com/thread/838745?tstart=0
    Would you mind waiting a bit before asking again and again and again and then again? It's possible the person who can answer you question just didn't happen to read the forums this week.

  • How to include the characters " " and " " in a XML properties file.

    hi
    including the following prop entry gives me the error "Element is not closed" error message.
    <entry key="test">can't include chars < and ></entry>
    But i need to include the chars "<" and ">" in my xml properties file.
    please help.
    thanks

    Try &lt; and &gt;
    Dave Patterson

  • I have been working on the same numbers file for the past few weeks.  The last time I opened it was 1 week ago.  Today when I tried to open it I am unable and getting a message that the file is invalid and the index.xml file is missing.

    I have been working on the same numbers file for the past few weeks.  The last time I opened it was 1 week ago.  Today when I tried to open it I am unable and getting a message that the file is invalid and the index.xml file is missing. 

    Hi Tracie,
    I upgraded to Maverick OS X 10.9.5, numbers spreadsheet is saved. Upon re-opening, it appears to be frozen, a warning "file is invalid as index.xml file is missing". I checked, and the file is not "locked". This appears to occur only with using the new numbers app. When I open previous spreadsheets from old iWorks, no such problem occurs.
    How did you resolve your problem?
    Would appreciate any help here.
    Thanks,
    Deehay

  • WCF Service and Sharepoint Form library : How i can read a access a form libray and query a item from file name and read form xml in WCF service ?

    WCF Service and Sharepoint Form library : How i can read or access a form libray and query a item from file name and read form xml in WCF service ?
    Ahsan Ranjha

    Hi,
    In SharePoint 2013, we can take use of REST API or Client Object Model to access the SharePoint objects like Form Library.
    SharePoint 2013 REST API
    http://msdn.microsoft.com/en-us/library/office/dn450841(v=office.15).aspx
    http://blogs.technet.com/b/fromthefield/archive/2013/09/05/working-with-sharepoint-list-data-odata-rest-and-javascript.aspx
    SharePoint 2013 Client Object Model
    http://msdn.microsoft.com/en-us/library/office/fp179912(v=office.15).aspx
    http://msdn.microsoft.com/en-us/library/office/jj193041(v=office.15).aspx
    With the retrieved file, we can then use XmlDocument object to parse it and get the values you want:
    http://weblogs.asp.net/jimjackson/opening-and-reading-an-xml-file-in-a-document-library
    http://stackoverflow.com/questions/1968809/programatically-edit-infopath-form-fields
    Best regards
    Patrick Liang
    TechNet Community Support

  • Archiving  and Deleting of XML Messages in SAP NetWeaver PI 7.31 single stack

    Hello my XI friends!
    Need step by Step Guide to Archiving
    and Deleting of XML Messages in
    SAP NetWeaver PI 7.31 single stack
    Similar to these instructions
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e0afdd69-a8a7-2d10-7e9a-cbf6fa21c5a7?quicklink=index&overridelayout=true
    Regards,
    Rinaz

    Please check the below blog  for archiving java only-(XMLDAS)
    http://scn.sap.com/community/pi-and-soa-middleware/blog/2011/11/16/aae-archiving-in-sap-pi-711-with-xmldas
    For deletion there is standard delete job..
    https://help.sap.com/saphelp_nw73ehp1/helpdata/en/48/b2e0036b156ff4e10000000a42189b/frameset.htm
    Message was edited by: Hareesh Gampa

  • How to login to a remote (FTP??) server and read an XML file?

    Hello all,
    I would like some information on how to login to a remote server using a Java program.
    The server might be a ftp server, because the client will ftp a xml file to this server, and the java program needs to login to this server and read the xml file, then convert it into a general report with headings and data from the xml file.
    How can I quickly find the API information to login to a server and read an xml file?
    If anyone knows the packages off the top of their heads, that would save me some time surfing.
    If anyone can provide me some links, code examples, or information I'd greatly be thankful.
    sharla

    You can also just use plain java.net. It supports FTP. Example:URL u = new URL("ftp://user:passwd@server/path/to/file.xml");
    InputStream in = u.openStream();
    // do what you want ...

Maybe you are looking for

  • Error while booting: SIOCADDRT: File Exists

    I have a Toshiba laptop with two nics built in, one 100mb ethernet plug, one wireless.  I do not use the wireless nic.  When my laptop boots I get the "Starting Network" message then a [FAIL] with a "SIOCADDRT:: File Exists" error, however, the netwo

  • Dreamweaver CS5.5 CodeIgniter Syntax Highlighting

    Hi Everyone, I am new to CodeIgniter but have been using Dreamweaver for over a year now, and one of the best features that speeds up my coding is the syntax highlightin and code completion that Dreamweaver offers,,is there a plugin or some way in wh

  • How to connect to iTunes Store

    I cannot process my App Store because I cannot connect to iTunes Store.

  • SAP Master data migration tools

    Hi, I would like to know if any SAP standard tools which are available for all master data migration,Kindly share the same which is required for us now. We have to migrate the data from legacy systems to SAP and we have to use only SAP Standard maste

  • Check PR quantity againt outline agreement

    user gets an error message when he creates a new PR comparing with open target quantity of that agreement.