Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 193
  • Last Modified:

Document object delimiters (at parse time)

Is there a way to add some delimiters(for example: to trim off the whitespaces and the newlines) to a Document object. I would like to do it at parse time, what would the code look like to add this functionality.

private static Document document;
private static DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

DocumentBuilder builder = factory.newDocumentBuilder();
document = builder.parse(new File(args[0]));
0
no158
Asked:
no158
  • 2
1 Solution
 
objectsCommented:
not that I know of.
0
 
no158Author Commented:
is there any way triming off the whitespaces and newlines at any point?
0
 
objectsCommented:
you could iterate thru the tree once its loaded
http://javaalmanac.com/egs/org.w3c.dom/WalkElem.html
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now