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

Similar Messages

  • How to call the XML file as PrivateResourcePath in JSP

    Hi All,
    I want to call the layer-config.xml values in JSP dropdown list. How to call the XML file as PrivateResourcePath in JSP... please advise me if any solution.
    locaiton: dist/PORTAL-INF/layer-config.xml
      <?xml version="1.0" encoding="utf-8" ?>
    - <layer-config>
    - <system>
      <layer>Test</layer>
      <internal>true</internal>
      </system>
    - <system>
      <layer>Test1</layer>
      <internal>false</internal>
      </system>
    - <system>
      <layer>Test3</layer>
      <internal>false</internal>
      </system>
      </layer-config>
    Thanks in advance.

    Hi,
    The below link may help you.
    [Accessing image from dist/imgaes folder inside JSPDynpage Component;
    Regards,
    Suresh Bachimanchi

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

  • Changing the xml name for forms

    Hi,
    I am using XML forms. I am facing an issue with the autogenerated name of the document.
    I go to a folder ->new->form->choose an xml form, fill it up and save.
    The form gets saved and displayed with a autogenerated (long) name with the.xml extension.
    I am having 2 portals on which this is working.
    1. on one portal, if i click on the link to the .xml file, the file opens as an xml. Only when i choose edit from the context menu of the file the form opens in the edit mode
    2. in the other portal, if i click on the link to the file or choose edit from the context menu, the editable form opens
    I want know  a few things in this context:
    1. Can I choose the name of the xml form created without having to rename the file?
    2. Why is the form display different in two portals? Is this configured? If so, where?
    3. If i want to use a form only for news items and should not be accessible within folders, is it possible to do that? If yes, how?
    Could someone kindly help me with these queries?
    Best Regards,
    Vidhya

    HI
    If u create a forms in xml forms builder and if u dont reference name property from the property schema to any one of the label what u had created in your edit form then following warning occurs
    The Name property is not referenced. A GUID will be used as the XML file name.
    in this case whenu create further forms from the folder->new ->forms--->urform and when u store this form in the folder u can find something like this 5565656hdhdhhdh.xml
    instead if u create a name label in your edit form and reference it to property schema Name then u wont get the above warning message and when u store ur form in the folder then it will stored as for eg:comapany news i.e the value what the user had entered in the name field of edit form.
    I think this name field by default is set to mandatory ---> yes in the properties of the label , if not set then make it yes.
    Regards,
    Vijay.

  • How to specify the servlet in the ACTION field in FORM in jsp, html pages?

    I have problem when I return back to the page prova3.html from the servlet because in the address bar it give me this path:
    http://192.168.161.209:8988/Workspace3-Project1-context-root/servlet/servlet/Servlet1
    two times servlet/ why? and what I have to put in the action field?
    This is my form in page prova3.html:
    <form action="servlet/Servlet1" method="post" id="search" style="font: bold 80% Arial,sans-serif; color: #334d55;" >
    <input type="hidden" name="pagina" value="1"/>
         user<input name="username" type="text" size="10" style="font-size: 12px;"/> 
    password<input name="password" type="password" size="10" style="font-size: 12px;"/>
         <input name="login" type="submit" value="Login" style="font-size: 12px; font-family: Arial,sans-serif;"/>
    </form>
    The redirection form servlet to pages is:
    private void toProvaPage(HttpServletRequest request, HttpServletResponse response) throws
    ServletException, IOException {
    RequestDispatcher rd = getServletContext().getRequestDispatcher(
    "/prova.jsp");
    rd.forward(request, response);
    private void toIndexPage(HttpServletRequest request, HttpServletResponse response) throws
    ServletException, IOException {
    RequestDispatcher rd = getServletContext().getRequestDispatcher(
    "/prova3.html");
    rd.forward(request, response);
    Thanks, but I can solve this problem.

    This is my web.xml file where the mapping is specified, this is the thing that I can't understand.
    <web-app>
    <description>Empty web.xml file for Web Application</description>
    <display-name>public_html</display-name>
    <servlet>
    <servlet-name>Servlet1</servlet-name>
    <servlet-class>servlet.Servlet1</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>Servlet1</servlet-name>
    <url-pattern>/servlet1</url-pattern>
    </servlet-mapping>
    <session-config>
    <session-timeout>35</session-timeout>
    </session-config>
    <mime-mapping>
    <extension>html</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>txt</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    </web-app>
    Thanks

  • 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();
    }

  • Get data stored in xml of pdf-form itself at the runtime

    Hello,
    I generate a pdf form with some data includet e.g. firstname = dave. personID = 12345.
    all this data (import-parameter is a table) is "stored" in the xml of my form:
    <?xml version="1.0" encoding="UTF-8"?>
    <xfa:data xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">
       <data>
          <IF_TABLE_PERSON>
               <DATA xfa:dataNode="dataGroup">
                    <FIRSTNAME>Dave</RFIRSTNAME>
                   <PERSONID>12345</PERSONID>
    firstname is binded to a textfield therefore there is no problem to get it.
    because it is a table i could get the value in several ways:
    a) myFirstNameField.rawValue;
    b) this.resolveNode("$record.IF_TABLE_PERSON.DATA[1]").FIRSTNAME.value;
    The PartnerID must not be binded anywhere (no hidden fields!). The question is, how do i get the value of PERSONID directly from xml?
    xfa.datasests.data ..... ????
    Thanks!

    Just one more question to get it right:
    <xfa:data xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">
       <data>
          <IF_TABLE_PERSON>
             <DATA>
                <FIRSTNAME/>
                <PERSONID>
              </DATA>
             <DATA>
                <FIRSTNAME/>
                <PERSONID>
              </DATA>
          </IF_TABLE_PERSON>
    In case I want to get the content of IF_TABLE_PERSON -Tag I use xfa.datasets.data.data.IF_TABLE_PERSON.saveXML("pretty");
    I have tried to get through to PERSONID like this:
    xfa.datasets.data.data.IF_TABLE_PERSON.PERSONID.saveXML("pretty");  ---- it is undefined, because it is inside another DATA-tag and there are several of them
    So I have to use something like an array?!
    xfa.datasets.data.data.IF_TABLE_PERSON[1].PERSONID.saveXML("pretty");    --- doesn't work either
    What is the correct way to "loop" trough the schema in this case?

  • How to break up a huge XML file and generate serialized JSP pages

    I have a huge xml file, with about 100 <item> nodes.
    I want to process this xml file with pagination and generate jsp pages.
    For example:
    Display items from 0 to 9 on page 1 page1.jsp , 10 to 19 on page2.jsp, and so on...
    Is it possible to generate JSP pages like this?
    I have heard of Velocity but dont know if it will be the right technology for this kind of a job.

    Thank you for your reply, I looked at the display tag library and it looks pretty neat with a lot of features, I could definitely use it in a different situation.
    The xml file size is about 1.35 MB, and the size is unpredictable it could shrink or grow periodically depending on the number of items available.
    I was hoping to create a documentation style (static pages) of the xml feed instead of having 1 jsp with dynamic pages
    I was looking at Anakia : http://jakarta.apache.org/velocity/docs/anakia.html , may be it has features that enable me to create static pages but not very sure.
    I think for now, I will transform the xml with an xsl file and pass the page numbers as input parameters to the xsl file
    null

  • How to display XML file(as markup) in jsp page..?

    Hi All,
    * I have to display the XML file(as markup) in jsp page (Tree Format)....
    * My XML file is an java.io.file object , and how to view this XML file on my JSP page...........
    Thanks in Advance,
    JavaImran

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

  • Changing the XML Structure in "Submit as XML"

    Dear all,
    We have two PDF Templates which are submitted via a WebService using Submit as XML. For both templates we need the same structured XML output.
    Form 1 has the hierarchy like this (all subforms):
    Company
    Subsdiary
    Responsibles
    Footer
    so the xml looks like
    <creditrequest>
    <company>...</company>
    <subsdiary>...</subsdiary>
    <responsible>...</responsible>
    <footer>...</footer>
    </creditrequest>
    Form 2 has the hiearchy like this (all subforms):
    Responsibles
    Subsidiary
    Company
    Footer
    and the xml looks like
    <creditrequest>
    <responsible>...</responsible>
    <subsdiary>...</subsdiary>
    <company>...</company>
    <footer>...</footer>
    </creditrequest>
    So my question is how can influence the XML output order without changing the PDF hiearchy. This way I can change the XML output for Form 1 or Form 2 and both files would have the same XML structure to submit.
    I have checked the presubmit event and the javascript API to change XML string programmaticly but I couldn't find any possiblity to read/write the XML to submit.
    Thanks,
    Koray

    You can use JDOM and DOM. They are classes that load the XML File on memory and then you can modify it. I strongly recommend JDOM.

  • 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

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

  • How to call the XML file as Private

    Hi All,
    I want to call the layer-config.xml values in JSP dropdown list. How to call the XML file as PrivateResourcePath in JSP... please advise me if any solution.
    locaiton: dist/PORTAL-INF/layer-config.xml
      <?xml version="1.0" encoding="utf-8" ?>
    - <layer-config>
    - <system>
      <layer>Test</layer>
      <internal>true</internal>
      </system>
    - <system>
      <layer>Test1</layer>
      <internal>false</internal>
      </system>
    - <system>
      <layer>Test3</layer>
      <internal>false</internal>
      </system>
      </layer-config>
    Thanks in advance.

    Hi,
    The below link may help you.
    [Accessing image from dist/imgaes folder inside JSPDynpage Component;
    Regards,
    Suresh Bachimanchi

  • 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

Maybe you are looking for

  • How can I boot a linux live cd in my macbook pro 8,1

    I have a macbook pro 8,1 13inch. Whenever I attempt to boot from a linux live cd (ubuntu, kubuntu, gparted, knoppix) I get dropped to a busybox interface with a message that the live file system can not be found. I have tested the linux cd on a non a

  • Is it possible to use USB webcam + USB mic simultaneously?

    I would like to use a USB mic (Blue Snowball USB) and USB webcam (Ligoitch Quickcam) together simultaneously, because I understand the one is good sound and the other is good video for live internet broadcasting of music. can anyone tell me if this s

  • Dynamic password in FTP task in SSIS ?

    I can set almost all properties of FTP task and FTP connection manager using expressions option. In that option, I don't see that I can set FTP PASSWORD using a variable. How do I set the password dynamically ? Thanks.

  • SAP Spool Request Queries

    Hi all, I have few queries regarding spool in slap. I will be glad if some one can help me. 1. In SP01 what is the difference between print directly & print with changed parameters. 2. If a spool request is in waiting status for a long time, what doe

  • Hide Operators select box in Query Panel Advanced mode

    Hl All, I need to Hide all operators in the select Dropdown in the View Query Panel Advanced mode. Please help me. Thanks, Balaji Mucheli.