/******************************************************
 * File: XML.java
 * created 30-May-00 5:00:50 PM by <conan@warp.cx>
 */


package net.sourceforge.nanoxml;

import java.io.*;
import java.util.*;

/** A simple extension to XMLElement for added functionality. */
public class XML extends XMLElement {
	
	/** Creates a new XML object and parses the XML */
	public XML(InputStream in) throws java.io.IOException {
		this(new InputStreamReader(in));
	}//XML
	
	/** Creates a new XML object and parses the XML */
	public XML(Reader in) throws java.io.IOException {
		// read into a string buffer
		Writer buffer  = new StringWriter();
		char bytes[] = new char[512];
		int count;
		while ((count = in.read(bytes)) >= 0) {
			buffer.write(bytes, 0, count);
		}//while
			
		// parse the xml
		this.parseString(buffer.toString(), 0);
	}//XML
	
	/** Creates a new XML object and parses the XML */
	public XML(String xml) {
		this.parseString(xml, 0);
	}//XML
	

}//XML
