• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

query regarding xml-html transformation

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi friends,

i am doing xml-html transformation , the code for which is as mentioned below .

when i try reading the output string from the outputstream
the first line of the transformed stream is ALWAYS
"<?xml version="1.0" encoding="UTF-8"?>"


I've removed this line from both the xml & xsl files being used ..still i get this line in the transformed stream .
I need this line removed ...

Can ayone please suggest me the cause or the solution for this .

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(new InputSource(new StringReader(xmldata)));

URL url = getClass().getResource(xslFile);
java.io.InputStream in = url.openStream();

javax.xml.transform.TransformerFactory tFactory =
javax.xml.transform.TransformerFactory.newInstance();
javax.xml.transform.dom.DOMSource xmlSource =
new javax.xml.transform.dom.DOMSource(document);
javax.xml.transform.Source xslSource = new javax.xml.transform.stream.StreamSource(in);
javax.xml.transform.Transformer transformer = tFactory.newTransformer(xslSource);
javax.xml.transform.stream.StreamResult streamresult =
new javax.xml.transform.stream.StreamResult(new StringWriter());
transformer.transform(xmlSource, streamresult);


thx,
Shilpa
 
shilpa gupta gupta
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,

got the answer to it myself .

just need to add
<xsl:output omit-xml-declaration = "yes" />
to my stylesheet .

Edit Comment: Disabled smiles in this post.
- m
[ December 18, 2004: Message edited by: Madhav Lakkapragada ]
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Shilpa,

Hey are you the one from hamdard?

regards,
geetha

Originally posted by shilpa gupta gupta:
hi friends,

i am doing xml-html transformation , the code for which is as mentioned below .

when i try reading the output string from the outputstream
the first line of the transformed stream is ALWAYS
"<?xml version="1.0" encoding="UTF-8"?>"


I've removed this line from both the xml & xsl files being used ..still i get this line in the transformed stream .
I need this line removed ...

Can ayone please suggest me the cause or the solution for this .

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(new InputSource(new StringReader(xmldata)));

URL url = getClass().getResource(xslFile);
java.io.InputStream in = url.openStream();

javax.xml.transform.TransformerFactory tFactory =
javax.xml.transform.TransformerFactory.newInstance();
javax.xml.transform.dom.DOMSource xmlSource =
new javax.xml.transform.dom.DOMSource(document);
javax.xml.transform.Source xslSource = new javax.xml.transform.stream.StreamSource(in);
javax.xml.transform.Transformer transformer = tFactory.newTransformer(xslSource);
javax.xml.transform.stream.StreamResult streamresult =
new javax.xml.transform.stream.StreamResult(new StringWriter());
transformer.transform(xmlSource, streamresult);


thx,
Shilpa

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic