Hi Folks,
Can anyone point me at a simple taglib or process for parsing an absolutely
minimal XML file in JSP?
We're running tomcat 3.2.3 and everything seems geared to Tomcat 4.
Any help much appreciated.
> -----Original Message-----
> From: Vikramjit Singh [SMTP:[EMAIL PROTECTED]]
> Sent: Monday,6 May 2002 1:58
> To: [EMAIL PROTECTED]
> Subject: Re: How to insert data from HTML form to an XML file
>
> hi u can use the xerces parser which is freely downloadable.
> In the api u shall find methods for creating an XML file as
>
> import org.apache.xerces.parsers.DOMParser;
> import org.apache.xml.serialize.*;
> import org.apache.xml.serialize.OutputFormat;
> import org.apache.xml.serialize.XMLSerializer;
>
> import org.apache.xerces.dom.DocumentImpl;
> import org.apache.xerces.dom.NodeImpl;
> import org.apache.xerces.dom.ElementImpl;
> import org.apache.xerces.dom.AttrImpl;
> import org.apache.xerces.dom.NamedNodeMapImpl;
>
> // XML.jar
> import org.w3c.dom.NodeList;
> import org.w3c.dom.Node;
> import org.w3c.dom.Element;
>
>
> // These lines shall help u in ur code.
> domDoc = new DocumentImpl();
> Node root = domDoc.createElement("companyname");
> (Element) root).setAttribute("name" , "GTL");
> domDoc.appendChild(root);
>
> Node prodPrice = domDoc.createElement("price");
> Integer price = new Integer(rsCat.getInt("BW_PROD_PRICE"));
> Node productPrice = domDoc.createTextNode( "� "+ price.toString() );
> prodPrice.appendChild(productPrice);
> prodToBeAppended.appendChild(prodPrice);
>
> strUserNm = "c://data"+strUserNm+".xml";
>
> public void write()
> {
> try
> {
> strUserNm = "c://data.xml";
> FileOutputStream fos = new FileOutputStream(strUserNm);
> OutputFormat of = new OutputFormat();
> XMLSerializer slz=new XMLSerializer(fos, of);
> slz.serialize(domDoc.getDocumentElement());
> fos.close();
> }
> catch(Exception e)
> {}
> }
>
> Regards,
> Vikramjit Singh,
> Systems Engineer,
> GTL Ltd.
> Ph. 7612929-1031
>
>
> -----Original Message-----
> From: sbattul [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, May 05, 2002 2:52 PM
> To: [EMAIL PROTECTED]
> Subject: How to insert data from HTML form to an XML file
>
>
> Hi,
>
> I have JSP form from which I want to get data and insert into the XML
> file.
>
> I dont want to have a database and use my XML file as the database.
>
> Please help.
>
> Thanks.
>
> Srinivas
>
> ==========================================================================
> =
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://archives.java.sun.com/jsp-interest.html
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.jsp
> http://www.jguru.com/faq/index.jsp
> http://www.jspinsider.com
>
> ==========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://archives.java.sun.com/jsp-interest.html
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.jsp
> http://www.jguru.com/faq/index.jsp
> http://www.jspinsider.com
==========================================================================To
unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com