Problem in transforming the xml in applet

Hi guys
I am parsing and transforming an xml in applet. parsing is working fine but transform is giving error. I am using jaxp and jdk1.4 plugin for applet. The error is
Exception:
Output method is xml could not load output_xml.properties (check CLASSPATH)
org.apache.xml.utils.WrappedRuntimeException: Output method is xml could not load output_xml.properties (check CLASSPATH)
     at org.apache.xalan.templates.OutputProperties.getDefaultMethodProperties(OutputProperties.java:364)
     at org.apache.xalan.templates.OutputProperties.<init>(OutputProperties.java:130)
     at org.apache.xalan.transformer.TransformerIdentityImpl.<init>(TransformerIdentityImpl.java:104)
     at org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:804)
Code is
*********************code***********************************
TransformerFactory xformFactory = TransformerFactory.newInstance();
Transformer idTransform = xformFactory.newTransformer();
//create the Source object from document object
Source input = new DOMSource(doc);
StringWriter writer = new StringWriter();
Result output = new StreamResult(writer);
idTransform.transform(input, output);
xmlString = writer.toString();
*********************code***********************************
Hope some one get a solution

Hi
I am using the parsers & transformers that came with JDK 1.4.
i.e class org.apache.xalan.processor.TransformerFactoryImp
Thank you.
I solved that problem my making my applet signed.
Now it is working fine.

