public String toXmlString ( ) { final StringBuilder buffer = new StringBuilder ( ) ; buffer . append ( "<" ) ; buffer . append ( getName ( ) ) ; Optional < String > attr = TagExtensions . attributesToString ( getAttributes ( ) ) ; if ( attr . isPresent ( ) ) { buffer . append ( attr . get ( ) ) ; } if ( isEndTag ( ) ) { buffer . append ( ">" ) ; buffer . append ( getContent ( ) ) ; if ( getChildren ( ) != null && ! getChildren ( ) . isEmpty ( ) ) { for ( final SimpleTag child : getChildren ( ) ) { buffer . append ( child . toXmlString ( ) ) ; } } buffer . append ( "</" ) ; buffer . append ( getName ( ) ) ; buffer . append ( ">" ) ; } else { buffer . append ( "/>" ) ; } return buffer . toString ( ) ; }
Creates from this Tag object an xml string .