How to create a xml file from the jsp page?

I'm a beginner of the develop xml,my question like this,
there has a jsp page,some parameters in it,I wanna get the parameters and create a xml file,so,what parser method should I use?
And how to create a new xml file,when the file haven't exist at first?
pls give some code,thanks.

a ggod link for u http://www.theserverside.com/resources/article.jsp?l=JSP-XML2

Similar Messages

  • Is anyone know how to create dynamic pdf file from a JSP page or Servlet ?

    Hi
    Is any one know how to create a dynamic PDF file from JSP or servlet. I need to have standard form format needs to be created and want to send the info to that form dynamically.
    Is there any libraries available?
    Thanks

    I posted a link in this thread to a lib that lets you create PDFs from an app. They have a Java version. I have not used it but I know someone who used it with Microsoft ASP and they liked it.
    http://forum.java.sun.com/thread.jsp?forum=31&thread=287285
    -S-

  • Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the rows? Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the records?
    Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    The Oracle documentation has a good overview of the options available
    Generating XML Data from the Database
    Without knowing your version, I just picked 11.2, so you made need to look for that chapter in the documentation for your version to find applicable information.
    You can also find some information in XML DB FAQ

  • Creating an xml file from the Basic java Object

    how to create an XML file using the values available in the object with reference to an xsd or dtd file..
    (OR )
    is it possible to write the contents of an object to an xml file without knowing the dtd or xsd file .......

    how to create an XML file using the values available in the object with reference to an xsd or dtd file..
    (OR )
    is it possible to write the contents of an object to an xml file without knowing the dtd or xsd file .......

  • Writing XML file from a jsp page

    how can i write a xml file from my jsp and store the values and after sometime, for example when the user clicks on the submit button, i check the values from xml file and compare those values from the data base.
    it means both writing and reading xml file from a jsp page...
    urgent help needed......thanks

    You need some API like XSL or JDOM to read data from/to XML file
    you can get a best tutorial from
    http://www.javaworld.com/javaworld/jw-05-2000/jw-0518-jdom.html
    and
    http://www.javaworld.com/javaworld/jw-07-2000/jw-0728-jdom2.html
    after reading both articals you will be able to do both the tasks

  • How to create an XML file from scratch ?

    Hi all,
    I'm afraid that I will seem dummy, but I think I really misunderstand something or I'm trying to do something that is not possible...
    I would like to create a XML file containing the following:<?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="pl.xsl"?>
    <!DOCTYPE playlist SYSTEM "pl.dtd">
    <playlist id="2">
    </playlist>I really need to have both the stylesheet and the DOCTYPE declarations... Does anyone know if this is possible ?
    To create the XML Document, I am using the DocumentBuilder object from javax.xml package (jaxp-1.2-ea2). I think this, at least, is correct.
    To print out the XML document I have tried to use :
    - the Transformer from javax.xml package (jaxp-1.2-ea2) but I could obtain only the DOCTYPE declaration.
    - the Serializer from Xerces parser (version 2.0.1) to print out the Document I am creating with the jaxp, but I was able only to obtain the stylesheet declaration...
    So far I have just understand that there is a difference between Serializer and Transformer (one is serializing, and the other is transforming ;-)), but I couldn't figure out which one would be suitable to produce the XML file above...
    I would really appreciate if one could help me with that ;-)
    Thanks,
    Karau

    Could send me an example ?
    For the moment I am using Transformer in that way:
         TransformerFactory tfactory = TransformerFactory.newInstance();
         try {
             Transformer transformer = tfactory.newTransformer();
             DOMSource source = new DOMSource(playlistDoc.getDocumentElement());
             StreamResult res = new StreamResult(new File(path));
             transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, PL_DTD);
             transformer.setOutputProperty(OutputKeys.INDENT, "yes");
             transformer.transform(source, res);
         catch (TransformerConfigurationException tce) {
             throw tce;
         catch (TransformerException te) {
             throw te;
         }

  • How do I create individual xml files from the parsed data output of a xml file?

    I have written a program (DOM Parser) that parses data from a XMl File. I would like to create an individual file with the corresponding name for each set of data parsed from the xml document. If the parsed output is Single, Double, Triple, I would like to create an individual xml file (Single.xml, Double.xml, Triple.xml)with those corresponding names. How do I create the xml files and give each file the name of my parsed data output? Thanks in advance for your help.
    import java.io.IOException;
    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.SAXException;
    public class MyDomParser {
      public static void main(String[] args) {
      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
      try {
      DocumentBuilder builder = factory.newDocumentBuilder();
      Document doc = builder.parse("ENtemplate.xml");
      doc.normalize();
      NodeList rootNodes = doc.getElementsByTagName("templates");
      Node rootNode = rootNodes.item(0);
      Element rootElement = (Element) rootNode;
      NodeList templateList = rootElement.getElementsByTagName("template");
      for(int i=0; i < templateList.getLength(); i++) {
      Node theTemplate = templateList.item(i);
      Element templateElement = (Element) theTemplate;
      System.out.println("Template" + ": " +templateElement.getAttribute("name")+ ".xml");
      } catch (ParserConfigurationException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      } catch (SAXException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();

    Ive posted the new code but now I'm getting a FileAlreadyExistException error. How do I handle this exception error correctly in my code?
    import java.io.IOException;
    import java.nio.file.FileAlreadyExistsException;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    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.SAXException;
    public class MyDomParser {
      public static void main(String[] args) {
      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
      try {
      DocumentBuilder builder = factory.newDocumentBuilder();
      Document doc = builder.parse("ENtemplate.xml");
      doc.normalize();
      NodeList rootNodes = doc.getElementsByTagName("templates");
      Node rootNode = rootNodes.item(0);
      Element rootElement = (Element) rootNode;
      NodeList templateList = rootElement.getElementsByTagName("template");
      for(int i=0; i < templateList.getLength(); i++) {
      Node theTemplate = templateList.item(i);
      Element templateElement = (Element) theTemplate;
      System.out.println(templateElement.getAttribute("name")+ ".xml");
      for(int i=0; i < templateList.getLength(); i++) {
      Node theTemplate = templateList.item(i);
      Element templateElement = (Element) theTemplate;
      String fileName = templateElement.getAttribute("name") + ".xml";
      Files.createFile(Paths.get(fileName));
      System.out.println("File" + ":" + fileName + ".xml created");
      } catch (ParserConfigurationException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      } catch (SAXException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();

  • How to create an Xml File From DataBase?

    hi all
    i have two tables from my database :
    VoucherHeader and VoucherItem
     VoucherHeader has 4 fields:
    VoucherHeaderId
    bigint Unchecked
    VoucherNum bigint
    Unchecked
    VoucherDate nvarchar(50)
    Unchecked
    Comment nvarchar(50)
    Unchecked
    VoucherItem has 8 fields :
    VoucherItem bigint
    Unchecked
    VoucherHeaderRef
    bigint Unchecked
    Row bigint
    Unchecked
    Code1 bigint
    Unchecked
    Code2 bigint
    Unchecked
    ItemComment nvarchar(50)
    Unchecked
    Debit bigint
    Unchecked
    Credit bigint
    Unchecked
    and i fill datatable by this codes:
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Me.VoucherItemTableAdapter.Fill(Me.DataSet1.VoucherItem)
    Me.VoucherHeaderTableAdapter.Fill(Me.DataSet1.VoucherHeader)
    End Sub
    now i see this result:
    how to send data into an Xml File From DataGridView Header and Item?
    please help me
    thanks all.
    Name of Allah, Most Gracious, Most Merciful and He created the human

    One instruction.  But you do it from the dataset, not the DataGridView
    Me.DataSet1.WriteXml(FILENAME)
    There is a WriteXML method for a DataTable but it gives errors.  Since you dataset has two tables save bot into the same xml file.
    jdweng

  • How to create a xml file from String object in CS4

    Hi All,
    I want to convert a string object into an XML file using Javascript in Indesign CS4.
    I have done the following script. But it does not convert the namespaces for the xml elements with no value in it.
    var xml = new XML(string);
    The value present in string is "<level_1 xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>"
    When it is converted to xml, the value becomes "<level_1 xsi:nil="true"/>"
    On processing the above xml object, am getting an error like this "Uncaught JavaScript exception: Unbound namespace prefix."
    Kindly help.
    Thanks,
    Anitha

    Can you post more of the script?
    Are you getting the XML file from disk, or a string?

  • How to call an exe program from the JSP page?

    How to call and display the interface from a exe (residing on C: drive) on my JSP page. Our customers supplied us with an exe file and they want this to be incorporated on the JSP page that has other components also, like forms, etc. The interface of the program has to be displayed in specific co-ordinates on the JSP page. Any help is highly appreciated. Thanks in advance.

    Can't be done with JSP.
    JSP runs java on the SERVER only.
    All that gets to client is an HTML page. So all that
    you can do at the client is what an HTML page can do.
    Obviously that doesn't include running a file on the
    client machine.
    Take a look into Applets, or maybe ActiveX controls.Thanks for the reply.
    Any idea on how to use the ActiveX controls in this regard?

  • How to create an XML file from a given EDI file?

    Hi All,
    I am trying to write some BPEL processes that will be sending EDI Documents to Integration B2B using the AQs.
    BPEL works with XML data and finally enqueues it to the AQ IP_OUT_QUEUE. From there B2B will pick up and send to Trading partner. I have sample EDI documents but they are not xml. Can anyone tell me if i can convert these EDI docs to XML?
    Can the EDIFECS builder be of any use here?
    TIA,

    B2B adapter? I just want some test data. Finally the setup is going to be such that some xml is going to be posted to the B2B internal channel and then on it will translate and send to Trading Partner.

  • How to include a js file in the JSP page

    Hi
    i have included a script tag like the following in the JSP file
    <SCRIPT language="JavaScript">vDateFormat='mm/dd/yyyy';</SCRIPT>
    while deploying i am getting an error 'vDateFormat' unidentified
    Can any one help me

    under view put a new tag
    <f:view>
    <ui:script url="page.js"/>
    and thats it

  • Create a xml file from an internal table: CALL TRANSFORMATION

    Hello gurus,
    I want to create a xml file using data from scustom table. I will create an internal table and will select some records to it.
    I searched the forum and i discovered the call transformation, but when i execute the example program at the CALL TRANSFORMATION shows a dump screen.
    How we create a xml file from internal table??
    Please help me. I will mark the useful answers.

    I'm using if_ixml class to create xml documents
    TYPES: BEGIN OF xml_line,
             data(256) TYPE x,
           END OF xml_line.
    DATA: o_ixml          TYPE REF TO if_ixml,
          o_document      TYPE REF TO if_ixml_document,
          o_element       TYPE REF TO if_ixml_element,
          o_streamfactory TYPE REF TO if_ixml_stream_factory,
          o_ostream       TYPE REF TO if_ixml_ostream,
          o_renderer      TYPE REF TO if_ixml_renderer.
    DATA: t_xml_table     TYPE TABLE OF xml_line,
          v_xml_size      TYPE i.
    o_ixml = cl_ixml=>create( ).
    o_document = o_ixml->create_document( ).
    * The o_document have a set of methods to add elements, attributes, etc.
    o_element  = o_document->create_simple_element(
                      name = 'RootNode'
                      value = 'some text'
                      parent = o_document ).
    o_streamfactory = o_ixml->create_stream_factory( ).
    o_ostream = o_streamfactory->create_ostream_itable( table = t_xml_table ).
    o_renderer = o_ixml->create_renderer( ostream  = o_ostream document = o_document ).
    o_renderer->render( ).
    v_xml_size = o_ostream->get_num_written_raw( ).
    CALL METHOD cl_gui_frontend_services=>gui_download
      EXPORTING
        bin_filesize = v_xml_size
        filename     = 'C:a.xml'
        filetype     = 'BIN'
      CHANGING
        data_tab     = t_xml_table.

  • How to Generate a Java file for a JSP Page

    Hi ,
    I am using weblogic11 .
    I am working on a JSP page which nearly consists of 4000 lines of code.
    I need to debug the file , but weblogic server is not generating the java file for the JSP pages .
    Please let me know how can i genertae Java file for the jsp pages ??

    JSPs are compiled into servlets automatically and those classes are stored in WEB-INF/classes folder. Servlet engine handles servlets.

  • How I can create a XML file from java Aplication

    How I can create a XML file from java Aplication
    whith have a the following structure
    <users>
    <user>
    <login>anyName</login>     
    <password>xxxx</password>
    </user>
    </users>
    the password label must be encripted
    accept any suggestion

    Let us assume you have all the data from the jsp form in an java bean object..
    Now you want a xml file. This can be acheived in 2 ways
    1. Write it into a file using java.io classes. Say you have a class with name
    write("<name>"+obj.getName+</name>);
    bingo you have a flat file with the xml
    2. Use data binding to do the trick
    will recommend JiBx and Castor for the 2nd option
    Regards,
    Rajagopal

Maybe you are looking for