Xml string comparison

Hi All
I have 2 xml strings as shown below. (Each set is in a string)
<set>
<item table_name='tname1' column_name='colname1'>34</item>
<item table_name='tname1' column_name='colname2'>35</item>
<item table_name='tname3' column_name='colname1'>36</item>
<item table_name='tname1' column_name='colname4'>37</item>
<item table_name='tname2' column_name='colname1'>38</item>
<item table_name='tname1' column_name='colname5'>39</item>
</set>
<set>
<item table_name='tname1' column_name='colname1'>34</item>
<item table_name='tname1' column_name='colname2'>36</item>
<item table_name='tname3' column_name='colname1'>38</item>
<item table_name='tname1' column_name='colname4'>mmm</item>
<item table_name='tname2' column_name='colname1'>38</item>
<item table_name='tname1' column_name='colname5'>50</item>
</set>
I have a table with 3 fields:
TableName, ColumnName, Inc_Exc
tname1, column1, I
tname1, column2, E
tname3, column1, I
I need to write to a file that...
The two sets are identical if all fields in the table that has inc_exc flag set to I are same.
In the above example I have to say it is different because tname3 and column name1 has an include flag but has different values.
Please note that the sets would have been similar if tname3 and colname1 has same value. Even though other values may differ.
I do not have to take values for which there in entry in my database table.
Any ideas how to do this....
Code sample is appreciated, however if basic idea is given I can code it myself.
Thanks much
bib

But this is just basic Java programming, nothing XML-related.
if (lastChunk != prevChunk)Don't use == (or !=) to compare the contents of two String objects. Always use the equals() method, otherwise you are just comparing to see if they are (or aren't) the same object. Two different String objects can contain the same contents. In your case:
if (! lastChunk.equals(prevChunk))with the appropriate checks for null, if necessary.

