Results 1 to 2 of 2
  1. #1
    doofuslarge is offline Member
    Join Date
    Nov 2008
    Posts
    1
    Rep Power
    0

    Default Reproducing whitespace with DOM

    I'm trying to use DOM to read in an XML file, make a few modifications, and then write out the result. I also have the requirement of maintaining the original whitespace and formatting of the original document. Does anyone know how to do this?

  2. #2
    wolfcro is offline Member
    Join Date
    Feb 2009
    Location
    Italy
    Posts
    51
    Rep Power
    0

    Default

    for maintaining whitespaces this should work:

    Java Code:
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setIgnoringElementContentWhitespace(false);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •