[prev in list] [next in list] [prev in thread] [next in thread]
List: xmlbeans-dev
Subject: [jira] Created: (XMLBEANS-336) setLoadStripWhitespace() option
From: "Yafei Zhang (JIRA)" <xmlbeans-dev () xml ! apache ! org>
Date: 2007-06-26 18:43:27
Message-ID: 19616892.1182883407119.JavaMail.jira () brutus
[Download RAW message or body]
setLoadStripWhitespace() option strips trailing white spaces of CDATA
---------------------------------------------------------------------
Key: XMLBEANS-336
URL: https://issues.apache.org/jira/browse/XMLBEANS-336
Project: XMLBeans
Issue Type: Bug
Components: XmlObject
Affects Versions: Version 2
Environment: Windows XP Professional
Reporter: Yafei Zhang
Priority: Minor
/**
* When parsing a string containing CDATA into an XmlObject with the
* setLoadStripWhitespace() option, the leading white spaces of the CDATA string are
* preserved as expected, but the trailing white spaces still get stripped off.
*/
import org.apache.xmlbeans.*;
public class StripWhiteSpaceWithCDATATest {
public static void main(String[] args) {
String stringValue = new String("<test><name>testXmlBean</name>" +
"<message><![CDATA[\n Hello, World \n]]></message></test>");
try {
XmlOptions options = new XmlOptions();
options.setLoadStripWhitespace();
XmlObject xmlContent = XmlObject.Factory.parse(stringValue, options);
System.out.println("XmlObject WITH strip whitespace option: \n" +
xmlContent.xmlText(options) + "\n");
xmlContent = XmlObject.Factory.parse(stringValue);
System.out.println("XmlObject WITHOUT strip whitespace option: \n" +
xmlContent.xmlText() + "\n");
} catch(XmlException e) {
e.printStackTrace();
}
}
// Results:
//
// XmlObject WITH strip whitespace option:
// <test><name>testXmlBean</name><message>
// Hello, World</message></test>
//
// XmlObject WITHOUT strip whitespace option:
// <test><name>testXmlBean</name><message>
// Hello, World
// </message></test>
//
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic