@ Nullable public IMicroContainer unescapeXHTMLFragment ( @ Nullable final String sXHTML ) { // Ensure that the content is surrounded by a single tag final IMicroDocument aDoc = parseXHTMLFragment ( sXHTML ) ; if ( aDoc != null && aDoc . getDocumentElement ( ) != null ) { // Find "body" case insensitive final IMicroElement eBody = aDoc . getDocumentElement ( ) . getFirstChildElement ( EHTMLElement . BODY . getElementName ( ) ) ; if ( eBody != null ) { final IMicroContainer ret = new MicroContainer ( ) ; if ( eBody . hasChildren ( ) ) { // We need a copy because detachFromParent is modifying for ( final IMicroNode aChildNode : eBody . getAllChildren ( ) ) ret . appendChild ( aChildNode . detachFromParent ( ) ) ; } return ret ; } } return null ; }
Interpret the passed XHTML fragment as HTML and retrieve a result container with all body elements .