Posted by cencio1980
on March 5, 2008 at 9:50 AM PST
i tryed to parse a file, and i notice that if there are spaces, return or tabs between elements the resulting DOM Document has some empty Text nodes.
For example i parse this:
(i loose indent in this forum) i have that has 7 children (instead of 2) and each has 5 children (instead of 2) and i'm getting creazy to avoid empty ones.
If i remove all spaces, tabs and return like this:
the DOM Document is perfect, without extra nodes.
This is the code i use for Parsing:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setAttribute(JAXP_SCHEMA_SOURCE, new File("/tmp/request.xsd"));
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse( req.getInputStream() );
i tryed both jaxp 1.3 and 1.4.
Message was edited by: cencio1980