Mercurial Hosting > luan
diff src/goodjava/xml/XmlElement.java @ 1467:509d49c493c0
minor
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 13 Apr 2020 22:16:59 -0600 |
parents | 670b7d089699 |
children | 35f3bfd4f51d |
line wrap: on
line diff
--- a/src/goodjava/xml/XmlElement.java Mon Apr 13 22:00:40 2020 -0600 +++ b/src/goodjava/xml/XmlElement.java Mon Apr 13 22:16:59 2020 -0600 @@ -41,21 +41,20 @@ if( content instanceof String ) { String s = (String)content; sb.append(s); - } else if( content instanceof XmlElement[] ) { + } else { XmlElement[] elements = (XmlElement[])content; sb.append( '\n' ); for( XmlElement element : elements ) { element.toString(sb,indented+1); } indent(sb,indented); - } else - throw new RuntimeException(); + } sb.append( "</" ); sb.append( name ); sb.append( ">\n" ); } - private void indent(StringBuilder sb,int indented) { + private static void indent(StringBuilder sb,int indented) { for( int i=0; i<indented; i++ ) { sb.append('\t'); }