Guide Lines to Use SAX,DOM using javax.xml. * files only, I

Hi Respected Recievers,
My Name is Surya, i am working as a Java
Programmer.
I need JAR files to run SAX and DOM properly.
I don't want to Use xerces.jar or jaxp.jar files, i will use only javax.xml.* files only.
Could provide some examples on those topics like reading,modifying,the files using SAX and DOM.
Thanks&Regards
Surya

Add rt.jar to Classpath.
DOM Tutorial
http://java.sun.com/webservices/docs/1.0/tutorial/doc/JAXPDOM3.html
SAX tutorial
http://java.sun.com/j2ee/1.4/docs/tutorial-update2/doc/JAXPSAX.html

Similar Messages

  • I have to print two labels using single XML file.Error:Only one top level e

    Hi,
    I have to print two labels using single XML file. But its giving error:
    [Error] Error -1072896683 - Line: 38 Pos: 2 Error: Only one top level element is allowed in an XML document.
    Below is my XMl file:
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE labels SYSTEM "label.dtd">
    <labels FORMAT="lib://FRD/PurchasedDoor.btw"  PRINTERNAME="IBM 6700-R80 (300 dpi)" _QUANTITY="1">
    <label>
    <variable name= "Color">AUTUMN</variable>
    <variable name= "Special_Message_Attribute">MSG*</variable>
    <variable name= "Special_Message">This is special Message Label</variable>
    <variable name= "Model"></variable>
    <variable name= "Build_Date">09-APR-12</variable>
    <variable name= "Assy_Cart"></variable>
    <variable name= "Assy_Slot"></variable>
    <variable name= "Finish_Cart"></variable>
    <variable name= "Finish_Slot"></variable>
    <variable name= "Serial_Number">1945.1.1.2-1</variable>
    <variable name= "Serial_Number_Barcode">1945.1.1.2-1</variable>
    <variable name= "Specie">BIRCH</variable>
    <variable name= "Truck_Group"></variable>
    <variable name= "Label_Sequence_No">1</variable>
    <variable name= "WIP_Cart"></variable>
    <variable name= "WIP_Slot"></variable>
    <variable name= "Cabinet_Sequence_No">110</variable>
    <variable name= "JC"></variable>
    <variable name= "Thickness"> </variable>
    <variable name= "Width"> </variable>
    <variable name= "Length"> </variable>
    <variable name= "Overlay"></variable>
    <variable name= "Options">B30</variable>
    <variable name= "Profile_No"></variable>
    <variable name= "Door_Style">NEWBERRY</variable>
    <variable name= "Glaze"></variable>
    <variable name= "Shape"></variable>
    <variable name= "Glass"></variable>
    <variable name= "Hinge_Side"></variable>
    <variable name= "Hinge_Type"></variable>
    <variable name= "EGE"></variable>
    </label>
    <labels FORMAT="lib://FRD/SpecialMessage.btw"  PRINTERNAME="IBM 6700-R80 (300 dpi)" _QUANTITY="1">
    <label>
    <variable name= "Serial_Number">1945.1.1.2-1</variable>
    <variable name= "Special_Message">This is special Message Label</variable>
    <variable name= "Cabinet_Sequence_No">110</variable>
    </label>
    </labels>
    Please suggest.

    >
    XML can only have one root element per file.
    >
    from XML Document: The Root Element

  • Can I Use a XML file as Managed Resource?

    Hi,
    I have a XML file which has all employee details.
    Can I use that XML file as a Resource in IDM?
    If so please let me know the steps to do.
    Please help me in this regard.
    Thanks
    RMS

    No.
    Since the XML file you have has custom tags, there is not a way for IDM to understand it's contents.
    IDM does offer a "Simulated" resource, which is an XML based resource, but it has a defined structure. You might be able to alter your XML to match what the Simulated Resource expects, or better yet, get it into a database and use the database table adapter.

  • Can you use an XML file to make Subclips for you?

    Hi everyone,
    I know this is a bit of a long-shot, but I am wondering if I can use an XML file(made after logging a few tapes, but before capture) to make subclips for me?
    Basically I have a painful project with 2 tapes i had to capture separately as 1 long individual clip each due to time-code breaks, but as i did first Log & Capture as usual (only to later find it wouldn't batch capture) i didn't want my hard work to go to waste!
    Hope I explained that clearly enough,
    Adam
    Message was edited by: Chocboy

    I'm assuming you captured using the non-controllable device setting and have the clip including TC breaks and blank areas etc.
    Try this:
    Load the clip into the Viewer and play it. Press M to set markers wherever you want them.
    If you want to give the marker a more decriptive name, press M a second time whilst the playhead is positioned on the marker. A dialog will open with text input fields. Or, click the marker in the Browser, then click the marker’s name to select it. You can now change the name.
    Drag in the Browser to select all the markers or click the first one, then shift click the last one.
    Choose Modify > Make Subclip. This will make all the subclips in one go and if you gave your markers new names, your subclips will use them.
    The subclips appear in addition to the original clip with the markers. You can rename the subclips, if you want. You can review the subclips, deleting any clips you might not need. If you do remove unused clips, you can use the Media Manager to remove your unused footage from disk, leaving the media for your remaining subclips alone.

  • ScanNGo - Using localbackup.xml file

    Hi All, Wondering if someone would be able to help us out, we have hundards of CN51's and CN50's through AUS and NZ and have been looking into this ScanNGo barcode system. AUS have successuflly used the .XML file from the localbackup via SOTI Mobicontrol deployment system, but am trying to make it as easy as possible as with SOTI we still need to setup an APN connection before being able to connect to the device, so hence why am looking at the ScanNGo to atleast setup the APN. Searching the forums and I see people have had success in using the ScanNGo creator by using the localback.xml from the SmartSystems folder. Unfortunately this does not seem to work for me, it will scan all 9/9 barcodes from the ScanNGo system but then returns an error "Error reading scanned data into xml" Attached is the localback.xml file from which I can apparently use this file with the ScanNGo barcode creator ? Could someone please correct me if i'm wrong on this. Thanks, Much appreciated.

    Hello AdamD
    first, it is no good idea to apply a full backup xml to a device. You should only change the settings different from factory default. See other posts here about how to create a configuration xml with only changed settings.
    secondly, a backup xml does not contain security data like passwords. So the backup xml does not have the WWAN password(s):
    <Subsystem Name="WWAN Radio">
    <Field Name="ARD Enabled">
    0</Field>
    <Field Name="RadioType">
    2</Field>
    <Field Name="Restore Connection Entry Defaults">
    0</Field>
    <Field Name="Radio Power State">
    1</Field>
    <Field Name="Carrier">
    Worldwide UMTS</Field>
    <Field Name="Carrier Settings Auto Config">
    Enabled</Field>
    <Group Name="Carrier Settings">
    <Field Name="Restore Connection Entry Defaults">
    0</Field>
    <Group Name="Connection Info" Instance="Verizon">
    <Field Name="Connection Name">
    Verizon</Field>
    <Field Name="Phone">
    #777</Field>
    <Field Name="APN"/>
    <Field Name="Username"/>
    <Field Name="Password"/>
    <Field Name="AlwaysOn">
    0</Field>
    </Group>
    <Group Name="Connection Info" Instance="ATT">
    <Field Name="Connection Name">
    ATT</Field>
    <Field Name="Phone"/>
    <Field Name="APN">
    wap.cingular</Field>
    <Field Name="Username"/>
    <Field Name="Password"/>
    <Field Name="AlwaysOn">
    0</Field>
    </Group>
    <Group Name="Connection Info" Instance="Sprint">
    <Field Name="Connection Name">
    Sprint</Field>
    <Field Name="Phone">
    #777</Field>
    <Field Name="APN"/>
    <Field Name="Username"/>
    <Field Name="Password"/>
    <Field Name="AlwaysOn">
    0</Field>
    </Group>
    <Group Name="Connection Info" Instance="Worldwide UMTS">
    <Field Name="Connection Name">
    Worldwide UMTS</Field>
    <Field Name="Phone"/>
    <Field Name="APN">
    Spark</Field>
    <Field Name="Username"/>
    <Field Name="Password"/>
    <Field Name="AlwaysOn">
    1</Field>
    </Group>
    </Group>
    <Group Name="WWAN Information">
    <Field Name="Phone Number">
    Not Available</Field>
    <Field Name="Firmware Revision">
    REVISION 03.001</Field>
    <Field Name="ESN">
    990004190136592</Field>
    <Field Name="IMEI">
    990004190136592</Field>
    <Field Name="IMSI">
    505013475281816</Field>
    <Field Name="Network">
    Telstra Mobile</Field>
    <Field Name="Model">
    PXS8</Field>
    <Field Name="Manufacturer">
    Cinterion</Field>
    </Group>
    </Subsystem>
    As you can see, the "WWAN Information" is nothing to be used for a configiration xml. And you see that there are no passwords.
    AFAIS the only WWAN settings you need to setup the connection is:
    <Group Name="Connection Info" Instance="ATT">
    <Field Name="Connection Name">ATT</Field>
    <Field Name="Phone"/>
    <Field Name="APN">wap.cingular</Field>
    <Field Name="Username"/>
    <Field Name="Password"/>
    <Field Name="AlwaysOn">
    0</Field>
    </Group>
    But keep in mind that you have to maintain the xml structure around this.
    ~josef

  • Write Out a DOM as an XML File in "pretty format"

    Hi all,
    I am using javax.xml.transform.Transformer to Write Out a DOM as an XML File. (URL: http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JAXPXSLT4.html) It runs very well but in the XML output, it is not "format".
    I means, for example, there are a line like (on one line):
    <p>Bonjour Madame, Monsieur,</p><p>Voici LOT<strong><label>LOT.VPLOT_CODE</label></strong>�du batiment<strong><label>BATIMENT.VPBAT_CODE</label></strong>�</p>
    I would like to output like the IE show:
    <p>Bonjour Madame, Monsieur,</p>
    <p>Voici LOT
    <strong>
    <label>LOT.VPLOT_CODE</label>
    </strong>
    du batiment
    <strong>
    <label>BATIMENT.VPBAT_CODE</label>
    </strong>
    </p>
    How can I set properties for that, please?
    thanks a lot
    best regards
    Hai

    change System.out.print
    to System.out.println
    or insert "\n" whenever to want to start a new line"
    for instance:
    System.out.print("this line one.\nThis is line two");
    will print
    This is line one.
    This is line two
    or you can do
    System.out.println("This is line one.");
    System.out.println("this is line two");

  • How to convert DOM Tree in XML File

    Hi there,
    I am successful to build a DOM tree in memory where i am adding elements. Now after all this i want to make a XML file of that DOM representation. Now, i am confused with my code that how to transfer DOM structure to xml file ? A small code is attached herewith ?
    doc = db.newDocument();
                   doc.normalizeDocument();
                   doc.setXmlVersion("1.0");
                   doc.createComment("Created By: Sachin Kulkarni");
                   Element rn = doc.createElement("RootNode");
                   Element n1 = doc.createElement("A1");
                   ((Node)n1).setNodeValue("Element A1");
                   Element n11 = doc.createElement("A11");
                   ((Node)n11).setNodeValue("Element A11");
                   Element n12 = doc.createElement("A12");
                   ((Node)n12).setNodeValue("Element A12");
                   ((Node)n1).appendChild( ((Node)n11) );
                   ((Node)n1).appendChild( ((Node)n12) );
                   Element n2 = doc.createElement("A2");
                   ((Node)n2).setNodeValue("Element A2");
                   Element n3 = doc.createElement("A3");
                   ((Node)n3).setNodeValue("Element A3");
                   ((Node)rn).appendChild( ((Node)n1) );
                   ((Node)rn).appendChild( ((Node)n2) );
                   ((Node)rn).appendChild( ((Node)n3) );
    //creating the xml file
                   Source source = new DOMSource((Element) doc.getElementsByTagName("RootNode").item(0));
                   StringWriter out = new StringWriter();
                   StreamResult result = new StreamResult(out);
                   Transformer transformer = TransformerFactory.newInstance().newTransformer();
                   transformer.setOutputProperty("encoding", "iso-8859-1");
                   transformer.setOutputProperty("indent", "yes");
                   //transformer.setOutputProperty("test.xml","1");
                   //transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
                   transformer.transform(source,result);
                   result.getWriter().toString();
    ==================
    Is it any problem with the implementation ? How to use fileoutputstream with this ?

    I have done like this:
    DocumentBuilderFactory docBuildFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = docBuildFactory.newDocumentBuilder();
    Document doc = builder.newDocument();
    Element root = (Element)doc.createElement("Root");
    doc.appendChild(root);
    Element address = (Element)doc.createElement("Address");
    address.appendChild((Element)doc.createElement("Street"));
    address.appendChild((Element)doc.createElement("PostCode"));
    address.appendChild((Element)doc.createElement("Town"));
    Element country = (Element)doc.createElement("Country");
    country.setAttribute("type","EU");
    Text cname = doc.createTextNode("Spain");
    country.appendChild(cname);
    address.appendChild(country);
    root.appendChild(address);
    TransformerFactory tranFactory = TransformerFactory.newInstance();
    Transformer aTransformer = tranFactory.newTransformer();
    aTransformer.setOutputProperty(OutputKeys.INDENT, "yes");
    Source src = new DOMSource(doc);
    Result dest = new StreamResult(new FileOutputStream(new File("test.xml")));
    aTransformer.transform(src, dest);

  • How do I marshall a list using javax.xml.bind.annotation?

    Hopefully this is so simple a cave man could do it.
    I had to remove the Duke Stars for the time being. I found another bug in the program that may have resulted in my array being empty.
    I'm trying to marshall a standalone document of my DeckImpl class. It is a deck of cards of course. It contains an array of CardImpl objects that need to be marshalled too. I could not figure out how to marhall the array so I have a marshall(Marshaller m) method that will
    initialize the List (see below) with an ArrayList. I figured the marshaller would do the rest but I just get the declaration and a closed <DECK />tag with the correct attributes (see way below) when I comment out the @XmlElementWrapper, or a DECK root node that simply contains a closed <CARDS /> tag with the line enabled. You can see tha CardImpl class is annotated too.
    I must be missing something obvious. Please help.
    @XmlRootElement(name = "DECK")
    @XmlType(name = "DECK")
    public class DeckImpl implements Comparable<DeckImpl> {
        @XmlAttribute
        public int id;
        @XmlAttribute
        public boolean isShuffled;
        @XmlAttribute
        public boolean isCut;
        public CardImpl[] cards;
        @XmlElementWrapper(name="CARDS")
        @XmlElements(@XmlElement(name="CARD",type=CardImpl.class))
        public List<CardImpl> CARDS;
        private static JAXBContext context;
        private static Marshaller marshaller;
    public DeckImpl(int id, boolean isCut, boolean isShuffled,
                CardImpl[] cards) {
            this.id = id;
            this.isShuffled = isShuffled;
            this.isCut = isCut;
            this.cards = cards;
            try {
                context = JAXBContext.newInstance(DeckImpl.class);
                marshaller = context.createMarshaller();
            } catch (JAXBException ex) {
                Logger.getLogger(CardImpl.class.getName()).log(Level.SEVERE, null, ex);
    //... class code goes here
    /** Generates XML representation of a deck
         * @param writer
         * @throws javax.xml.bind.JAXBException
        public void marshall(Writer writer) throws JAXBException {
            CARDS = new ArrayList<CardImpl>(cards.length);
            for (CardImpl i : cards) {
                CARDS.add(i);
            marshaller.marshal(this, writer);
    @XmlType(name = "CARD")
    public class CardImpl implements Comparable<CardImpl> {
        @XmlElement(name = "NAME")
        public String name;
        @XmlElement(name = "SUIT")
        public String suit;
        @XmlAttribute
        public int value;
        @XmlAttribute
        public int pointValue;
    //... class code
    }The output is:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?><DECK isCut="false" isShuffled="true" id="1"/>Regards,
    Bill
    Edited by: bthayer on Jan 24, 2009 7:15 AM
    Edited by: bthayer on Jan 25, 2009 7:02 AM

    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)

  • Can we use javax.xml.parser API's from j2sdk kit?

    Hi All,
    I am new to this jaxp API's and my first doubt is Can I use the javax.xml.parser API which come bundled with j2sdk-1.4.1 or Should I install JWSDP-1.3 to get to javax.xml.parsers API?
    Thanks

    Hi,
    I am trying to read an xml file on Solaris.
    Can we not use doc.getElementById(String elementID) after deriving doc obejct ?
    Here is the code I am trying to use:
    try
    factory = DocumentBuilderFactory.newInstance();
    factory.setValidating(false);
    File file = new File("/command/parse_doc.xml");
    doc = factory.newDocumentBuilder().parse(file); //upto here it works
    Element element = doc.getElementById("Topics");
    String name = element.getTagName(); //returns nothing but throws exception "null"
    }catch(Exception exe){
    out.println("Exception:" + exe.getMessage());}
    here I get no such element, and the try catch block exception also null.
    Is there something I am missing?
    DO I have to call doc.getDocumentElement() before I call get ElementBy ID() and if so why?
    Thanks.

  • Webservices using xmlrpc which uses javax.xml package

    Hi
    Can any one Tell me how to write a Webservice using xmlrpc
    but which doesnt have org.apache or either helma package or jars
    I need to achieve it using j2ee jars
    eg: javax.xml.rpc
    I dont want SOAP to be involved in it.....
    Can any one tell me the useful links or sample code related to this topic
    Thank you
    Geetanjalee

    HI Geetanjale,
    If you aren't going to use SOAP as your message exchange protocol, then you can't do it with WS.
    Cheers
    Sai Pradeep

  • Writing XML file using javax.xml package

    I am writing an XML file with the foll piece of code:
    public static void writeXmlFile(Document doc, String filename) {
    try {
    // Prepare the DOM document for writing
    Source source = new DOMSource(doc);
    // Prepare the output file
    File file = new File(filename);
    Result result = new StreamResult(file);
    // Write the DOM document to the file
    Transformer xformer = TransformerFactory.newInstance().newTransformer();
    xformer.transform(source, result);
    } catch (TransformerConfigurationException e) {
    } catch (TransformerException e) {
    In this case above, the whole Document has to be passed to create a new DOMSource. is there any way where in I can pass the individual Nodes to the DOMSource ?
    I want the Nodes to be written one by one as writing the whole document is giving me a OutOfMemoryError (I have about a million records to be written in the XML file).
    Any help would be greatly appreciated

    I am writing an XML file with the foll piece of code:
    public static void writeXmlFile(Document doc, String filename) {
    try {
    // Prepare the DOM document for writing
    Source source = new DOMSource(doc);
    // Prepare the output file
    File file = new File(filename);
    Result result = new StreamResult(file);
    // Write the DOM document to the file
    Transformer xformer = TransformerFactory.newInstance().newTransformer();
    xformer.transform(source, result);
    } catch (TransformerConfigurationException e) {
    } catch (TransformerException e) {
    In this case above, the whole Document has to be passed to create a new DOMSource. is there any way where in I can pass the individual Nodes to the DOMSource ?
    I want the Nodes to be written one by one as writing the whole document is giving me a OutOfMemoryError (I have about a million records to be written in the XML file).
    Any help would be greatly appreciated

  • Java PI7.1 mapping and standalone NWDS debugging using local XML files

    >>which can be debugged in standalone NWDS using local files.
    yes its possible...u just have to add static void main (as sugested in the blog) ..
    Note: i dont have a system as of now..so i guess there can be some sysntax errors. Please check.
    create input xml file with name "input.xml" and place it under "D" drive (it can be any location)
    package prasad.NewAPI;
    import java.io.IOException;
    import java.io.InputStream;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.w3c.dom.Document;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import com.sap.aii.mapping.api.AbstractTransformation;
    import com.sap.aii.mapping.api.StreamTransformationException;
    import com.sap.aii.mapping.api.TransformationInput;
    import com.sap.aii.mapping.api.TransformationOutput;
    * @author Prasad Nemalikanti
    public class NewAPIJavaMapping extends AbstractTransformation {
    public static void main(String[] args) {
              try{
                   NewAPIJavaMapping javaMapping =new NewAPIJavaMapping();
                   FileInputStream in=new FileInputStream("D:\\input.xml");
                   FileOutputStream out=new FileOutputStream("D:\\output.xml");
                   javaMapping.execute(in,out);
                   catch(Exception e)
                   e.printStackTrace();
       String result="";
      /* The transform method which must be implemented */
      public void transform(TransformationInput in,TransformationOutput out) throws StreamTransformationException
        InputStream instream = in.getInputPayload().getInputStream();
      // String for constructing target message structure
        String fresult="<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
        fresult = fresult.concat("<ns0:MT_Customer xmlns:ns0=\"urn:newapi-javamapping\">");
        try{
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            DocumentBuilder builder = factory.newDocumentBuilder();
            Document doc = builder.parse(instream);
            traversingXML(doc);
         catch(Exception e){}
    fresult = fresult.concat(result);
    fresult = fresult.concat("</ns0:MT_Customer>");
    try{
      out.getOutputPayload().getOutputStream().write(fresult.getBytes());
      /* assigning the created target message to "TransformationOutput"*/
       catch(IOException e1){}
    /*DOM Parser */
    public void traversingXML(Node node)
       NodeList children = node.getChildNodes();
       for(int i=0;i<children.getLength();i++)
         Node child = children.item(i);
         short childType = child.getNodeType();
         if(childType==Node.ELEMENT_NODE)
                  String nodeName=child.getNodeName();
                  String targetNodeName=null;
                  if(nodeName.equals("Users"))
                   targetNodeName="Customers";
                  else if(nodeName.equals("ID"))
                   targetNodeName="CustomerID";
                  else if(nodeName.equals("UserName"))
                   targetNodeName="Name";
                  else if(nodeName.equals("City"))
                    targetNodeName="City";
                  else if(nodeName.equals("State"))
                    targetNodeName="State";
                  else if(nodeName.equals("Country"))
                    targetNodeName="Country";
                 if(targetNodeName!=null)
                  result=result.concat("<"+targetNodeName+">");
       traversingXML(child);
       if(targetNodeName!=null)
       result=result.concat("</"+targetNodeName+">");
         else if(childType==Node.TEXT_NODE)
           String nodeValue = child.getNodeValue();
           result = result.concat(nodeValue);

    I have tested this and it is working..please chk the same
    package com.test;
    import java.io.IOException;
    import java.io.*;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.w3c.dom.Document;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import com.sap.aii.mapping.api.AbstractTransformation;
    import com.sap.aii.mapping.api.StreamTransformationException;
    import com.sap.aii.mapping.api.TransformationInput;
    import com.sap.aii.mapping.api.TransformationOutput;
    public class JavaMapping extends AbstractTransformation {
           /* The transform method which must be implemented */
           public void transform(TransformationInput in,TransformationOutput out) throws StreamTransformationException
                this.execute(in.getInputPayload().getInputStream(),
                          out.getOutputPayload().getOutputStream());
           String result="";
           public void execute(InputStream in1, OutputStream out1)
          throws StreamTransformationException {
           // String for constructing target message structure
             String fresult="<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
             fresult = fresult.concat("<ns0:MT_Customer xmlns:ns0=\"urn:newapi-javamapping\">");
             try{
                 DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                 DocumentBuilder builder = factory.newDocumentBuilder();
                 Document doc = builder.parse(in1);
                 traversingXML(doc);
              catch(Exception e){}
          fresult = fresult.concat(result);
          fresult = fresult.concat("</ns0:MT_Customer>");
          try{
           out1.write(fresult.getBytes());
           /* assigning the created target message to "TransformationOutput"*/
            catch(IOException e1){}
          /*DOM Parser */
          public void traversingXML(Node node)
            NodeList children = node.getChildNodes();
            for(int i=0;i<children.getLength();i++)
              Node child = children.item(i);
              short childType = child.getNodeType();
              if(childType==Node.ELEMENT_NODE)
                       String nodeName=child.getNodeName();
                       String targetNodeName=null;
                       if(nodeName.equals("Users"))
                        targetNodeName="Customers";
                       else if(nodeName.equals("ID"))
                        targetNodeName="CustomerID";
                       else if(nodeName.equals("UserName"))
                        targetNodeName="Name";
                       else if(nodeName.equals("City"))
                         targetNodeName="City";
                       else if(nodeName.equals("State"))
                         targetNodeName="State";
                       else if(nodeName.equals("Country"))
                         targetNodeName="Country";
                       if(targetNodeName!=null)
                           result=result.concat("<"+targetNodeName+">");
            traversingXML(child);
            if(targetNodeName!=null)
                 result=result.concat("</"+targetNodeName+">");
              else if(childType==Node.TEXT_NODE)
                String nodeValue = child.getNodeValue();
                result = result.concat(nodeValue);
          public static void main(String[] args) {
                   try{
                        JavaMapping javaMapping =new JavaMapping();
                        FileInputStream in=new FileInputStream("D:\\Input.xml");
                        FileOutputStream out=new FileOutputStream("D:\\output.xml");
                        javaMapping.execute(in,out);
                        catch(Exception e)
                        e.printStackTrace();
    AM

  • A few questions about using an XML file to add text into a TextArea component set as html

    I'm using AS2 in Flash CS3.
    I have a TextArea component in the stage that's loading its text from an XML and I've been able to use the ul and li tags to create lists. However, when I try to include a nested list it just inserts a line break between the nested list and the main list rather than indent it further. Is there a solution for this issue?
    Failing that, how would I be able to add non-breaking spaces into the XML so they will render inside the TextArea component? I've tried   and &#160; without success. I scoured the net for some help with this and found some information about modifying the font embedding xml file with a new entry for the non-breaking space and that didn't work either, so that leaves me somewhat stumped.

    flash doesn't handle nested lists (as you now know).  you can work-around that limitation using css and creating your own indent styles.  css have a marginLeft property you can use.

  • How to "use" a xml file with a script?

    Hey Guys!
    I use the normal Button with the send-option to send the xml file to an url.
    My question is how it's possible to work in a php-script with the xml data out of the formular?
    Thanks for help.
    LG
    Adrian

    Hi,
    I need to read a XML document with StringReade class.
    My aplication receives an absolute path but this
    doesn't work:
    StringReader oStringReader =
    new StringReader(c:\java\libros.xml);
    However it works with:
    StringReader oStringReader =
    new StringReader("<?xml version="1.0" e......");
    ie, with the whole document as a String, but I need
    to do it as the frist way.
    Thankstake a look at this link:
    http://java.sun.com/webservices/jaxp/dist/1.1/docs/tutorial/sax/2a_echo.html

  • Using an XML file for server URL instead of hard coding

    I can't find a good example.
    Could someone give me an example of using a local XML file to set a server url variable so i don't have to hard code url's?
    This works and i can trace the xml file but how do i access the individual xml data nodes?
    protected function initApp():void
         var loader:URLLoader = new URLLoader(new URLRequest("config.xml"));
         loader.addEventListener(Event.COMPLETE,configLoadComplete);
    private function configLoadComplete(event:Event):void
         trace(event.target.data);

    Hi,
    <a href="foobar.xml">right click and select save as from the context menu</a>
    or
    write your xml data or a copy of it with a different extension (text) so that it is not parsed as application/xml-xhtml
    or
    Use AJAX to retrieve the xml file and display it as the textContent of a <textarea>
    window.open wraps the xml markup in html tags for display purposes.
    Rob^_^

Maybe you are looking for

  • Windows 7 x64 ***** on a macbook

    PLEASE HELP.... i'm in south america and a friend of mine bought a macbook (she actually returned one for a pc, then exchanged it back for a macbook again). this is a late 2009 white macbook (6.1) she's an architect and needs autocad, which is pc onl

  • App Store: Where's the DEMO versions?

    Hi All, Am I the ONLY one that think it should be a piece of cake for Apple to enable a 1-2 week demo period of apps from the App Store? I know, I know - it's only 1-5 bucks, but hey - maybe the app simply does not handle the data for Your country, o

  • Project as an Investment measure - Unable to settle

    Hi, Request help on the below situation. 1.We have created a project as an Investment project using tcode CJ20N and a WBS element in the project also. The WBS element when released, creates an AUC automatically. However the AUC created does not have

  • What's a good gaming laptop?

    College student here, in dire need of a new laptop.  I dropped my old one and the screen cracked.  Plus it's rather old and slowly starting to die on me. So with that said, I need a laptop for school, but I also need it to be able to run WoW and LoL.

  • SQL Query Executing longer time

    Hi , The below SQL query executing longer time . Please help to Improve the query performance. The query continuously running for more than 24 hours and failing with roolback segment error. Not getting the final output. Most of the tables are having