Store object in XML file

Hello,
I have a project class(object) which contains all information about the actual project. In this class there are some base type variables and some sub classes. To save the actual project object I don't want to use serialization but an XML output.
1. Is there any possibilities to do this (eg.: a free class library)? Or I have to write my own save/load functions?
Thanks!

you have to write your own save/load functions, since you have to build your personnel xml document and then serilaize it
you can use nu.xom at this url
http://www.cafeconleche.org/XOM/apidocs/nu/xom/package-summary.html
to parse your document

Similar Messages

  • Dynamically create Value Objects from XML file

    Hi
    I want to create a value object from Xml file dynamically,like in the xml file i have the name of the variable and the datatype of the variable.is it possible do that,if so how.

    Read about apache's Digester tool. This is part of the Jakartha project. This tool helps in creating java objects from the XML files. I am not sure, if that is what u r looking for.

  • Serializing Java Objects to XML files

    Hi,
    We looking for SAP library which can serialize Java Objects into XML files.
    Can you point us were to find it ?
    We have found such open source library called "XStream" at the following link
    http://www.xml.com/pub/a/2004/08/18/xstream.html
    Is it allowed to use that library inside SAP released software ?
    Thanks
    Orit

    How about https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/webcontent/uuid/83f6d2fb-0c01-0010-a2ba-a2ec94ba08f4 [original link is broken] [original link is broken]? Depends on your use cases...
    Both are supported in SAP NW CE 7.1.
    HTH!
    -- Vladimir

  • Converting Document object into XML file

    I was wondering how to convert a document object to XML file? I have read the documentation about document and Node but nothing explains the procedure of the conversion. Ive been told that it can be done, but not sure how. I have converted an XML file into Document by parsing DocumentBuilder. Just not sure how to do the reverse. Any help appreciated.

    TransformerFactory tf = TransformerFactory.newInstance();
    Transformer trans = tf.newTransformer();
    trans.transform(new DOMSource(yourDOMsRootNode), new StreamResult(new FileOutputStream(yourFileName)));or something a lot like that.

  • Store objects like word files, excel sheet, pics in database

    Hi guys,
    I want to store objects like word files, excel sheet, pics in one of my column in a table.
    what shud be the datatype of my column if i am using oracle 9i release 1.
    and how to store these files in database????? how is it possible thru forms.
    regards,
    Imran Baig

    On OTN is a demo File Upload Utility for Forms 9i/10g
    The demo for 6i can be found here

  • Regarding conert the object to XML file

    Hi all
    i want to convert the object to XML file in my application.plz give me the sample code
    Thanks in advance

    Or you could make your object JavaBean compliant and save it using XMLEncoder and reload it by using XMLDecoder.
    To be JavaBean compliant you basically need a no arg constructor and getters and setters for all fields you want to keep.
    Aye,
    Jim

  • Conversion of DOM object to XML file

    Hi
    Is there a direct method for conversion of a Document object to xml file? My code is like this
    Transformer aTransformer = tranFactory.newTransformer();
              System.out.println("Tansformers :"+aTransformer);
              aTransformer.setOutputProperty(OutputKeys.INDENT, "yes");
              DOMSource src = new DOMSource(resultDocument);
              System.out.println("src :"+src);
              Result dest = new StreamResult(new FileOutputStream(new File(filepath)));
              System.out.println("desc :"+dest);
              aTransformer.transform(src, dest);
    but the line DOMSource src = new DOMSource(resultDocument);
    is giving me an error like "undefined constrctor" . what must be the problem?
    Thanks

    DOMSource src = new DOMSource(resultDocument);
    resultDocument should be of type org.w3c.Node

  • Store and load objects to XML files using DOM

    Hello everybody,
    a quick question for all of you.
    I'm designing a desktop application which requires a lot of custom objects to be stored into XML files and later reloaded from them. I'm planning to use DOM, creating an interface like this:
    public interface StorableAsDom
    // Create an object from a DOM tree
    static Object createFromDom(org.w3c.dom.Node root) throws InvalidDomException;
    // Get the DOM tree for an object
    org.w3c.dom.DocumentFragment getDomTree(org.w3c.dom.Document doc) throws DOMException;
    Then, every class which needs to be saved should implement the above interface. This way everything works fine.
    My question is: do you know any available java package which already provides similar functionalities?
    I'd like not to reinvent the wheel if I can; time is always a critical factor.
    Thanks in advance to all of you.
    Cheers
    marcocaco

    Hi,
    When I need object -xml binding, I usually have two methods -
    one for reading & one for writing (the "VOs" below stands for "Value Objects" [getters/setters & empty constructor only]):
    READ: loadXML (= XML2VOs)
    1.XML2DOM - this method can be generic
    2.DOM2VOs - populate your VOs from the DOM just obtained in 1.
    WRITE: saveXML (=VOs2XML)
    1.VOs2DOM - create a new DOM document from your VOs' fields.
    2.DOM2XML - this method can be generic
    It would be nice (but dificult & not very elegant) to make DOM2VOs & VOs2DOM generic. If such methods will be written, they should be combined with the XML2DOM & DOM2XML (resp.) & then you would have two generic methods XML2VOs & VOs2XML... (Alternativelly, you can get Sun's JAXB package which does object-xml binding but this is not part of the JDK 5)
    If what I have outlined above sounds like what you want to do, let me know if you want more details (eg. how the DOM2VOs would be implemented etc)...

  • Entity Object over XML file

    USing Jdeveloper 11.1.1.0.2+ADF
    Have anybody implemented an entity object over a XML file, i want to store some informations into a XML before connect to a database (the connection information) and be able to modify the data (create rows) using AF forms and tables.
    Edited by: Fernando Ferpa Hackbart on Jun 18, 2009 5:39 PM

    you have to write your own save/load functions, since you have to build your personnel xml document and then serilaize it
    you can use nu.xom at this url
    http://www.cafeconleche.org/XOM/apidocs/nu/xom/package-summary.html
    to parse your document

  • How to upload new products to my store in an XML file?

    Hi everyone, I'm back. I've been creating a store for a client and we have everything working but someone told me that it's easier to upload products in an XML file if you have a ton of them. So I've been trying to figure it out but the only thing I can find on the internet is that I'm doing it wrong.
    Here's what I do:
    Under "E-Commerce" on the left, I click on "Products" and then on that page, I click on "Import products". I clicked "Download Import Template" and when I opened it the first thing that I notices was that it's not a .xml file. It's a .xls file (Don't know if that makes a difference). The second thing I noticed was that it confused me more that I was expecting. There are 7 tab on this document and I can't find any explanation for the way they set this document up. Are the 7 tabs just for the ease of Adobe explaining it to the customer/user? or do I need to set up my document this way before I can upload products?
    Since I didn't really know what I was doing, I filled it out as best I could and then tried to upload. I clicked on "Choose File" in the "File to import" section and selected "Auto-Detect" for the file type. I click next at the bottom of the page and it gave me this message
    "ERROR: [No Name found]. Import process failed on record: [2] Please ensure 1) mandatory columns are present, 2) all products have Product Codes defined, which should be unique (if importing products)"
    I've fixed everything I could and tried everything a hundred times but still keep getting that same error message. If anyone can help I'd love you forever, even if you can point me to somewhere on the web that would help.
    Many thanks in advance for any help. Cheers.

    I recommend that if you are not familiar with the details of the spreadsheet template provided by BC, then do a few products manually through the admin and then EXPORT the product spreadsheet and she how the data needs to entered to match your client's needs. Then use that spreadsheet as the MASTER Product List and import it when all the details have been filled. In the beginning I recommend leaving all the columns intact for ease of importing it back without much ado. This has helped me.

  • Create file object from xml file in different package

    I have my java class which is in a package...edu.xx.proj
    It contains the following
    File f = new File("formats.xml");
    My xml file is in the package edu.xx.proj.xml
    How do I get the file object for my xml file?
    Ultimately I want that once the jar is shipped .. The path of xml file shld be independent of my OS path... it can only lookup the package path..
    I will really appreciate it if someone can throw some input as to how to resolve this issue..
    Thank you

    I have my java class which is in a
    package...edu.xx.proj
    It contains the following
    File f = new File("formats.xml");
    My xml file is in the package edu.xx.proj.xml
    How do I get the file object for my xml file?
    Ultimately I want that once the jar is shipped .. The
    path of xml file shld be independent of my OS path...
    it can only lookup the package path..
    I will really appreciate it if someone can throw some
    input as to how to resolve this issue..
    Thank you
    InputStream inputStream = getClass().getResourceAsStream("xml/formats.xml");
    /* OR */
    URL url = getClass().getResource("xml/formats.xml");hth

  • How to generate Java objects from XML files with out  scema compilation

    Dear participants,
    My name is Raghavendra , i have a requirement of reading XML files Dynamically and parse them and create java types for manipulation . i will not be provided with sxd files (no schema compilation )coz no one knows how many types of structures are there. i want a generic solution. Please Help.
    Thanks ,
    Raghavendra Ach
    you can mail me to " [email protected]"

    georgemc wrote:
    You could also look at something like Apache Digester, which will parse your XML and populate Java objects with the data. A slightly steeper learning curve than the lower-level APIs such as JDOM, but that's outweighed by the lesser development effortdon't think that would work for the original problem, which seemed to indicate that the xml had an unknown structure.

  • Saving business objects into xml file

    I have the following XML file parsed into a DOM tree, with 2 different types of nodes "TestCase" and
    "RealCase". Then I mapped each type to a different type of business object, TestCaseObj and RealCaseObj.
    Now, there may be addition of new objects, or modifications to the data stored in the business objects
    by my application. Eventually when I save the business objects back into the XML file, how should I go
    about doing that?
    <ROOT>
    <TestCase TestID="T1">
         <Element1>Data1</Element1>
         <Element2>Data2</Element2>
    </TestCase>
    <TestCase TestID="T2">
         <Element1>Data1</Element1>
         <Element2>Data2</Element2>
    </TestCase>
    <RealCase ID="R1">
         <Element1>Data1</Element1>
         <Element2>Data2</Element2>
         <Element3>Data3</Element3>
    </RealCase>
    <RealCase ID="R2">
         <Element1>Data1</Element1>
         <Element2>Data2</Element2>
         <Element3>Data3</Element3>
    </RealCase>
    </ROOT>

    The DocumentBuilder class does not allow you to parse a portion of the xmlfile. Therefore, it will not be possible to read "TestCase" into the DOM without bringing in "RealCase" nodes as well. As such, these codes will parse the entire xml file into DOM:
    DocumentBuilder builder = builderFactory.newDocumentBuilder();
    Document document = builder.parse( xmlFile );
    However, your problem can be solved by reading only "TestCase" nodes in DOM, as follows:
    NodeList elementNodeList =
    elementNode.getElementsByTagName("TestCase");
    Your codes will then change the data in the elementNodeList, without affecting "RealCase" although it is loaded into DOM. You can be sure that elementNodeList contains only "TestCase" nodes.
    Once you have made your changes, save the DOM back to the XML file, using the serializer method as discussed earlier.
    Good luck.

  • Converting Dom Document object into XML file removes the DTD

    Hi All
    My xml is dtd. I have one xml file. i changed the node value after that i want to create a xml file with the same name. I created new xml file but i am not seeing the old dtd in the new file. This process is done with the help of jaxp.
    My code is given below
    File fileInput = new File("input.xml");
              File fileOutput = new File("output.xml");
              DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
              factory.setExpandEntityReferences(false);
              DocumentBuilder builder = factory.newDocumentBuilder();
              Document document = builder.parse(fileInput);
              TransformerFactory tFactory = TransformerFactory.newInstance();
              Transformer transformer = tFactory.newTransformer();
    transformer.setOutputProperty(javax.xml.transform.OutputKeys.INDENT, "true");
              transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
              DOMSource source = new DOMSource(document);
              FileOutputStream fos = new FileOutputStream(fileOutput);
              StreamResult result = new StreamResult(fos);
              transformer.transform(source, result);
    Thanks in advance

    The Transformer API does not guarantee the preservation of that information. You may want to check the DOM L3 Load/Save package (http://java.sun.com/javase/6/docs/api/index.html). Alternatively, you may force things by setting the additional output properties 'doctype-public' and 'doctype-system'.

  • How get data from business object to xml file

    Hi all,
    My new problem is ,,
    In my application, I have check list of selected business partners. In that , I want to save the checked oBusinessPartners complete information to an XML file(created dynamically),
    How to do?
    Thanks in advance
    shashi kiran

    Shashi Kiran,
    Can you explain me detail where
    you want to save check business partners in xml ?
    Jeyakanthan

Maybe you are looking for

  • Payment Order deletion

    Dear gurus, I need a help in APP. In Autometic payment program our client is using payment orders. While clearing from the bank due to some techinal issue open item has not been cleared but clearing document has been created against the vendor. This

  • New iPhone will not connect to iTunes Store. Not able to activate

    I bought my iPhone 3 weeks ago from an AT&T store and use it everyday. It works fine. I bought one for my wife 2 days ago from the same AT&T store and it does not work. After spending 2 + hours on the phone with Apple level 1 and 2 support, the final

  • Where are the regular maintenance updates?

    Most expensive/professional software I own licences for receives maintenance updates and bug fix patches on a regular basis. Even with shareware and freeware, the patches and updates just keep coming. Flash Professional should certainly be no differe

  • Plz helP me about the new FW (software) v4.0750.31...

    plz help me i was update new FW v4.0750.31.2.1 but found too bugs in music player i cant save the preset and the sogs was download in memory always bad file when i play it. and the camera light is very little and not pure. plz I wanna the old version

  • Report with user name with location

    Hi All, I am searching for table or report where I can get the users mapped to location code. In org stru. extended attributes we have location code. I wanted to pull up the all the suers list location code assinged to users. Could you please help to