Mercurial Hosting > luan
diff src/goodjava/xml/Xml.java @ 1790:a8c685a894b4
start xml work
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 25 Dec 2023 23:07:59 -0700 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/goodjava/xml/Xml.java Mon Dec 25 23:07:59 2023 -0700 @@ -0,0 +1,27 @@ +package goodjava.xml; + + +public final class Xml { + public String declaration; + private XmlElement element; + + public XmlElement getElement() { + return element; + } + + public void setElement(XmlElement element) { + if( element == null ) + throw new IllegalArgumentException("element can't be null"); + this.element = element; + } + + @Override public String toString() { + StringBuilder sb = new StringBuilder(); + if( declaration != null ) { + sb.append( declaration ); + sb.append( '\n' ); + } + element.toString(sb,0); + return sb.toString(); + } +}