Document to formatted XML file

I have a question. I have written a sample java program that will create an xml file. The program works properly, but the generated xml is not formatted. How can i format the xml file.
The java program code is
package com.spi.xml;
import java.io.File;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
public class WriteXML {
static Document document;
public static void buildDOM() {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder builder = factory.newDocumentBuilder();
document = builder.newDocument();
Element root = (Element) document.createElement("GUI");
document.appendChild(root);
Element curElement = document.createElement("Button");
curElement.appendChild(document.createTextNode("Submit"));
root.appendChild(curElement);
curElement = document.createElement("Button");
curElement.appendChild(document.createTextNode("Cancel"));
root.appendChild(curElement);
// Save the document to the disk file
TransformerFactory tranFactory = TransformerFactory.newInstance();
Transformer aTransformer = tranFactory.newTransformer();
Source src = new DOMSource(document);
Result dest = new StreamResult(new File("C:\\xmlFileName.xml"));
aTransformer.transform(src, dest);
} catch (Exception pce) {
pce.printStackTrace();
public static void main(String[] args) {
buildDOM();
The output (XML file)
<?xml version="1.0" encoding="UTF-8"?>
<GUI><Button>Submit</Button><Button>Cancel</Button></GUI>
How can i format the xml file for multiple lines? I cant't use other libraries (Xerces,JDOM,Xalan) cause they are to big - the application is an applet.

I don't think the DOM stuff in the core API provides any pretty printing facilities, unless they were added in 5.0.
I know that jdom does--http://www.jdom.org
You might also check out apache's XML stuff--http://xml.apache.org/
Or dom4j--http://www.dom4j.org/

Similar Messages

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

  • Can't open numbers documents, says index.xml file is missing?

    can't open numbers documents, says index.xml file is missing

    I came across this problem after upgrading to Mavericks.  Here's what I did to solve the problem:
    Issue:  I began working on an existing spreadsheet.  After I saved it and tried to pull it up again later, I got the message "index.xml file is missing...".
    Go to your dock and delete the icon for Numbers (mine still referred to the previous version of Numbers). 
    Go to Applications and drag the Numbers icon to the dock.  This icon now links to the new version of Numbers and  (hopefully)  your spreadsheet should work.

  • Automate the process of saving Framemaker documents (*.fm) as Xml Files

    Hi,
    I am new to framemaker. We have a list of Framemaker document files (*.fm files) coming  into a folder.  We need to pick up these files and convert to xml format (same as the saveAs opertion from the File menu).
    I have written the follwing function to Save fm files to xml
    Code to Save fm files to xml files
    function saveAsXml (doc) {
       // Get required parameters for the save function.
        var params = GetSaveDefaultParams();
        var returnParamsp = new PropVals();
        // Replace the .fm extension with .mif.
        var saveName = doc.Name.replace (/\.[^\.\\]+$/,".xml");
        var i = GetPropIndex(params, Constants.FS_FileType);
        params[i].propVal.ival = Constants.FV_SaveFmtXml;
        // Save the document as XML.
        doc.Save(saveName, params, returnParamsp);
    How to automate this process so that code checks -
    1) New fm files in the folder
    2) Saves the fm file as xml
    3) Moves the saved fm file to a different folder
    Thanks,
    GC
    [Message moved to Scripting Forum by moderator]

