a question of DOMSource
"ext2" <[email protected]> Sat, 4 Jun 2011 13:07:28 +0800
| Newsgroups | gmane.text.xml.xalan.java.user |
|---|---|
| Message-ID | <[email protected]> |
Hi: When I using Xalan 2.7.1 to transform a DOM Source; I find that:The Node combine with DOMSource must be a Document and It cannot be just a Element; Does anyone know if this limit is correctly or wrong, and why? Following is a simple program to illustrate it Document doc = DocumentBuilder.parse(.) //if I using document as input, the result is correct; Transformer.transform(new DOMSource(doc), streamResult); //but if I using element as input, the result is wrong; Transformer.transform(new DOMSource(doc.getDocumentElement), streamResult); Ps: xml xslt I used: Xml: <?xml version="1.0" encoding="UTF-8"?> <Record xmlns="http://www.tongtech.com/tiwen/record1"> <content1>a</content1> <content2>b</content2> <content3>c</content3> </Record> Xslt: It's too long, but it logical is very simple, just exchange field content2 & content 3; And I am sure it's correctly, because I have use a StreamSource(xml-stream), and Document 's DOMSource as input, their result both are correctly; but if anyone interest with it, I can post it in reply;