comparison 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
comparison
equal deleted inserted replaced
1789:bac27b119ff2 1790:a8c685a894b4
1 package goodjava.xml;
2
3
4 public final class Xml {
5 public String declaration;
6 private XmlElement element;
7
8 public XmlElement getElement() {
9 return element;
10 }
11
12 public void setElement(XmlElement element) {
13 if( element == null )
14 throw new IllegalArgumentException("element can't be null");
15 this.element = element;
16 }
17
18 @Override public String toString() {
19 StringBuilder sb = new StringBuilder();
20 if( declaration != null ) {
21 sb.append( declaration );
22 sb.append( '\n' );
23 }
24 element.toString(sb,0);
25 return sb.toString();
26 }
27 }