    Have a look at the sample script below. The "while" loop waits for the specified number of milliseconds, then reads the contents of a directory and processes every individual file in the directory. In my example, it just prints the file path to the console. You would replace this part with your Open / Save as / Move sequence.
    For more file system commands, refer to Adobe's Javascript Tools Guide, "File object functions".
    var stop = false;
    while( stop==false ) {
        // Wait for 20.000 ms
        $.sleep(20000);
        var fld = new Folder("c:/incoming");
        var filesInFld = fld.getFiles("*.fm");
        for(var f=0; f < filesInFld.length; f++) {
            // process the individual file
            $.writeln(filesInFld[f]);
        // Exit the  loop after 19:00
        var time = new Date();
        if( time.getHours() > 19 ) stop = true;

  • Formatting  XML file to avoid mapping parser error

    Hi,
    We have requirement in our project to process input xml file which is of the below format:
    <message>
    <data>
    <xml version=1.0 code=utf/>
    <test>
    <data>book</data>
    </test>
    </data></message>
    Since <xml>  tag is at the middle it is throwing a exception error in mapping.
    Actual requirment is that we need
    <test>
    <data>book</data>
    </test>
    The xml of the above format is generated by some external system which PI  need to pick it.
    I think  is not possible in XSLT mapping as it is not starting with xml tag .
    So please let me know pointer ot resolve the issue.
    Thanks in advance.

    Hi Yeshwanth,
    If this input XML. Then it is valid XML.
    <message>
      <data>
        <xml version="1.0" code="utf" />
        <test>
          <data>book</data>
        </test>
      </data>
    </message>
    Please paste the error message, input and expected output XML.
    Regards,
    Raghu_Vamsee
    Edited by: Raghu Vamsee on Aug 25, 2011 12:10 PM

  • Data in XML format (XML files) to BW?

    Hi,
    My customer is interested in loading data to BW (from 3rd party system) in XML format. Are there any advantages of doing this (compared to traditional ascii files)? How about disadvantages (BW version is 3.5) ?. How to get started with this one, I noticed there is a possibility to create a XML data source. Is this able to take XML files into BW or what?.
    Any help highly appreciated!

    Hi Jimmy,
       Have a look:
    http://help.sap.com/saphelp_nw04/helpdata/en/9b/821140d72dc442e10000000a1550b0/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/55/014e3c97f6bb3ee10000000a114084/content.htm
    Hope it Helps
    Srini

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

  • Indesign document convert to .xml file

    could anyone help me. i want to convert to indesign document to .xml file. i want to save all indesign document page into separate page . if i have 10
    page i want to save like 1.xml to 10.xml.

    What are you trying to achieve specifically. Did you look into IDML to see if suits your needs?
    Manan Joshi
      - Efficient InDesign Solutions -
    MetaDesign Solutions
    http://metadesignsolutions.com/services/indesign-development.php

  • Stepping through a poorly formatted xml file

    Hi, this forum worked a charm earlier so I'm hoping it will go 2 for 2.
    Through a httpservice I'm reading an XML file into a ArrayCollection. Because the XML is so poorly formatted I'm having to write some very sloppy code just to step through 20 results. I have no control over the XML.
    XML Example (can be anywhere from 0 to 20 results):
    <results>
        <game>
            <type>game</type>
            <id>321</id>
            <name>gamename</name>
            <image>i34d.png</image>
        </game>
        <character>
            <type>character</type>
            <id>1123</id>
            <name>john</name>
            <image>sds.png/image>
        </character>
        <game>
            <type>game</type>
            <id>432</id>
            <name>examplename</name>
            <image>g2dss.png</image>
        </game>
    </results>
    Each result can be one of 7 types (I've done only 2, game and character, in my example). The order of them I really want to preserve in my ArrayCollection as it's very relevant.
    Here is the (very) sloppy way I'm currently loading each result into my AC:
    //container array
    var ac2:ArrayCollection = new ArrayCollection;
    //I do a block like this for EVERY results type. Meaning 7 in total...
    if (service2.lastResult.response.results.character) {
         var characterAC:ArrayCollection = new ArrayCollection;
         if (service2.lastResult.response.results.character is ArrayCollection) {
         //there is more than 1 entry
         characterAC = service2.lastResult.response.results.character as ArrayCollection;
         } else {
              //There is only 1 entry. Need to MAKE it an ArrayColleciton
              characterAC = new ArrayCollection([service2.lastResult.response.results.character]);
            //Add all characters to AC
         ac2.addAll(characterAC);
    The two major problems with this code is: 1, it's stupidly bloated and 2, ac2 no longer maintains the order of the XML response. First it puts all <character> into my AC, then it puts all <game> into AC. So on and so forth.
    In my head I'm trying to do something like this:
    ac2 = service2.lastResult.response.results.* as ArrayCollection;
    That would then load all results (regardless of type) into an ArrayCollection. I'm guessing a solution is not that simple...
    In an Ideal world, whoever created the XML api would just call each result <result> instead of the stupid type tags it currently uses.
    I hope all that makes sense.
    Regards,
    Zaph.

    @Zaph31,
    Why not use an XMLListCollection instead of an ArrayCollection?
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" initialize="init();">
        <mx:XML id="iWouldntHaveCodedXMLLikeThat" xmlns="">
            <results>
                <game>
                    <type>game</type>
                    <id>321</id>
                    <name>gamename</name>
                    <image>i34d.png</image>
                </game>
                <character>
                    <type>character</type>
                    <id>1123</id>
                    <name>john</name>
                    <image>sds.png</image>
                </character>
                <game>
                    <type>game</type>
                    <id>432</id>
                    <name>examplename</name>
                    <image>g2dss.png</image>
                </game>
            </results>
        </mx:XML>
        <mx:XMLListCollection id="xmlListColl" />
        <mx:Script>
            <![CDATA[
                private function init():void {
                    xmlListColl.source = iWouldntHaveCodedXMLLikeThat.children();
            ]]>
        </mx:Script>
        <mx:DataGrid id="dg" dataProvider="{xmlListColl}">
            <mx:columns>
                <mx:DataGridColumn dataField="type" />
                <mx:DataGridColumn dataField="id" />
                <mx:DataGridColumn dataField="name" />
                <mx:DataGridColumn dataField="image" />
            </mx:columns>
        </mx:DataGrid>
    </mx:Application>
    Peter

  • Writing a clean, formatted xml file

    Am reworking an xml file with two types entities both with the name "item", one is a base item and the second is an item referred to by the base items.
    My task is to replace the child "<mention_ref item_id=xxx/>" with the actual item that xxx refers to, rename that element to "mention_ref" and delete the element I moved. All this part works well.
    Hoowever, when I write it out it's not formatted and there a empty lines where the missing elements are.
    How can I fix this?
    Jim

    Tried all that and no change in the output, see below:
         <item id="_491" name="$5,000" norm="$_5_,_000" ontology="entity:numeric:money" type="equiv">
              <mention_ref equiv_id="_491" head="2115" id="_317" name="$5,000" norm="$_5_,_000" ontology="entity:numeric:money" tail="2121" type="mention">
              <attribute name="mention_type" value="name"/>
              <attribute name="currency" value="usd"/>
              <attribute name="norm" value="5000"/>
         </mention_ref>
              <attribute name="mention_type" value="name"/>
              <attribute head="2115" name="name" tail="2121" value="$5,000"/>
              <attribute name="currency" value="usd"/>
              <attribute name="norm" value="5000"/>
         </item>
         <item id="_473" name="Associated Press" norm="associated_press" ontology="entity:organization:company" type="equiv">
              <mention_ref equiv_id="_473" head="2330" id="_333" name="Associated Press" norm="associated_press" ontology="entity:organization:company" tail="2346" type="mention">
              <attribute name="confidence" value="4"/>
              <attribute name="mention_type" value="name"/>
         </mention_ref>
              <mention_ref equiv_id="_473" head="1557" id="_337" name="AP" norm="ap" ontology="entity:organization:company" tail="1559" type="mention">
              <attribute name="confidence" value="2"/>
              <attribute name="mention_type" value="name"/>
         </mention_ref>
              <mention_ref equiv_id="_473" head="816" id="_336" name="AP" norm="ap" ontology="entity:organization:company" tail="818" type="mention">
              <attribute name="confidence" value="2"/>
              <attribute name="mention_type" value="name"/>
         </mention_ref>
              <mention_ref equiv_id="_473" head="475" id="_332" name="Associated Press" norm="associated_press" ontology="entity:organization:company" tail="491" type="mention">
              <attribute name="confidence" value="4"/>
              <attribute name="mention_type" value="name"/>
         </mention_ref>
              <mention_ref equiv_id="_473" head="2326" id="_472" name="The Associated Press" norm="the_associated_press" ontology="entity:organization:company" tail="2346" type="mention">
              <attribute name="mention_type" value="extended_name"/>
         </mention_ref>
              <mention_ref equiv_id="_473" head="471" id="_470" name="The Associated Press" norm="the_associated_press" ontology="entity:organization:company" tail="491" type="mention">
              <attribute name="mention_type" value="extended_name"/>
         </mention_ref>
              <attribute name="confidence" value="4"/>
              <attribute name="confidence" value="2"/>
              <attribute head="2326" name="extended_name" tail="2346" value="The Associated Press"/>
              <attribute head="471" name="extended_name" tail="491" value="The Associated Press"/>
              <attribute name="mention_type" value="name"/>
              <attribute name="mention_type" value="extended_name"/>
              <attribute head="2330" name="name" tail="2346" value="Associated Press"/>
              <attribute head="1557" name="name" tail="1559" value="AP"/>
              <attribute head="816" name="name" tail="818" value="AP"/>
              <attribute head="475" name="name" tail="491" value="Associated Press"/>
         </item>it is valid, but not formatted.

  • How to load a base64-stream (always WORD-document) in large XML files ( 1 MB) into ORACLE 10 table

    On our Oracle Server there are multipe XML files that I have to read and put the data into an ORACLE 10 table.
    I have to threath these XML files one by one.
    In the XML there is also een base64-stream (alwasys a WORD-document) .  This base64-stream exists of 1.000.000 characters.
    How can I read this base64-stream from the XML-file into a BLOB-column of my ORACLE 10 table
    ORACLE 10
    1 XML = +/- 1 MB
    PL/SQL
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <slo xmlns="http://www.myschema.com/gasdedectie">
    <LekKey>1999_036371_509627</LekKey>
    <HuiNum>46</HuiNum>
    <Res></Res>
    <InfLig>TEST STRUI AFGESTORVEN - PLAANSTRAAT 46</InfLig>
    <XWGS>3.637028</XWGS>
    <YWGS>50.962667</YWGS>
    <Pei>KESTENS</Pei>
    <DatPei>1999-11-30T10:17:36.000+01:00</DatPei>
    <Kan> </Kan>
    <Doc>UEsDBBQABgAIAAAAIQB5gHbnswEAAHcGAAATAAgCW0NvbnRlbnRfVHlwZXNdLnhtbCCiBAIooAACAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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vJW3W80oEOio82EcTnwTB/XRsXOtAPhCXIpcXHITQJdWYu
    geHNS+V/b6n3miJqiXa1jR7rvNcbEDpGso0s6GQ4uoH/j9WCo29gxzk1P1Uc6KeCNLDi2GXQvUWPwV1U
    9rG74F3Er+MrGqpL0TuPuXt1eymKgmxpaSaMy4Lp51QwdHpWDd11wprjuoh76PgqurE8HY3RqGnCvMaA
    6VgCeiuMHD9B3ajdxJGhQrcWx0lkJcYSXbaByvE6Bg+dbuRF3pWCKhCDqrzSs25gAmFtmwTAbe1mZ0ce
    +gtG+cFg125gAL00eqC809thFCd1K/Cu0AE0AiqaU9fSToyqDI+eHkGF+QFqfN4U17/KvlxzNEnnL9y7
    4zmJFV25DiiXCo5+BR8Qn0Fz5y8nmuMWx1CA60M5p4YeD+E0L/w42JCE3j+H41t1jI5vbrU0HIPEwD+g
    1x+aMnQ9+TocDQZSry13B8MrnlfFOj9AFJKcDryLbBN68o3GsEywVJU6mUkFVA5+vJQTKYwS6HSoj2vZ
    wGOSZEn0uO0Ayz
    pQQAALNCCQAAAA==</Doc>
    </slo>

    If I understand your question correctly, the discussion in this thread
    ORA-31167: 64k size limit for XML node
    shows you do not have a lot of options.
    As you are needing to extract the contents of a node from an XML document, and that node is > 64K, you are going to need to treat the entire XML as a CLOB and use CLOB functionality (aka INSTR, SUBSTR) to find and extract what you need.
    Once your DB version is 11.1 or greater, then you can use the built-in that Billy mentions.
    Note: mdrake is Mark Drake from Oracle.

  • Error parsing ERwin 7.x File when I  tried to IMPORT repository format xml file in SQl Data Modeller

    This is what i got in the log file when i tried to import a relatively large file 1.7 GB xml file
    Import Finished
    Errors:   1
    Warnings: 0
    <<<<< ERRORS >>>>>
    Error parsing ERwin 7.x File:<File path>
    Please help.

    The error information in the External log file is
    ERROR ERwinHandler - ERwinHandler - Unable to parse ERwin 7.x file: <file path>
    java.lang.OutOfMemoryError: Java heap space
      at oracle.dbtools.crest.model.ModelIDObject.<init>(ModelIDObject.java:46)
      at oracle.dbtools.crest.model.design.DesignObject.<init>(DesignObject.java:111)
      at oracle.dbtools.crest.model.design.ContainedObject.<init>(ContainedObject.java:82)
      at oracle.dbtools.crest.model.design.ContainedObjectWithDomain.<init>(ContainedObjectWithDomain.java:76)
      at oracle.dbtools.crest.model.design.relational.FKElement.<init>(FKElement.java:14)
      at oracle.dbtools.crest.model.design.relational.Column.<init>(Column.java:148)
      at oracle.dbtools.crest.model.design.relational.Table.createColumn(Table.java:432)
      at oracle.dbtools.crest.imports.erwin.ERSAXParserv7x.parseColumns(ERSAXParserv7x.java:1681)
      at oracle.dbtools.crest.imports.erwin.ERSAXParserv7x.parseEntity(ERSAXParserv7x.java:1364)
      at oracle.dbtools.crest.imports.erwin.ERSAXParserv7x.endEntitiesAndAttributes(ERSAXParserv7x.java:994)
      at oracle.dbtools.crest.imports.erwin.ERSAXParserv7x.endElement(ERSAXParserv7x.java:428)
      at oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1666)
      at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:458)
      at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:404)
      at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:245)
      at oracle.xml.jaxp.JXSAXParser.parse(JXSAXParser.java:298)
      at oracle.dbtools.crest.imports.erwin.ERwinHandler.parseFile(ERwinHandler.java:252)
      at oracle.dbtools.crest.imports.erwin.ERwinHandler.access$500(ERwinHandler.java:51)
      at oracle.dbtools.crest.imports.erwin.ERwinHandler$Runner.run(ERwinHandler.java:126)
      at java.lang.Thread.run(Thread.java:745)
    2015-02-11 14:38:12,680 [main] INFO  ApplicationView - Oracle SQL Developer Data Modeler 4.1.0.866
    2015-02-11 16:13:44,218 [Thread-33] ERROR ERwinHandler - ERwinHandler - Unable to parse ERwin 7.x file: <file_Path>
    java.lang.OutOfMemoryError: Java heap space

  • How to write the org.w3c.dom.Document  into an XML file.

    The file doesn't not exist. I have a class to form an XML Document object with giving parameters. And then how to write this Document object to an specialitied
    file?

    The easiest way is to use a Transformer to do an default transform of the document from a DOMSource to a StreamResult.
    something like
             TransformerFactory tf = TransformerFactory.newInstance();
             tf.setAttribute("indent-number", new Integer(4));
             Transformer t = tf.newTransformer();
             t.setOutputProperty(OutputKeys.INDENT, "yes");
             t.setOutputProperty(OutputKeys.METHOD, "xml");
             t.setOutputProperty(OutputKeys.MEDIA_TYPE, "text/xml");
             t.transform(new DOMSource(yourDOMDocument), new StreamResult(new OutputStreamWriter(yourFileOutputStream)));

  • How to format XML file as in JDeveloper's style?

    I'm trying to output XML by using oracle.xml.parser.v2.XMLOutputStream. There are three possible output styles: COMPACT, DEFAULT, PRETTY. I tried all of them, but none of them can give me the exact fromatting style as in JDeveloper. What output style JDeveloper is using? If there's a special XSL is being used by JDeveloper, can anyone give me a link?
    Much thanks
    Charles

    You mean you want to see the XML source?
    You need to replace the characters '<' and '&' with corresponding entities '&lt;' and '&amp;'. You can use replaceAll, but do the ampersands first.
    Then I suggest you probably want to put them in a <PRE> block.

  • Using a CWM format XML as datastore; COM SDK to read the file and create Universe

    Hello everyone
    We are in the process of migrating from a metadata store to BusinessObjects Universe and the plan is to use Java/COM SDK to accomplish that. We have run into limitations with both the SDKs. Java SDK doesn't provide that facility and using COM SDK we are trying to read from a XML file (metadata in CWM format) and create the universe but so far haven't been successful. If the (Universe)Designer can read a CWM format xml file (say created from BODS) we are wondering why can't a customer made COM program do the same.
    Has anyone attempted this and been successful. Please acknowledge.
    Thanks

    I have written C#.NET code to build universes on the fly using the Designer SDK with no problems.  However, I wasn't using CWM formatted data to do this.
    I have two suggestions for you:
    1.  Since not all of the functionality in the Designer tool seems to be available through the SDK, can you parse the CWM xml file in your code and build the universe based on the data instead of trying have Designer build it?
    2.  Since you're using Java, you may get better answers by posting this question in the Java SDK Application Development space here:  http://scn.sap.com/community/bi-platform/java-sdk
    -Dell

Maybe you are looking for