[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

insert linefeed

Subject: insert linefeed
From: "Derrick Koes" <derrick_koes@xxxxxxxxxxx>
Date: Tue, 20 Apr 2004 15:15:56 -0400
html line feed
I want to insert a line feed into an XML document, serialize it to a file, and then parse it to a DOM document for use in an XSL transform (applying a sytlesheet). Parsing always throws the following exception.

org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x10) was found in the element content of the document.

I have a feeling I'm inserting the wrong character for what I want. Does anyone have a suggestion? Using "\n", rather than "\u0010", doesn't cause the exception, but it doesn't get me the desired line feed when I transform the XML to HTML using an XSL stylesheet.

Test code:

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.newDocument();
Element test = doc.createElement("Test"); test.appendChild(doc.createTextNode("before"));
test.appendChild(doc.createTextNode("\u0010"));
test.appendChild(doc.createTextNode("after"));
doc.appendChild(test);
FileOutputStream fos = new FileOutputStream("C:/myoutput.xml");
Transformer t = transFact.newTransformer(); // identity transform // not necessary t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); Node node = doc.getDocumentElement(); DOMSource source = new DOMSource(node); StreamResult result = new StreamResult(fos); t.transform(source, result); fos.close(); db.parse(new File("C:/myoutput.xml"));


_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar  get it now! http://toolbar.msn.com/go/onm00200415ave/direct/01/


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.