Similar Messages

  • Fault in string comparisons?

    Hallo.
    I have the following problem. An XML file, encoded in ISO8859-2, should be presented in a table in a browser's window. The file is "one level deep", something like:
    <type>animal</type>
    <name>cat</name>
    <type>insect</type>
    <name>ant</name> ...and so on.
    The resulted table should be (its heading in bold):
    TYPE NAME
    animal cat
    insect ant
    I process the file using methods from 'org.w3c.dom.*' package and store all the strings (having polish national characters) in a table. The table is displayed correctly.
    Besides presentation of everything, the user should be able to select only certain rows from the table. To do this, he has input boxes (as many as the colums in the table) and can enter strings into them. These strings serve as filters. For example, after entering 'animal' in the first box only the first row of the table above should be displayed.
    Again, everything works fine, but only if the string entered doesn't contain polish characters. If it does - no one row is displayed.
    The application is made as a servlet with the XML file stored in the same server.The strings entered in the input boxes are displayed correctly (with polish characters). The caracters seem to be properly encoded (first the browser is set to use ISO8859-2, and, second, I see their values in the browser's address window when they are sent using GET). I tried PUT too - in vain.
    The polish characters in the test XML file were checked in hex editor and are surely encoded in ISO8859-2. The encoded type is declared in the files' header.
    So my questions are:
    1/ What is wrong?
    2/ What to do to correct it?
    Any suggestion(s) are highly appreciated.
    With many thanks in advance,
    L. Pankowski
    ([email protected])

    Sorry once more! Maybe the following version will be better?
    (By the way: Is it possible to remove improperly posted messages from the thread?)
    Regards,
    L.P.
    //from doGet method; doPost is the same as doGet
       DocumentBuilder builder;
       File f = new File("C:/servlets/test2.xml");
       try
          DocumentBuilderFactory factory
             = DocumentBuilderFactory.newInstance();
           factory.setValidating(true);
           factory.setIgnoringElementContentWhitespace(true);
          builder = factory.newDocumentBuilder();
    //Parse the content of the file as an XML document
    // and return a new DOM Document object..
       Document doc = builder.parse(f);
       Element root = doc.getDocumentElement();
       NodeList children = root.getChildNodes();
       int elementsNr = children.getLength();
    //Getting column names. Get the first one
    //and proceed until you find an identical one.
    //(there will be no more than 30 columns)
       String[] colNames = new String[30];
       Node first = children.item(0);
         Element firstElement = (Element)first;
         String firstColName = firstElement.getTagName();
         colNames[0] = firstColName;
         int n = 1;
         Node next = children.item(i);
         Element nextElement = (Element)next;
         String nextName = nextElement.getTagName();
         while (nextName != firstColName)
             colNames[n] = nextName;
             n++;
             next = children.item(i);
             nextElement = (Element)next;
             nextName = nextElement.getTagName();
          columnsNr = i;
          rowsNr = (int)elementsNr/columnsNr;
    //Array to put the strings that will be displayed
    // in the browser's table
          cells = new String[rowsNr][columnsNr];
    //Filling the array..
          for (n = 0; n <rowsNr ; n++)
             for (j = 0 ; j <columnsNr; j++)
                Node child = children.item(j+ n*columnsNr);
                Element childElement = (Element)child;
                Text textNode = (Text)childElement.getFirstChild();
                String text = textNode.getData().trim();
                cells[n][j] = text;
    //The content sent to the browser..
       response.setContentType("text/html; charset=iso-8859-2");
       PrintWriter out = response.getWriter();
       String title = "Library";
       out.println("<FORM method=\"POST\">");
       String napis = "To select certain rows fill in the fields and press" +
                            "<input type=\"submit\" value=\"Send\">";
       out.println(ServletUtilities.headWithTitle(title) +
                    "<BODY BGCOLOR=\"#FDF5E6\">\n" +
                    "<H5>" + napis + "</H5>\n");
       out.println("<H5>Empty field means don't care. To clear all the fields press <input type=\"reset\" value=\"Clear\"></H5>");
    //Getting elements of the filter..
    //The array to store elements of the filter sent from the browser
       String[] filterFields = new String[columnsNr];
    //Empty string means: don't check
       for (n = 0; n <columnsNr; n++)
          filterFields[n] = "";
       Enumeration sent = request.getParameterNames();
    //Not null fields' counter -
    // used to speed up the search of the matching rows (below)        
          k = 0;
       while (sent.hasMoreElements())
          String fieldName = (String)sent.nextElement();
          String fieldValue = request.getParameter(fieldName);
          if (fieldValue.length() > 0)
             n = 0;
             while (!fieldName.equals(colNames[n]))
             n++;
             filterFields[n] = fieldValue;
             k++;
    //Preparing and sending input fields of the filter..
       String filterBoxes = "";
    //Attempts to adjust the lengths of filter fields
    // to the resolution of the screen
       String dl = "size=\"" + (int)100/columnsNr + "%\"";
       for (n = 0; n <columnsNr; n++)
          filterBoxes = filterBoxes + "<input name=\"" + colNames[n] + "\"" + dl + "value=\"\">";
       filterBoxes = filterBoxes + "<BR>";
       out.println(filterBoxes);     
       out.println("</form>");
    //Forming and sending table header..
       String tableHeader = "";
       for (n = 0; n <columnsNr; n++)
          tableHeader = tableHeader + "<TH STYLE=\"width:1%;\">" + colNames[n];
       tableHeader = tableHeader + "</TH>";
       out.println("<TABLE BORDER=1>\n" + "<TR BGCOLOR=\"#FFAD00\">\n" + tableHeader);
    //Searching table rows matching the filter fields
    // and sending them to the browser..
    //n - row o the table being processed; j - column
       for (n = 0; n <rowsNr ; n++)
          j = 0;
          String row = "<TR>";
          boolean matches = true;
          int KCopy = k;
          while ((KCopy > 0) && matches)
          if (filterFields[j] == "")
             row = row + "<TD>" + cells[n][j];
             j++;
    //THIS IS WHERE THE STRING COMPARISON TAKES PLACE     
          else if ((filterFields[j]).equals(cells[n][j]))
               row = row + "<TD>" + cells[n][j];
               j++;
               KCopy--;
               else matches = false;
          if (matches)
             while (j < columnsNr)
              row = row + "<TD>" + cells[n][j];
              j++;
             out.println(row);
          out.println("<TABLE BORDER=1 ALIGN=\"CENTER\">\n" +
               "<TR BGCOLOR=\"#FFAD00\">\n" + "</BODY></HTML>");
    }

  • Converting SQL Server text field containing XML string to XI XML via JDBC

    Hello
    My client has a SQL Server database containing a field of type Text which contains an XML string e.g.
    <DispatchJob> <DispatchDateTime>2003-09-29T13:29:15</DispatchDateTime> <AssignedFSE>F118</AssignedFSE> <DispatchJobPurchase> <DealerID>14C5</DealerID> <DateOfPurchase>1997-10-01T00:00:00</DateOfPurchase> </DispatchJob>
    I am using JDBC to access this but could someone please recommend the best and easiest solution for converting this string to XI XML for subsequent mapping to BAPI or IDOC or ABAP Proxy and transmission to SAP. There are other fields as well in the database table so thoughts at the moment are to use a normal graphical message mapping followed by an XSL mapping. Will an XSL mapping be able to do this and if so is that the best solution?
    Also I need to do the reverse of this and take fields coming from SAP via BAPI,IDOC etc. and convert them to a single database table field as an XML string also via the JDBC adapter. What is the best way to do this. Could it be done simply with functions in the graphical mapping e.g. concatenate?
    Thank you in advance.
    Trevor

    Hi Michal
    Thanks for the prompt reply.
    I was anticipating XSLT for reading from the SQL Server database and converting the XML string.
    But how would you convert the individual fields from SAP into a single field as an XML string for storing in the SQL Server database? What approach would you use?
    Regards
    Trevor

  • Performance problem submitting big XML string parameter to the web service

    We deployed a web service on the OC4J via oracle.j2ee.ws.StatelessJavaRpcWebService . This web service takes one string as a parameter. The string contains XML. Evrything works great UNLESS input XML string reaches 5Mb in size. When it happens OC4J does something with it for about 10 minutes (yes, minutes) before it calls the web service method. At this time java.exe consumes 100% of CPU.
    WE tried to increase JVM heap size, stack size, etc, - no effect.
    Please, help!
    Thank you in advance,
    Vlad.

    Hi Sheldon,
    What i feel is that it's not been handled in your webservice if the parameter is null or "" <blank> space
    i just you to take care in webservice that if the parameter is null or "" pass the parameter null to the stored proc
    Regards
    Pavan

  • How can i read XML string in a loop???

    i changed xml file reader to xml string reader by
    looking around this and other forums.
    here is the code.
    public class XMLTester2 {
        public static void main(String[] args) {
            String s = "<firsttag><secondtag>123</secondtag></firsttag>";
            java.io.Reader reader = new java.io.StringReader(s);
            org.xml.sax.InputSource source = new org.xml.sax.InputSource(reader);
            org.w3c.dom.Document doc = null;
            javax.xml.parsers.DocumentBuilderFactory fact = javax.xml.parsers.DocumentBuilderFactory.newInstance();
            try {
                javax.xml.parsers.DocumentBuilder builder = fact.newDocumentBuilder();
                doc = builder.parse(source);
            } catch (javax.xml.parsers.ParserConfigurationException pce) {
            } catch (org.xml.sax.SAXException se) {
            } catch (java.io.IOException ioe) {
            } finally {
                try {
                    reader.close();
                } catch (java.io.IOException ignored) {
    }i put this stuff into a loop, but i always ends up
    having new in the loop.
                String inputLine = "Start";
                // define what's needed for XML messages
                Reader reader = new StringReader(inputLine);
                InputSource source = new InputSource(reader);
                Document doc = null;
                DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance();
                DocumentBuilder builder = null;
                Node xmlNode = null;
                try {
                    builder = fact.newDocumentBuilder();
                } catch (ParserConfigurationException pce) {
                // -->
                while ( (inputLine = in.readLine()) != null) {
                    System.out.println("readLine() : {" + inputLine + "}");
                    reader = new StringReader(inputLine);
                    source.setCharacterStream(reader);
                    try {
                        doc = builder.parse(source);
                    } catch (SAXException se) {
                        System.out.println("SAXException : " + se);
                        System.out.println("SAXException source : " + source.toString() );
                        se.printStackTrace();
                    } catch (IOException ioe) {
                        System.out.println("IOException : " + ioe);
                    } finally {
                        try {
                            reader.close();
                        } catch (IOException ignored) {
                    reader = null;i know putting new in the loop is VERY bad.
    i gotto get ride of this new from the loop.
    can anyone help me?

    i know putting new in the loop is VERY bad.
    i gotto get ride of this new from the loop.Don't design your application based on one-liners you heard somewhere. Do some timings to see if it matters. My guess would be that parsing an XML file would take a fair bit longer than creating a StringReader object. And you do need a new StringReader each time, they aren't reusable, so the alternatives are not obvious. And don't accept my guess about the timings, check it for yourself.

  • Getting Error while creating Document object  after  parsing XML String

    Hi All,
    I have been trying to parse an XML string using the StringReader and InputSource interface but when I am trying to create Document Object using Parse() method getting error like
    [Fatal Error] :2:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    seorg.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    Please find the code below which i have been experimenting with:
    import java.io.BufferedReader;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    import java.io.IOException;
    import java.io.StringReader;
    import java.util.List;
    import java.util.*;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.xml.sax.InputSource;
    import org.xml.sax.SAXException;
    import java.io.*;
    public class TestMain {
         public static void main(String[] args) {
              String file = "";
              file = loadFileContent("C:\\Test.xml");
              System.out.println("contents >> "+file);
              parseQuickLinksFileContent(file);
    public static void parseQuickLinksFileContent(String fileContents) {
    PWMQuickLinksModelVO objPWMQuickLinksModelVO = new PWMQuickLinksModelVO();
         try {
    DocumentBuilderFactory factory =           DocumentBuilderFactory.newInstance();
         DocumentBuilder builder = factory.newDocumentBuilder();
         StringReader objRd = new StringReader(fileContents);
         InputSource objIs = new InputSource(objRd);
         Document document = builder.parse(objIs); // HERE I am getting Error.
         System.out.println(document.toString());
    What is happening while I am using builder.parse() method ???
    Thanks,
    Rajendra.

    Getting following error
    [Fatal Error] :2:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    seorg.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.

  • Extracting elements from an xml string - org.apache.xerces.dom.DeferredText

    Hello all,
    I am new to xml, and I thought I had a handle on things until I got this problem...I am getting an xml string from the body of an e-mail message, and then I am trying to extract elements out of it. Here is an example xml string:
    <?xml version="1.0" encoding="UTF-8"?>
    <filterRoot>
       <filter action="MOVE" bool="AND" name="My Saved Filter" target="Deleted Items">
          <condition attribute="TO" bool="AND" contains="CONTAINS">
             <value>[email protected]</value>
             <value>[email protected]</value>
             <value>[email protected]</value>
             <value>[email protected]</value>
             <value>[email protected]</value>
          </condition>
       </filter>
    </filterRoot>I am trying to extract the <filter> element out and store it into a Vector of Elements (called, not surprisingly, filters). However, I am getting a class cast exception:
    java.lang.ClassCastException: org.apache.xerces.dom.DeferredTextImplIt is being called from where I trying to extract the <filter> in this way:
            filterRoot = doc.getDocumentElement(); // get topmost element
            NodeList list = filterRoot.getChildNodes();
            Vector newFilters = new Vector();
            debug("There are "+list.getLength()+" filters in document");
            for(int i=0; i<list.getLength(); i++) {
                Node n = list.item(i);
                debug("Node "+i+" getNodeValue() is "+n.getNodeValue());
                Element temp = (Element)n;
                newFilters.add(temp);
            }Perhaps my question is, how do I correctly get hold of the <filter> node so that I may cast it as an Element?
    thanks,
    Riz

    Yes, I already knew that it is not a bug.
    But, I got next step problem.
    I put "false" to "include-ignorable-whitespace" feature in xerces parser.
    But, I still found unnecessary TextNodes in my parser object.
    Feature link : http://xerces.apache.org/xerces-j/features.html.
    I use xerces-2_8_0.
    DOMParser parser = new DOMParser();
    parser.setFeature("http://apache.org/xml/features/dom/include-ignorable-whitespace", false);
    parser.parse(inputSource);
    document = ps.getDocument();
    System.out.println(document.getDocumentElement().getChildNodes().length()); // still wrong lengthIs tehre any example of usage this feature?
    What is default defination of white-space "\n "(enter with one space) or " "(juz white space) or something else?
    Thanks,

  • XML string from Java

    Hi
    I have requirement in which i have a jsp that i use to get information from users. I need to convert the info to XML data into a String , whihc i later use to pass as messages using AQ.
    I also have to, at a later point retreive the data from the XML String, update some information and recreate the XML string object with the new data.
    I do not want to use the XML SQL Utility as this could provide too costly in terms of database hits .
    Is there some XML Parser methods i can use to do the generation and retrieval of XML data into Strings.
    Thanks
    null

    Sort of hack but the way I did it was
    Convert to String:
    Construct a ByteArrayOutputStream
    print your documenet to this,
    and then call the toString() on the
    ByteArrayOutputStream.
    Convert from String to an XMLDocument:
    Construct a StringReader(String s)
    Construct a DOMParser and parse the
    StringReader.
    Hope this helps.
    null

  • How to get an XML string from a Java Bean without wrting to a file first ?

    I know we can save a Java Bean to an XML file with XMLEncoder and then read it back with XMLDecoder.
    But how can I get an XML string of a Java Bean without writing to a file first ?
    For instance :
    My_Class A_Class = new My_Class("a",1,2,"Z", ...);
    String XML_String_Of_The_Class = an XML representation of A_Class ?
    Of course I can save it to a file with XMLEncoder, and read it in using XMLDecoder, then delete the file, I wonder if it is possible to skip all that and get the XML string directly ?
    Frank

    I think so too, but I am trying to send the object to a servlet as shown below, since I don't know how to send an object to a servlet, I can only turn it into a string and reconstruct it back to an object on the server side after receiving it :
    import java.io.*;
    import java.net.*;
    import java.util.*;
    class Servlet_Message        // Send a message to an HTTP servlet. The protocol is a GET or POST request with a URLEncoded string holding the arguments sent as name=value pairs.
      public static int GET=0;
      public static int POST=1;
      private URL servlet;
      // the URL of the servlet to send messages to
      public Servlet_Message(URL servlet) { this.servlet=servlet; }
      public String sendMessage(Properties args) throws IOException { return sendMessage(args,POST); }
      // Send the request. Return the input stream with the response if the request succeeds.
      // @param args the arguments to send to the servlet
      // @param method GET or POST
      // @exception IOException if error sending request
      // @return the response from the servlet to this message
      public String sendMessage(Properties args,int method) throws IOException
        String Input_Line;
        StringBuffer Result_Buf=new StringBuffer();
        // Set this up any way you want -- POST can be used for all calls, but request headers
        // cannot be set in JDK 1.0.2 so the query string still must be used to pass arguments.
        if (method==GET)
          URL url=new URL(servlet.toExternalForm()+"?"+toEncodedString(args));
          BufferedReader in=new BufferedReader(new InputStreamReader(url.openStream()));
          while ((Input_Line=in.readLine()) != null) Result_Buf.append(Input_Line+"\n");
        else     
          URLConnection conn=servlet.openConnection();
          conn.setDoInput(true);
          conn.setDoOutput(true);           
          conn.setUseCaches(false);
          // Work around a Netscape bug
          conn.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
          // POST the request data (html form encoded)
          DataOutputStream out=new DataOutputStream(conn.getOutputStream());
          if (args!=null && args.size()>0)
            out.writeBytes(toEncodedString(args));
    //        System.out.println("ServletMessage args: "+args);
    //        System.out.println("ServletMessage toEncString args: "+toEncodedString(args));     
          BufferedReader in=new BufferedReader(new InputStreamReader(conn.getInputStream()));
          while ((Input_Line=in.readLine()) != null) Result_Buf.append(Input_Line+"\n");
          out.flush();
          out.close(); // ESSENTIAL for this to work!          
        return Result_Buf.toString();               // Read the POST response data   
      // Encode the arguments in the property set as a URL-encoded string. Multiple name=value pairs are separated by ampersands.
      // @return the URLEncoded string with name=value pairs
      public String toEncodedString(Properties args)
        StringBuffer sb=new StringBuffer();
        if (args!=null)
          String sep="";
          Enumeration names=args.propertyNames();
          while (names.hasMoreElements())
            String name=(String)names.nextElement();
            try { sb.append(sep+URLEncoder.encode(name,"UTF-8")+"="+URLEncoder.encode(args.getProperty(name),"UTF-8")); }
    //        try { sb.append(sep+URLEncoder.encode(name,"UTF-16")+"="+URLEncoder.encode(args.getProperty(name),"UTF-16")); }
            catch (UnsupportedEncodingException e) { System.out.println(e); }
            sep="&";
        return sb.toString();
    }As shown above the servlet need to encode a string.
    Now my question becomes :
    <1> Is it possible to send an object to a servlet, if so how ? And at the receiving end how to get it back to an object ?
    <2> If it can't be done, how can I be sure to encode the string in the right format to send it over to the servlet ?
    Frank

  • How to get XMP MetaData as an XML String in a process?

    Hi there,
    I have a process where I would like to export a documents XMP MetaData, manipulate the XMP MetaData and then import the MetaData again to the document.
    I thougt first I will use the service Name "XMPUtilityService" with the Service Operation "Export XMP" to export the XMP MetaData as a document.
    Hoewer I am not sure how to manipulate the output document from the Export XMP service.
    When I print out the document.toString() in a execute Script Service I get the following:
    <document state="active" senderVersion="0" persistent="false" senderPersistent="false" passivated="false" senderPassivated="false" deserialized="false" senderHostId="null" callbackId="0" senderCallbackId="0" callbackRef="null" isLocalizable="true" isTransactionBound="false" defaultDisposalTimeout="600" disposalTimeout="600" maxInlineSize="65536" defaultMaxInlineSize="65536" inlineSize="3440" contentType="null" length="-1"><cacheId/><localBackendId/><globalBackendId/><senderLocalBackendId/><senderGl obalBackendId/><inline><?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
    <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="A...</inline><senderPullServantJndiName/><attributes/></document>
    Actually I expected something like this:
    <?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
    <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.0-jc006 DEBUG-1.0, 2009 Jun 23 11:07:21-PDT">
       <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
          <rdf:Description rdf:about=""
                xmlns:pdf="http://ns.adobe.com/pdf/1.3/">
             <pdf:Producer>Adobe LiveCycle PDF Generator ES2</pdf:Producer>
          </rdf:Description>
          <rdf:Description rdf:about=""
                xmlns:xmp="http://ns.adobe.com/xap/1.0/">
             <xmp:ModifyDate>2010-04-20T20:43:59+02:00</xmp:ModifyDate>
             <xmp:MetadataDate>2010-04-20T20:43:59+02:00</xmp:MetadataDate>
          </rdf:Description>
          <rdf:Description rdf:about=""
                xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/">
             <xmpMM:DocumentID>uuid:0cf2c6c6-2fba-2b39-5fb6-33ad8ccf58aa</xmpMM:DocumentID>
             <xmpMM:InstanceID>uuid:187bc5a2-acb0-2fa9-711d-33ad8ccf58aa</xmpMM:InstanceID>
          </rdf:Description>
       </rdf:RDF>
    </x:xmpmeta>
    <?xpacket end="w"?>
    What do I need to do to get the XMPMeta data as an XML String from a document within a process?
    Thanks in advance!
    Paul

    Hi,
    thanks for the answer.
    I know that I can retrieve the XMPUtilityMetadata object, but this object provides only access to a few information suche as creator, subject, producer, etc.
    However I would like to retrieve the whole XML String of the XMP Metadata.
    How is this possible?
    Thanks.
    Paul

  • Xml string  to internal table = change  utf-8 to utf-16

    Hello Experts,
    I have a requirement to convert XML String to abap intrnal table .
    I have to get an xml file from application server using opendataset as
    ?<?xml version="1.0" encoding="utf-16" standalone=
    "yes"?><WPUBON01>## <IDOC BEGIN="1">## <EDI_DC
    40 SEGMENT="1">##
    while I am getting as
    <?xml version="1.0" standalone="yes"?>
    <WPUBON01>
    <IDOC BEGIN="1">
    Please advice how I can change the encoding to UTF-16 .
    sun

    Hello Experts,
    I have a requirement to convert XML String to abap intrnal table .
    I have to get an xml file from application server using opendataset as
    ?<?xml version="1.0" encoding="utf-16" standalone=
    "yes"?><WPUBON01>## <IDOC BEGIN="1">## <EDI_DC
    40 SEGMENT="1">##
    while I am getting as
    <?xml version="1.0" standalone="yes"?>
    <WPUBON01>
    <IDOC BEGIN="1">
    Please advice how I can change the encoding to UTF-16 .
    sun

  • XML string to XML parsing in JCD

    I have stored an XML file as a CLOB in the Oracle DB. While fetching this data into JCD using Oracle OTD, I am getting this CLOB field as a string containing the XML. Now I want to parse this XML string to XML, as I need to map the individual fields to an XSD OTD, which will be my output.
    Kindly suggest a way to achieve this.

    An XSD OTD has an unmarshalFromString() method:
    inputFormat.unmarshalFromString( strData );
    When putting the XML into the CLOB it could be a good idea to wrap an outputstream into a Writer object in order to make certain that the encoding is correct, depending how the data is represented. When retrieving CLOB data using getCharacterStream() you will get a Reader object where the encoding is already given.

  • Conversion of xml string to xml file

    To convert xml string to xml file in java i used
    Document XMLDoc=DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader("<root><main>Title</main></root&g t;")));
    But it is showing an error as InputSource cannot be resolved
    How to rectify this

    I assume you mean there is a compiler error? (It helps if you explain your problem instead of just giving a vague description of it.) It sounds like you have to import InputSource. You do know about the import statements that go at the beginning of a Java class, don't you?

  • XML : Transform DOM Tree to XML String in an applet since the JRE 1.4.2_05

    Hello,
    I build a DOM tree in my applet.
    Then I transform it to XML String.
    But since the JRE 1.4.2_05 it doesn't work.
    These lines failed because these variables became final:
    org.apache.xalan.serialize.CharInfo.XML_ENTITIES_RESOURCE = getClass().getResource("XMLEntities.res").toString();
    org.apache.xalan.processor.TransformerFactoryImpl.XSLT_PROPERTIES = getClass().getResource("XSLTInfo.properties").toString();The rest of the code :
    DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = domFactory.newDocumentBuilder();
    Document domXML = builder.newDocument();
    // I build my DOM Tree
    StringWriter xmlResult = new StringWriter();
    Source source = new DOMSource(domXML);
    Result result = new StreamResult(xmlResult);
    Transformer xformer = TransformerFactory.newInstance().newTransformer();
    xformer.setOutputProperty(javax.xml.transform.OutputKeys.INDENT,"yes");
    xformer.transform(source,result);Is there any other way to get an XML String from a DOM tree in an applet ?
    I'm so disappointed to note this big problem.

    Does anyone have an idea why I get this error message when try to use transform in an applet?
    Thanks...
    java.lang.ExceptionInInitializerError
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Unknown Source)
         at org.apache.xalan.serialize.SerializerFactory.getSerializer(Unknown Source)
         at org.apache.xalan.transformer.TransformerIdentityImpl.createResultContentHandler(Unknown Source)
         at org.apache.xalan.transformer.TransformerIdentityImpl.transform(Unknown Source)
         at matrix.CreateMtrx.SaveDoc(CreateMtrx.java:434)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at thinlet.Thinlet.invokeImpl(Unknown Source)
         at thinlet.Thinlet.invoke(Unknown Source)
         at thinlet.Thinlet.handleMouseEvent(Unknown Source)
         at thinlet.Thinlet.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: java.lang.RuntimeException: The resource [ XMLEntities.res ] could not load: java.net.MalformedURLException: no protocol: XMLEntities.res
    XMLEntities.res      java.net.MalformedURLException: no protocol: XMLEntities.res
         at org.apache.xalan.serialize.CharInfo.<init>(Unknown Source)
         at org.apache.xalan.serialize.SerializerToXML.<clinit>(Unknown Source)
         ... 28 more

  • How to parse XML string fetched from the database

    i want to parse the XML string which is fetched from the oracle database.
    i have inserted the string in xml format in the database. The type of the field in which it is inserted is varchart2.
    I am successfully getting it using jdbc, storing it in a String.
    Now it is appended with xml version 1.0 and string is ready for parsing.
    Now i am making following programming.
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document doc = Builder.parse(xmlString);
    Element root = doc.getDocumentElement();
    NodeList node = root.getElementsByTagName("product");
    But i am getting IOException at the statement
    Document doc = Builder.parse(xmlString);
    there fore i request u to kindly help me in solving this error.
    -regards
    pujan

    DocumentBuilder does not have a method parse with xml string as aparameter. The string should be a xml document uri.
    Convert xml string to StringReader.
    parse(new InputSource(new StringReader(xmlString)));

Maybe you are looking for

  • I see a white box on the app store when I wanted to download an app

    I wanted to download a specific app. When I wanted to download it from the app store I just see a plain white square in the middle and the app preview does not appear. Please help :(: Product: iPad. Mini

  • & in insert statement

    Hi, i've an insert into table(address) values (address) statement my problem is in the adress values. i've an entry of & which the oracle treats it as a parameter. when i'm running this in sql plus how could i solve this because it prompts me everyti

  • Turning off Password Login at Startup???

    ok so i used to live with my roommate now i am moved out and on my own, i want to turn off my passworded login like i used to have before i moved in for college, it used to just login no problem, all i did was go to System Preferences>Security and tu

  • I can't logon on OTN

    My username in OTN is [email protected], when I try to logon into my account the logon form tells me that password is wrong. I used the "Remind me my password" utility and the password that I receive is the same that I use to try logon on OTN. I've t

  • Why can't I install Final Cut Pro X on my second computer?

    I've bought and downloaded final cut on my main computer, but my second one (both iMacs!) can't download - App Store says I have to buy before I can download. By the way, before I upgraded to Mavericks, final cut was available for download. I did, ho