Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes XML and Related Technologies and the fly likes xml ingore whitespace Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Badass: Making Users Awesome this week in the Game Development forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "xml ingore whitespace" Watch "xml ingore whitespace" New topic

xml ingore whitespace

jim li
Ranch Hand

Joined: May 20, 2008
Posts: 180

i am using :

DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();

DocumentBuilder docBuilder = docFactory.newDocumentBuilder();

Document doc = docBuilder.parse(xsltFile);

but it does not ingore the white space, i do not want to remove all space manually , can anyone give me a solution
Paul Clapham

Joined: Oct 14, 2005
Posts: 19357

Whitespace is only "ignorable" if you have a schema which describes the document. (Your code doesn't validate, so you don't have a schema.) Otherwise there is no way for the parser to tell which whitespace you are not interested in.
I agree. Here's the link:
subject: xml ingore whitespace