| 
1790
 | 
     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 }
 |