<node> test
test
test
</node>
I want my XML parser read characters in <node>
and:
- replace newlines and tabs to spaces and compose multiple spaces into one. At result, the text should look similar to "test test test".
- If the node contains XML encoded characters: tabs (
	
), newlines (

) or whitespaces (
) - they should be left.
I'm trying a code below, but it preserve duplicated whitespaces.
dbf = DocumentBuilderFactory.newInstance();
dbf.setIgnoringComments( true );
dbf.setNamespaceAware( namespaceAware );
db = dbf.newDocumentBuilder();
doc = db.parse( inputStream );
Is the any way to do what I want?
Thanks!
dbf.setIgnoringElementContentWhitespace(true);
– Chromatics