transform « transform « Java XML Q&A

Home
Java XML Q&A
1.convert
2.Development
3.document
4.dom
5.dom4j
6.dtd
7.element
8.jaxb
9.jaxp
10.jdom
11.jsoup
12.namespace
13.Node
14.parse
15.parser
16.pdf
17.sax
18.schema
19.stax
20.tag
21.transform
22.Validation
23.xalan
24.xmlbeans
25.xpath
26.xsd
27.xslt
28.xstream
Java XML Q&A » transform » transform 

1. Pretty-printing output from javax.xml.transform.Transformer with only standard java api (Indentation and Doctype positioning)    stackoverflow.com

Using the following simple code:

package test;

import java.io.*;
import javax.xml.transform.*;
import javax.xml.transform.stream.*;

public class TestOutputKeys {
 public static void main(String[] args) throws TransformerException {

  // Instantiate transformer input
  Source xmlInput = new StreamSource(new ...

2. Java: How to Indent XML Generated by Transformer    stackoverflow.com

I'm using Java's built in XML transformer to take a DOM document and print out the resulting XML. The problem is that it isn't indenting the text at all despite having ...

3. Java: XML Transform, line break in Text node, breaks indenting    stackoverflow.com

I'm building an XML document and printing out into an indented format using the JVM build-in libraries. When there is a text node in the document that contains a line break, ...

4. How can I print single quotes around attribute values instead of double quotes with the javax.xml.transform.Tansformer class?    stackoverflow.com

I have the following function:

private static void prettyPrint(Document doc, File destFile)
{
    TransformerFactory tfactory = TransformerFactory.newInstance();
    Transformer serializer;

    try
    {
 ...

5. How can I transform a functional language in XML to Java?    stackoverflow.com

I'm working with a DSL based on an XML schema that supports functional language features such as loops, variable state with context, and calls to external Java classes. I'd like to ...

6. How I can transform XML to Java-tree-structure?    stackoverflow.com

I would like to transform XML-document to java-tree-structure, but I do not know what is a java-tree-structure? For example, JTree or another? is it exists any library?

7. Indent text child nodes with javax.xml.transform.Transformer    stackoverflow.com

I'm transforming a DOM document to XML in java using javax.xml APIs. The result is

<tag>
    <tag2>text</tag2>
</tag>
but I need it to be
<tag>
    <tag2>
    ...

8. How to transform XML with XSL using Java    stackoverflow.com

I am currently using the standard javax.xml.transform library to transform my XML to CSV using XSL. My XSL file is large - at around 950 lines. My XML files ...

9. XML String Transform Java    stackoverflow.com


I have the next xml string -

<persons>
    <person>
        <name>Someone</name>
        <age>27</age>
    ...

10. Transform java objects to dynamic xml    stackoverflow.com

I'm working with a dynamic xml table format consisting of a schema that specifies column names and types, and a values tag which contains the rows. Simplified version of xsd below:

<xs:complexType ...

11. How to Preserve the Input's Declared Encoding in the Output of javax.xml.transform.Transformer.transform? (e.g. avoid UTF-16 changing to UTF-8)    stackoverflow.com

Assuming this input XML

<?xml version="1.0" encoding="UTF-16"?>
<test></test>
Writing these lines of code :
StreamSource source = new StreamSource(new StringReader(/* the above XML*/));
StringWriter stringWriter = new StringWriter();
StreamResult streamResult = new StreamResult(stringWriter);
TransformerFactory.newInstance().newTransformer().transform(source, streamResult);
return stringWriter.getBuffer().toString();
Outputs for me ...

12. Felxibility of data import/export feature using XML-binding    stackoverflow.com

I am going to develop a database import/export feature in a JEE application. I plan to use XML-binding solution to convert between Java object and XML file which is import/export file.

  • Import feature: ...

13. javax.xml.transform.Transformer is removing needed whitespace (xml to text transformation)    stackoverflow.com

I'm trying to convert XML to text, using javax.xml.transform. xsltproc will correctly transform my XML to properly formatted text, while the following code produces output with almost all whitespace removed:

final ...

14. What would cause javax.xml.transform.Transformer.transform() to return empty string    stackoverflow.com

I have a piece of code like this. I found that myResults = writer.getBuffer().toString(); returns an EMPTY STRING for some of the use cases but not for the other use ...

15. Java 1.6: javax.xml.transform.Transformer refuses to indent xml strings which contain newlines    stackoverflow.com

I need to be able to pretty print xml strings using Java APIs and have found multiple solutions for this both on the web and on this particular website. However despite ...

16. Unicode characters - javax . xml . transform . Transformer    coderanch.com

Yes, I am sure we can help. But I think the XML forum will get you better and faster answers. I am going to move this thread to that forum. Good Luck Mark Let me rephrase it. Actually you already have a thread for this question in the XML forum, which is the more appropriate forum. So, in that case, this ...

17. xml.transform and stylesheets?    coderanch.com

Hello, I am using javax.xml.transform.Transformer; to transform a XML file into HTML using a given XSL stylesheet, code as below. public static void transformXML(String xmlFileName) { // Change filename from .XML to .HTML String filename = xmlFileName.substring(xmlFileName.lastIndexOf("\\")); filename = filename.replaceAll(".xml", properties.getExportEXT() .toString()); try { // Create a new instance of TransformerFactory TransformerFactory tFactory = TransformerFactory.newInstance(); // Pass it a valid XSL ...

18. xml transform code just not behaving    coderanch.com

19. What is the best way to transform XML to HTML?    coderanch.com

Welcome to the JavaRanch, Mattew! I tend to grate my teeth when I hear the word "best", as it frequently is meaningless. The real world is a bit too complicated for "one-size-fits-all" solutions. However, a popular approach is to use XSL, since you can use a generic engine and a set of transformation rules instead of having to hard-code everything. Although ...

20. Using javax.xml.transform.Transformer ???    dbforums.com

Hi all, I have a webservice for encrypting a password such as that provided by the method doProcess() in MyClient class below. Currently this method processes a soap message(not shown in the code snippet) containing the plain text password and prints out the encrypted password to the console using "System.out" as shown by method process() in class EncryptionHandler below. Now, what ...

22. Transform objects to XML ?    forums.oracle.com

Well, if you're willing to go along with the Java Beans specification (getter and setter methods for your attributes, mostly) then java.beans.XMLEncoder and java.beans.XMLDecoder would work. But if you're heavily into having your XML driven by schemas, then JAXB might be more suitable. In between there are quite a few object-binding tools available (especially if you adopt the Java attitude that ...

24. Transform XML and display xsl:message    forums.oracle.com

25. javax.xml.transform.TransformerException: java.lang.NullPointerException    forums.oracle.com

catch ( TransformerException transformerException ){ transformerException.printStackTrace( System.err ); transformerException.getCause(); } } and as a result here is a snippet of the error: ERROR: '' ERROR: 'java.lang.NullPointerException' javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: java.lang.NullPointerException at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:650) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:279) at project_classes.ProfileServlet.transform(ProfileServlet.java:103) at project_classes.ProfileServlet.doGet(ProfileServlet.java:73) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) ...

26. javax.xml.transform.TransformerException    forums.oracle.com

27. XML Transform error    forums.oracle.com

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.