Similar Messages

  • Problem in rendering the XML using  XSLT in Netscape 7

    Hi there,
    I have used the XSLT to generate HTML codes from the XML datafiles.
    It works fine in Internet Explorer, but when I tried it on Netscape
    7.0 , it just displayed the xml data, without the tags..
    For example,
    In the xml ,I have the following :
    <id>11111111111111112</id>
    <name>adegf1</name>
    <date>Mar 24 2003Jan 01</date>
    In the IE, it was transformed into the html perfectly but
    when i used Netscape 7.0, it was displayed as the following in a single
    line:
    11111111111111112adegf1Mar 24 2003Jan 01
    Can anybody tell me how to overcome this ? Does the problem lie in the xml or the xslt ? I am using XSL Transform version 1.0 and XML version 1.0.
    Thanks in advance !
    Kirk

    Hello,
    The generated XML refers to the XSLT which is in the server.
    So, the browser's parsers affects the output..
    Any sugestions ?
    Thanks !

  • Get problem in loading the xml code

    Hi all,
    I have got one problem in program. </method >not get generates after method block.
    I want output like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <interface>
    ---<name>the name of package</name>
    ---<className>The name of class</className>
    ----<methods>
    ---------<name>the name of the method</name>
    ---------<returnType>the return type of the method</returnType>
    -----</methods>
    ----<methods>
    ---------<name>the name of the method22</name>
    ---------<returnType>the return type of the method22</returnType>
    ---------</methods>
    </interface>
    But the output comes like:
    <?xml version="1.0" encoding="UTF-8"?>
    <interface>
    ---<name>the name of package</name>
    ---<className>The name of class</className>
    ----<methods>
    ---------<name>the name of the method</name>
    ---------<returnType>the return type of the method</returnType>
    ---------<name>the name of the method22</name>
    ---------<returnType>the return type of the method22</returnType>
    ---------</methods>
    </interface>
    import java.io.File;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import org.w3c.dom.Document;
    import org.w3c.dom.DocumentFragment;
    import org.w3c.dom.Node;
    public class TryXML
         public static void main(String args[])
              try
                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                DocumentBuilder parser = factory.newDocumentBuilder();
                Document methoddoc = parser.parse(new File("methodinfo.xml"));
                Document packageDoc = parser.parse(new File("interface.xml"));          
                Node packagenameNode = packageDoc.getElementsByTagName("name").item(0);
                Node packageclassNode = packageDoc.getElementsByTagName("className").item(0);
                Node methodnode = packageDoc.getElementsByTagName("methods").item(0);
                packagenameNode.setTextContent("the name of package");
                packageclassNode.setTextContent("The name of class");
                Node nameNode = methoddoc.getElementsByTagName("name").item(0);
                Node returnTypeNode = methoddoc.getElementsByTagName("returnType").item(0);
                nameNode.setTextContent("the name of the method");
                returnTypeNode.setTextContent("the return type of the method");
                Node node = packageDoc.importNode(methoddoc.getDocumentElement(), true);
              // Create the document fragment node to hold the new nodes
              DocumentFragment docfrag = packageDoc.createDocumentFragment();
              // Move the nodes into the fragment
              while (node.hasChildNodes())
                  docfrag.appendChild(node.removeChild(node.getFirstChild()));
              methodnode.appendChild(docfrag);        
              nameNode.setTextContent("the name of the method22");
                returnTypeNode.setTextContent("the return type of the method22");
                node = packageDoc.importNode(methoddoc.getDocumentElement(), true);
              // Create the document fragment node to hold the new nodes
              docfrag = packageDoc.createDocumentFragment();
              // Move the nodes into the fragment
              while (node.hasChildNodes())
                  docfrag.appendChild(node.removeChild(node.getFirstChild()));
              methodnode.appendChild(docfrag);  
                DOMSource source = new DOMSource(packageDoc);
                StreamResult result = new StreamResult(System.out);
                TransformerFactory transformerFactory = TransformerFactory.newInstance();
                Transformer transformer = transformerFactory.newTransformer();
                System.out.println("This is the content of the XML document:\n");
                transformer.transform(source, result);
              catch (Exception e)
    Please help me.
    Thanks
    bunty

    Replace the following line:methodnode.appendChild(docfrag);with these lines:Node methodnode2 = packageDoc.createElement("methods");
    packageDoc.getDocumentElement().appendChild(methodnode2);
    methodnode2.appendChild(docfrag);The problem was that you omitted to create a new <methods> element for the document fragment to be inserted in, so it got inserted in the original <methods> element.

  • Transform the XML as a form in JSP

    I have a XML file containing mutiple choice question and answers. I want to transform it to JSP for clients to answer and submit. And my problem is, how can i write a checkbox form? Is it just like the HTML form?
    Thank you very much for your help!

    One way is:
    In xml file itself you can write.
    <question><form&gtyour question</question>
    Another way:
    While retrieving the xml data you push form tag

  • Transform the xml with ' and "

    HI,
    i am converting from one xml to anther xml using XSLT, in my output xml file &apos; values are replacing with ' symbols. i want &apos; values in my output xml file.
    my input xml file is
    <?xml version="1.0" encoding="UTF-8"?>
    <ARTICLE>
    <TITLE>A Sample Article123456&apos;123456&apos;</TITLE></ARTICLE>
    my xslt file is
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
    <xsl:output method="xml"/>
    <xsl:template match="/">
    <Message>
    <xsl:apply-templates/>
    </Message>
    </xsl:template>
    <xsl:template match="/ARTICLE/TITLE">
    <Sample><xsl:value-of select="/ARTICLE/TITLE" />
    </Sample>
    </xsl:template>
    </xsl:stylesheet>
    my java source code
    public class MessageGeneration
    public static void main(String []a)throws Exception
    Reader xmlSourceReader;
    Writer xmlResultWriter;
    xmlSourceReader = new InputStreamReader(new FileInputStream(
    "src/xml/message.xml"), "UTF-8");
    xmlResultWriter = new OutputStreamWriter(new FileOutputStream(
    "src/xml/outMessage.xml"), "UTF-8");
    TransformerFactory tranFactory = TransformerFactory.newInstance();
    Transformer transformer = tranFactory.newTransformer(source);
    StreamSource xmlSource1 = new StreamSource(xmlSourceReader);
    StreamResult xmlResult1 = new StreamResult(xmlResultWriter);
    transformer.transform(xmlSource1, xmlResult1);
    how can i get &apos; symbols in my out file.
    Thanks
    Dattu

    It isn't necessary to escape the apostrophes and quotes in the example you showed, although it isn't wrong to escape them either. Both are well-formed XML and they are equivalent. So that means you don't need to ask for them to be escaped, and therefore the XML philosophy implies you aren't allowed to ask for them to be escaped. Is there a particular reason you have to have them escaped?

  • Problem while running the xml report in concurrent program

    Hi,
    In EBS r12, we have requirement to have a standard report output in excel.
    I got the report's xml output to create the xml template (.RTF layout) using BI Publisher.
    I created the .RTF layout and it works fine on my laptop using Bi Publisher.. the xml loads into it and i can preview xml data on layout with all format (Excel, PDF...)
    I uploaded the layout to EBS, and assigned it to the standard report.
    I changed standard report out put to XML
    When i go to submit report request, the template is assigned with report and everything seems correct.
    But after i run the report.
    The report is Completed with Warning status.. and output is only XML with Error message :
    This XML file does not appear to have any style information associated with it. The document tree is shown below.
    The Log file says :
    Executing request completion options...
    ------------- 1) PUBLISH -------------
    Beginning post-processing of request 2350601 on node CLONE at 13-APR-2011 09:03:47.
    Post-processing of request 2350601 failed at 13-APR-2011 09:03:48 with the error message:
    One or more post-processing actions failed. Consult the OPP service log for details.
    ------------- 2) PRINT -------------
    Not printing the output of this request because post-processing failed.
    Finished executing request completion options.
    The manager log file of Output post processor shows as:
    Template code: LATE_PAID
    Template app: SQLAP
    Language: en
    Territory: 00
    Output type: EXCEL
    [9/21/11 10:59:39 AM] [UNEXPECTED] [1273372:RT4463274] java.io.FileNotFoundException: /data1/EBSR120/inst/apps/oravis_hschbscgn20076/logs/appl/conc/out/o4463274.out (No such file or directory)
         at java.io.FileInputStream.open(Native Method)
         at java.io.FileInputStream.<init>(FileInputStream.java:106)
         at oracle.apps.fnd.cp.opp.XMLPublisherProcessor.process(XMLPublisherProcessor.java:230)
         at oracle.apps.fnd.cp.opp.OPPRequestThread.run(OPPRequestThread.java:166)
    [9/21/11 10:59:39 AM] [1273372:RT4463274] Completed post-processing actions for request 4463274.
    [9/21/11 11:33:17 AM] [OPPServiceThread0] Post-processing request 4463327.
    [9/21/11 11:33:17 AM] [1273372:RT4463327] Executing post-processing actions for request 4463327.
    [9/21/11 11:33:17 AM] [1273372:RT4463327] Starting XML Publisher post-processing action.
    [9/21/11 11:33:17 AM] [1273372:RT4463327]

    I guess we should submit XML publisher request "XDOREPPB" in "After report trigger" to generate the report output. You can refer the below link for syntax for submission of the program.
    Re: Excel Output appears in IE after submitting XDOREPPB from backend
    This may be helpful if not please ignore it.

  • Problem in transforming XML to string using XSLT

    Hi there,
    I have a R/3 -> XI -> WebService scenario where the message from XI to webservice needs to be sent in document/wrapped mode (the message xml must be embedded in a string element) and this message needs to be digitally signed.
    We are using another webservice to sign the messages, also with the message being sent in a string. To transform the XML's into string and vice-versa, we are using XSLT (/people/michal.krawczyk2/blog/2005/11/01/xi-xml-node-into-a-string-with-graphical-mapping).
    The problem is that both the signer and the final webservice understand the special characters (like '<', '>', '&', '"' etc) in one way but the XSLT generates them in another way. For example, the character '<', in both webservices, is returned as "&#60;" but the XSL Transformation results in "&lt;".
    The problem now is that our messages are always being rejected because the signature is not being recognized as true, though we are almost 100% sure that it's being done correctly. The only possibility to the error that we found is this character mapping being done differently.
    So, it's like this:
    XI sends string to signer as "&lt;"
    XI receives string from signer as "&#60;"
    XI processes the message
    XI sends string to webservice as "&lt;"
    XI receives string from webservice (containing error message) as "&#60;"
    Is there a way of making the XSLT to return "&#60;" instead of "&lt;"?
    Thanks in advace,
    Henrique.

    For Java Mapping, you can refer this-
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii
    In Java Mapping, in the startdocument event , you need to check for the specialchars, and just repalce the value required.
    But, what i am thinking is , just try with Java functions inside the XSLT mapping instead of going for Java Mapping. You can call java functions from the XSLT. So before the document starts pasring, you need to replace the special characters. I did not try in XSLT like this.
    For this , you can think with this e.g
    /people/pooja.pandey/blog/2005/06/27/xslt-mapping-with-java-enhancement-for-beginners
    Regards,
    Moorthy

  • How to set the Xml Encoding ISO-8859-1 to Transformer or DOMSource

    I have a xml string and it already contains an xml declaration with encoding="ISO-8859-1". (In my real product, since some of the element/attribute value contains a Spanish character, I need to use this encoding instead of UTF-8.) Also, in my program, I need to add more attributes or manipulate the xml string dynamically, so I create a DOM Document object for that. And, then, I use Transformer to convert this Document to a stream.
    My problme is: Firstly, once converted through the Transformer, the xml encoding changed to default UTF-8, Secondly, I wanted to check whether the DOM Document created with the xml string maintains the Xml Encoding of ISO-8859-1 or not. So, I called Document.getXmlEncoding(), but it is throwing a runtime error - unknown method.
    Is there any way I can maintain the original Xml Encoding of ISO-8859-1 when I use either the DOMSource or Transformer? I am using JDK1.5.0-12.
    Following is my sample program you can use.
    I would appreciate any help, because so far, I cannot find any answer to this using the JDK documentation at all.
    Thanks,
    Jin Kim
    import java.io.*;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.w3c.dom.Attr;
    import org.xml.sax.InputSource;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Templates;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerException;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.TransformerConfigurationException;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.Source;
    import javax.xml.transform.stream.StreamSource;
    import javax.xml.transform.stream.StreamResult;
    public class XmlEncodingTest
        StringBuffer xmlStrBuf = new StringBuffer();
        TransformerFactory tFactory = null;
        Transformer transformer = null;
        Document document = null;
        public void performTest()
            xmlStrBuf.append("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n")
                     .append("<TESTXML>\n")
                     .append("<ELEM ATT1=\"Yes\" />\n")
                     .append("</TESTXML>\n");
            // the encoding is set to iso-8859-1 in the xml declaration.
            System.out.println("initial xml = \n" + xmlStrBuf.toString());
            try
                //Test1: Use the transformer to ouput the xmlStrBuf.
                // This shows the xml encoding result from the transformer which will change to UTF-8
                tFactory = TransformerFactory.newInstance();
                transformer = tFactory.newTransformer();
                StreamSource ss = new StreamSource( new StringBufferInputStream( xmlStrBuf.toString()));
                System.out.println("Test1 result = ");
                transformer.transform( ss, new StreamResult(System.out));
                //Test2: Create a DOM document object for xmlStrBuf and manipulate it by adding an attribute ATT2="No"
                DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
                DocumentBuilder builder = dfactory.newDocumentBuilder();
                document = builder.parse( new StringBufferInputStream( xmlStrBuf.toString()));
                // skip adding attribute since it does not affect the test result
                // Use a Transformer to output the DOM document. the encoding becomes UTF-8
                DOMSource source = new DOMSource(document);
                StreamResult result = new StreamResult(System.out);
                System.out.println("\n\nTest2 result = ");
                transformer.transform(source, result);
            catch (Exception e)
                System.out.println("<performTest> Exception caught. " + e.toString());
        public static void main( String arg[])
            XmlEncodingTest xmlTest = new XmlEncodingTest();
            xmlTest.performTest();
    }

    Thanks DrClap for your answer. With your information, I rewrote the sample program as in the following, and it works well now as I intended! About the UTF-8 and Spanish charaters, I think you are right. It looks like there can be many factors involved on this subject though - for example, the real character sets used to create an xml document, and the xml encoding information declared will matter. The special character I had a trouble was u00F3, and somehow, I found out that Sax Parser or even Document Builder parser does not like this character when encoding is set to "UTF-8" in the Xml document. My sample program below may not be a perfect example, but if you replaces ISO-8859-1 with UTF-8, and not setting the encoding property to the transfermer, you may notice that the special character in my example is broken in Test1 and Test2. In my sample, I decided to use ByteArrayInputStream instead of StringBufferInpuptStream because the documentation says StringBufferInputStream may have a problem with converting characters into bytes.
    Thanks again for your help!
    Jin Kim
    import java.io.*;
    import java.util.*;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.w3c.dom.Attr;
    import org.xml.sax.InputSource;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Templates;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerException;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.TransformerConfigurationException;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.Source;
    import javax.xml.transform.stream.StreamSource;
    import javax.xml.transform.stream.StreamResult;
    * XML encoding test for Transformer
    public class XmlEncodingTest2
        StringBuffer xmlStrBuf = new StringBuffer();
        TransformerFactory tFactory = null;
        Document document = null;
        public void performTest()
            xmlStrBuf.append("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n")
                     .append("<TESTXML>\n")
                     .append("<ELEM ATT1=\"Resoluci�n\">\n")
                     .append("Special charatered attribute test")
                     .append("\n</ELEM>")
                     .append("\n</TESTXML>\n");
            // the encoding is set to iso-8859-1 in the xml declaration.
            System.out.println("**** Initial xml = \n" + xmlStrBuf.toString());
            try
                //TransformerFactoryImpl transformerFactory = new TransformerFactoryImpl();
                //Test1: Use the transformer to ouput the xmlStrBuf.
                tFactory = TransformerFactory.newInstance();
                Transformer transformer = tFactory.newTransformer();
                byte xmlbytes[] = xmlStrBuf.toString().getBytes("ISO-8859-1");
                StreamSource streamSource = new StreamSource( new ByteArrayInputStream( xmlbytes ));
                ByteArrayOutputStream xmlBaos = new ByteArrayOutputStream();
                Properties transProperties = transformer.getOutputProperties();
                transProperties.list( System.out); // prints out current transformer properties
                System.out.println("**** setting the transformer's encoding property to ISO-8859-1.");
                transformer.setOutputProperty("encoding", "ISO-8859-1");
                transformer.transform( streamSource, new StreamResult( xmlBaos));
                System.out.println("**** Test1 result = ");
                System.out.println(xmlBaos.toString("ISO-8859-1"));
                //Test2: Create a DOM document object for xmlStrBuf to add a new attribute ATT2="No"
                DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
                DocumentBuilder builder = dfactory.newDocumentBuilder();
                document = builder.parse( new ByteArrayInputStream( xmlbytes));
                // skip adding attribute since it does not affect the test result
                // Use a Transformer to output the DOM document.
                DOMSource source = new DOMSource(document);
                xmlBaos.reset();
                transformer.transform( source, new StreamResult( xmlBaos));
                System.out.println("\n\n****Test2 result = ");
                System.out.println(xmlBaos.toString("ISO-8859-1"));
                //xmlBaos.flush();
                //xmlBaos.close();
            catch (Exception e)
                System.out.println("<performTest> Exception caught. " + e.toString());
            finally
        public static void main( String arg[])
            XmlEncodingTest2 xmlTest = new XmlEncodingTest2();
            xmlTest.performTest();
    }

  • HowTo Set the xml-stylesheet processing instruction node?

    Hi,
    Can anyone tell me via PLSQL XMLDOM object what method or attribute to set or howto specify the xml-stylesheet value at the time of generation of the xml document?
    eg
    <?xml version = '1.0'?>
    <?xml-stylesheet type="text/xsl" href="reporthtml.xsl"?>
    <Report>
    <Title>ABC Report</Title>
    </Report>
    Currently my XML just comes out as
    <?xml version = '1.0'?>
    <Report>
    <Title>ABC Report</Title>
    </Report>
    and I want to add the stylesheet reference....
    <?xml-stylesheet type="text/xsl" href="reporthtml.xsl"?>
    Any help is appreciated...

    A COTS product builds the XML and inserts the respective xsl (xml:stylesheet) file name to be used for transforming the xml. I am trying to interrupt this xml and make some updations on an element and finally send the updated xml to the stream.
    For the above process, I parse the input XML using DOMParser and update the elements (some internal elements). While I view the final XML that would be passed to the stream, I found the <?xml-stylesheet... PI is missing.
    I somehow managed using a temp fix by doing the below. I manually pulled the PI using document.getFirstChild().getNodeValue() and reconstructed the PI and inserted it to the outgoing XML. This needs to be done every time. This might run into problems when more than one PI is used in the XML.
    If the parsed XML could get the PI along with it the above problem could be resolved.
    Is there any property that could be set on the parser (prior to parsing) to resolve the issue?.

  • Loading, processing and transforming Large XML Files

    Hi all,
    I realize this may have been asked before, but searching the history of the forum isn't easy, considering it's not always a safe bet which words to use on the search.
    Here's the situation. We're trying to load and manipulate large XML files of up to 100MB in size.
    The difference from what we have in our hands to other related issues posted is that the XML isn't big because it has a largly branched tree of data, but rather because it includes large base64-encoded files in the xml itself. The size of the 'clean' xml is relatively small (a few hundred bytes to some kilobytes).
    We had to deal with transferring the xml to our application using a webservice, loading the xml to memory in order to read values from it, and now we also need to transform the xml to a different format.
    We solved the webservice issue using XFire.
    We solved the loading of the xml using JAXB. Nevertheless, we use string manipulations to 'cut' the xml before we load it to memory - otherwise we get OutOfMemory errors. We don't need to load the whole XML to memory, but I really hate this solution because of the 'unorthodox' manipulation of the xml (i.e. the cutting of it).
    Now we need to deal with the transofmation of those XMLs, but obviously we can't cut it down this time. We have little experience writing XSL, but no experience on how to use Java to use the XSL files. We're looking for suggestions on how to do it most efficiently.
    The biggest problem we encounter is the OutOfMemory errors.
    So I ask several questions in one post:
    1. Is there a better way to transfer the large files using a webservice?
    2. Is there a better way to load and manipulate the large XML files?
    3. What's the best way for us to transform those large XMLs?
    4. Are we missing something in terms of memory management? Is there a better way to control it? We really are struggling there.
    I assume this is an important piece of information: We currently use JDK 1.4.2, and cannot upgrade to 1.5.
    Thanks for the help.

    I think there may be a way to do it.
    First, for low RAM needs, nothing beats SAX. as the first processor of the data. With SAX, you control the memory use since SAX only processes one "chunk" of the file at a time. You supply a class with methods named startElement, endElement, and characters. It calls the startElement method when it finds a new element. It calls the characters method when it wants to pass you some or all of the text between the start and end tags. It calls endElement to signal that passing characters is over, and to let you get ready for the next element. So, if your characters method did nothing with the base-64 data, you could see the XML go by with low memory needs.
    Since we know in your case that the characters will process large chunks of data, you can expect many calls as SAX calls your code. The only workable solution is to use a StringBuffer to accumulate the data. When the endElement is called, you can decode the base-64 data and keep it somewhere. The most efficient way to do this is to have one StringBuffer for the class handling the SAX calls. Instantiate it with a big enough size to hold the largest of your binary data streams. In the startElement, you can set the length of the StringBuilder to zero and reuse it over and over.
    You did not say what you wanted to do with the XML data once you have processed it. SAX is nice from a memory perspective, but it makes you do all the work of storing the data. Unless you build a structured set of classes "on the fly" nothing is kept. There is a way to pass the output of one SAX pass into a DOM processor (without the binary data, in this case) and then you would wind up with a nice tree object with the rest of your data and a group of binary data objects. I've never done the SAX/DOM combo, but it is called a SAXFilter, and you should be able to google an example.
    So, the bottom line is that is is very possible to do what you want, but it will take some careful design on your part.
    Dave Patterson

  • How to store the XML data? file or database?

    i'm frustrate at it.
    If store XML data into files, then when i query any data,how can i search data using relationship as SQL?
    But if store XML data into database.How can i transform the xml data to the data table?
    Can any one give me an clear example.

    XML is perfect for data interchange and readability. However, to make it searchable you should resolve it properly into tables, in accordance of your own choice of model.
    1. Investigate the XML files and resolve the model
    <Person sex="male">John
    <Pet animal="dog">Doggy</Pet>
    <Pet animal="cat">Catty</Pet>
    </Person>
    2. Create the tables in your database, let one or several tables keep the raw xml for retrieval of original xml data.
    --- XMLDocument ---
    id XML_data
    --- Person ---
    id XML_Document_id sex name
    (foreign key)
    --- Pet ---
    id Person_id animal name
    (foreign key)
    3. Resolve data from the xml files and insert it into the database. Do this through your ContentHandler, or from your DOM model.
    --- XMLDocument ---
    id XML_data
    0 <Person>...</Person>
    --- Person ---
    id XML_Document_id sex name
    0 0 male John
    --- Pet ---
    id Person_id animal name
    0 0 dog Doggy
    1 0 cat Catty
    Gil

  • Problem in transforming xml data to HTML

    Hai all,
    I am new to J developer, I have generated XML data to transform to HTML.
    Below is my xsql file with the name 'simpleqry.xsql'
    <?xml version='1.0' ?>
    <page xmlns:xsql="urn:oracle-xsql" connection="java:comp/env/jdbc/testDS">
    <xsql:query max-rows="-1" tag-case="lower" null-indicator="no">SELECT EMPNO,ENAME,SAL FROM EMP WHERE SAL &gt;= 5000</xsql:query>
    </page>
    it is producing the XML datas
    Further I need to convert it into HTML
    so I generated xsl stylesheet in under META-INF with the name 'EmpDetails.xsl'
    <?xml version="1.0" encoding="UTF-8" ?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output encoding="ISO-8859-1" method="text/html" />
    <xsl:template match="/page">
    <html>
    <head>
    <title>Employee Results</title>
    </head>
    <body>
    <H2> EMPLOYEE QUERY RESULTS</H2>
    <h5><em> Following demonstrates XSQL query</em></h5>
    <table border="1" cellspacing="1" align="center">
    <tr bgcolor=" #F9F0C1">
    <th>EMP ID</th>
    <th>EMPLOYEE NAME</th>
    <th>SALARY</th>
    </tr>
    <xsl:for-each select="ROWSET/ROW">
    <tr>
    <td><xsl:value-of select="EMPNO"/></td>
    <td><xsl:value-of select="ENAME"/></td>
    <td><xsl:value-of select="SAL"/></td>
    </tr>
    </xsl:for-each>
    </table>
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>
    next I have added the following to simpleqry.xsql
    <?xml-stylesheet type="text/xsl" href="EmpResults.xsl" ?>
    so my simpleqry.xsql file look like this
    <?xml version='1.0' ?>
    <?xml-stylesheet type="text/xsl" href="C:\JDeveloper\mywork\Application1\querysql\public_html\WEB-INF\EmpDetails.xsl" ?>
    <page xmlns:xsql="urn:oracle-xsql" connection="java:comp/env/jdbc/testDS">
    <xsql:query max-rows="-1" tag-case="lower" null-indicator="no">SELECT EMPNO,ENAME,SAL FROM EMP WHERE SAL &gt;= 5000</xsql:query>
    </page>
    when I rerun my simpleqry.xsql file it not generating the output .
    My J developer version is 'Oracle IDE 11.1.2.0.38.60.17'
    I know I made it lengthy. I made it clear so that you can understand my problem clearly. Please explain me how to solve the above mentioned problem(To generate HTML from XML data)
    Thanks in advance.
    Regards,
    Uraja

    next I have added the following to simpleqry.xsql
    +<?xml-stylesheet type="text/xsl" href="EmpResults.xsl" ?>+
    so my simpleqry.xsql file look like this
    +<?xml version='1.0' ?>+
    +<?xml-stylesheet type="text/xsl" href="C:\JDeveloper\mywork\Application1\querysql\public_html\WEB-INF\EmpDetails.xsl" ?>+
    What is added is different from what is listed in the XSQL, the xsl is different, the path to xsl is different.
    Specify relative path for xsl.

  • Not Able to get to the values from applet while designing from xml

    Hi All,
    I have a new problem, and i am new to this one.
    Like I have an XML file.Where in i am able to design the applet while getting the values from the xml and i am able to store also.
    But the problem comes over here.I have given out a type field in xml.By validating the type field i am able to get Label(),TextField(),etc.,( whatever it is).While displaying i am giving only one single TextField in the init method and i am looping it up.so that i can get the no of text fields ,labels,text areas,etc.,
    so problem comes here.I am not able to get the values from those text fields.(only i am getting the last value.Last value is overwriting the old values.Now i am able to get the last value that i am giving it lastly.)
    So please can anyone give me some idea.As it is urgent to me and i have to submit urgently.
    Please help me out.And Thanks In Advance.

    Here is the sample code while designing the applet:
    String type = (String) typeList.get(j);
                             String option = (String) optionList.get(j);                                   
                             if(type.equals("text")){
                                  txtdisp = new TextField(15);
                                  leadcomp.add(txtdisp);     
    //                              txtdisp.addMouseMotionListener(this);}

  • XML..: Problem getting the data in the XML-file..

    I'm developing a flash-file for my customer to use when
    displaying list of products he's selling.
    His list of products is inside a XML-file and he want me to
    display an overview of the products inside a datagrid, so when you
    click on the product you're interested in the productinfo will be
    displayed.
    But.. I'm having problems grabbing the data I want as it
    seems to me that I have to use the unik ID's for each products to
    get the data I want. I've tried adding the unik ID-code to my
    action script but it still won't work.
    Here's a part of the XML-code:
    <Tooldata>
    <Store name="N/A" zipcode="0033450" city="N/A" url="N/A"
    phone="N/A" fax="N/A" email="N/A">
    <Tool unikID="5_0022" control="14" cmnd="update">
    <Toolgroupe>Hammer</Toolgroupe>
    <Brand>Knipps</Brand>
    <Model>K55_Knipps</Model>
    <Price>35€</Price>
    <Weight>N/A</Weight>
    <Soldout>0</Soldout>
    <Color>Red/Black</Color>
    <Images>
    <Images image="5_0022.jpg" prioritet="1" gen_id="16"
    desc="MainImage"/>
    <Images image="5_0022_1.jpg" prioritet="2" gen_id="16"
    desc="Image 1"/>
    <Images image="5_0022_2.jpg" prioritet="3" gen_id="16"
    desc="Image 2"/>
    <Images image="5_0022_3.jpg" prioritet="4" gen_id="16"
    desc="Image 3"/>
    </Images>
    Now, the code above is only one item/product. But there are
    several proucts listed in the XML-file and I find it hard to get
    the product and the product info that I want to be displayed.
    Here's my action script:
    var xmlLoader:URLLoader = new URLLoader();
    var xmlData:XML = new XML();
    xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
    xmlLoader.load(new URLRequest("ToolData.xml"));
    function LoadXML(e:Event):void {
    xmlData = new XML(e.target.data);
    ParseBildata(xmlData);
    function ParseTooldata(TooldataInput:XML):void {
    trace("XML Output");
    trace("------------------------");
    trace(TooldataInput.Store);
    If I want to trace the images I just write
    "trace(TooldataInput.Store.Images);
    But if I want to trace one unik tool it's impossible. Well,
    maybe not impossible.. I just don't know how to do just that.
    When you trace (TooldataInput.Store); you get all the tools
    at that store. But how do I trace only one tool using the unikID??
    Thanks a lot in advance!

    Ace,
    When using E4X if you have multiple nodes at the same level
    you should be able to access them as an XMLList. Looking at your
    XML you should be able to access each <Tool> node as:
    TooldataInput.Store.Tool[0];
    TooldataInput.Store.Tool[1];
    or as an entire list
    TooldataInput.Store.children()
    WL

  • Problems with and tags while reading the xml file

    Hi
    I am using the xml files in my project. The project uses Tomcat, JMS. The project is divided into some components which communicate with each oher thru JMS. The component for which I am responsible gets a dcoument object from the JMS which is a processed xml of the following format (the processing is done by the DBMS_XMLGEN package of oracle)
    <?xml version="1.0" encoding="UTF-8"?>
    <root>
    <filename>157_1000000001</filename>
    <querydata>
    <tabdata>
    <tabinfo>Tab-id3</tabinfo>
    <queryset>
    <query name="Fax">
    select a.ARLN_NAME,d.TICKETED_ORIGIN,d.TICKETED_DESTINATION, d.ENDORSEMENTS,to_char(d.DATE_OF_ISSUE,'DDMONYY') as DATE_OF_ISSUE ,d.EXCHANGE_DOC_TYPE,
                   d.PASSENGER_NAME,d.ORIG_ISS_AIRLINE,d.ORIG_DOC_NO,d.ORIG_PLACE_OF_ISSUE,
                   to_char(d.ORIG_DATE_OF_ISSUE,'DDMONYY'),d.ORIG_ISSUE_AGENT,d.CUR_OF_SALE,d.GROSS_FARE,d.EQUIV_CUR_OF_SALE,d.EQUIV_FARE,
                   d.PANDA_DEAL_CODE,d.ISI,d.reporting_date
                   from airline_master a,ticket_main d,ticket_conj e where d.doc_no = e.doc_no and d.iss_airline = e.iss_airline
                   and e.conj_doc_no = (select DOC_NO from TICKET_CONJ where CONJ_DOC_NO = 1000000001 and ISS_AIRLINE = 157)
                   and e.ISS_AIRLINE = 157 and d.iss_airline = a.ARLN_NUM_CODE
    </query>
    </queryset>
    </tabdata>
    </querydata>
    the function on my side is like this
    private void processMessage(ObjectMessage objmessage)
         Document XMLreqObject = (Document) objmessage.getObject();
         Element root = XMLreqObject.getRootElement();                
         String resultFilename = root.getChildText("filename");
         Element tabSet = root.getChild("querydata");//doesnt work
         ArrayList tabSetlist = new ArrayList(tabSet.getChildren ("tabdata"));//doesnt work
    The code commented with "doesnt work", is not working. What must be the problem ?
    Thanks in Advance
    Martin

    Okay. Your original example XML didn't include < or > which was rather confusing if that particular feature was supposed to be the cause of the problem. Also calling them "tags" was rather confusing since "tags" is the term for the things that come at the beginning and of an element, like this:<data>...</data>Anyway, I assume your theory is that documents that don't have < in a text element process correctly and documents that do have < in a text element get "stuck" in the parser? Well, from your original description the process appears to be:
    1. Create XML
    2. Parse it into a Document
    3. Send the Document via JMS
    4. Receive the Document via JMS
    5. Process it.
    And it's step 4 that is "stuck"? That would be my guess based on the code you posted.

Maybe you are looking for