org.xwiki.xml.html
Class HTMLUtils

java.lang.Object
  extended by org.xwiki.xml.html.HTMLUtils

public final class HTMLUtils
extends Object

HTML Utility methods.

Since:
1.8.3
Version:
$Id: 22b2edde971416e8a8b9cf4aa0de887c08f8a691 $

Nested Class Summary
static class HTMLUtils.XWikiXMLOutputter
          JDOM's XMLOutputter class converts reserved XML characters (<, >, ' , &, \r and \n) into their entity format (<, > ' & and \r\n).
 
Method Summary
static void stripFirstElementInside(Document document, String parentTagName, String elementTagName)
          Remove the first element inside a parent element and copy the element's children in the parent.
static void stripHTMLEnvelope(Document document)
          Strip the HTML envelope if it exists.
static String toString(Document document)
           
static String toString(Document document, boolean omitDeclaration, boolean omitDoctype)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toString

public static String toString(Document document)
Parameters:
document - the W3C Document to transform into a String
Returns:
the XML as a String

toString

public static String toString(Document document,
                              boolean omitDeclaration,
                              boolean omitDoctype)
Parameters:
document - the W3C Document to transform into a String
omitDeclaration - whether the XML declaration should be printed or not
omitDoctype - whether the document type should be printed or not
Returns:
the XML as a String

stripHTMLEnvelope

public static void stripHTMLEnvelope(Document document)
Strip the HTML envelope if it exists. Precisely this means removing the head tag and move all tags in the body tag directly under the html element. This is useful for example if you wish to insert an HTML fragment into an existing HTML page.

Parameters:
document - the w3c Document to strip

stripFirstElementInside

public static void stripFirstElementInside(Document document,
                                           String parentTagName,
                                           String elementTagName)
Remove the first element inside a parent element and copy the element's children in the parent.

Parameters:
document - the w3c document from which to remove the top level paragraph
parentTagName - the name of the parent tag to look under
elementTagName - the name of the first element to remove


Copyright © 2004-2013 XWiki. All Rights Reserved.