473,387 Members | 1,572 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Transform problem

Hi to all of you,
I hava a simply problem that could not solve. I am using
javax.xml.Transform. I am trying to transform Documtne to xml file. I
am setting transformer.setOutputProperty(OutputKeys.INDENT,"n o")
because i do not want the xml to be formated ... but in the output it
is.
Probably I am missing something and I'll be thankfull if someont could
help.

here is some code:

DOMSource domSource = new DOMSource(root);
StreamResult result = new StreamResult(outputStream);

Transformer transformer = null;
try
{
transformer = transformerFactory.newTransformer();
}
catch(TransformerConfigurationException tce)
{
throw new DOMTransformationException(tce);
}

transformer.setOutputProperty(OutputKeys.METHOD,"x ml");
String indent = (isIntended ? "yes" : "no");
System.out.println(indent);
transformer.setOutputProperty(OutputKeys.INDENT,in dent);
transformer.setParameter(OutputKeys.INDENT,indent) ;
//transformer.setOutputProperty(OutputKeys.VERSION,)

if(root instanceof Document)
{
transformer.setOutputProperty(OutputKeys.OMIT_XML_ DECLARATION,"no");
}
else if(root instanceof Element)
{
transformer.setOutputProperty(OutputKeys.OMIT_XML_ DECLARATION,"yes");
}
try
{
transformer.transform(domSource,result);
}
catch(TransformerException te)
{
throw new DOMTransformationException(te);
}

i expect: <root><something/></root>

but it is:
<root>
<something/>
</root>

the (Node root) is coming from pretty formated xml.

I am waiting for your help.
jivko
Jul 17 '05 #1
0 2372

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Luther Baker | last post by:
My team is using the FO library to generate PDFs. We are also required to use https. The XSL transform page fed into javax.xml.transform.Transformer starts with <?xml version="1.0"?>...
2
by: John Lehmann | last post by:
I have an interesting problem. I am performing an XSL transform using the System.Xml.Xsl.Transform class. I have a database that contains the XSL style sheet string. And it seems to work pretty...
8
by: Luther Miller | last post by:
I am using the XML tranform functionality in .NET to transform data in a DataSet into XMLSS using an XSLT file I have created. There are about 100 columns and only about 120 rows in the data...
6
by: Stephen Cook | last post by:
Having worked through the problems around enabling the document function using an XmlUrlResolver I started work on building a useful class to hide the intricacies. Trying to generalise the process...
3
by: b0yce | last post by:
Hi Group, I think I have found a problem with the <xsl:element> when being transformed by the .NET xmlTransform class. When using XmlSpy for development and debugging, the <xsl:number>...
3
by: Jason S | last post by:
Hello Group, I am just about tearing my hair out with this one and thought someone may have some insight. I have a transform that wasn't working so I grabbed the nearest debugger (xselerator)...
3
by: Andy | last post by:
Hi all, I'm having a problem doing an Xslt transform in code. I've done it before, so I'm not really sure why its not working. The problem is that the result of the transform is an empty...
1
by: steve | last post by:
I am trying to create an XSLT Transform but keep getting the same problem. Overload resolution failed because no accessible 'Transform' can be called with these arguments. I create a reference...
4
by: Dean Card | last post by:
Okay, so here is the situation. I have need to do some on-the-fly image creation. I have everything working great except for the last part of it, applying a perspective type transform to the...
19
by: Taras_96 | last post by:
Hi all, A poster at http://bytes.com/forum/thread60652.html implies that using strtoupper in transform doesn't work because ctype.h may define strtoupper as a macro: "The problem is that most...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.