Results 1 to 4 of 4
  1. #1
    acio23 is offline Member
    Join Date
    May 2012
    Posts
    2
    Rep Power
    0

    Default Plain text from XML

    Hi all,
    can somebody help? I wanna extract palaintext from XML (DOM or SAX, not tokenizing from FileReader) with tags how I see it in source.
    Let's say nodeList.item(0)= <node1>

    <node1>
    <child>
    <body><P>TEXT</P></body>
    </child>
    </node1>

    Result:
    String str= "<child><body><P>TEXT</P></body></child>"

    Thanks in advance

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is online now Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,242
    Rep Power
    19

    Default Re: Plain text from XML

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,014
    Rep Power
    20

    Default Re: Plain text from XML

    You'll want a Transformer (TransformerFactory.getInstance().getTransformer()).
    Then setOutputProperty for OutputKeys.OMIT_XML_DECLARATION and probably OutputKeys.ENCODING, then transform the Node you're interested in.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  4. #4
    acio23 is offline Member
    Join Date
    May 2012
    Posts
    2
    Rep Power
    0

Similar Threads

  1. Scanning a Plain text file
    By aw249 in forum New To Java
    Replies: 3
    Last Post: 02-03-2012, 05:16 PM
  2. plain text printing with java
    By berkeleybross in forum Advanced Java
    Replies: 3
    Last Post: 04-04-2011, 01:01 AM
  3. Replies: 3
    Last Post: 06-08-2010, 08:10 PM
  4. Indentation - plain text
    By barney75 in forum New To Java
    Replies: 1
    Last Post: 03-23-2009, 05:54 PM
  5. convert html to plain text
    By vissu007 in forum New To Java
    Replies: 3
    Last Post: 07-07-2007, 02:39 PM

Posting Permissions

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