package xmlbeans;

import java.io.IOException;

import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlOptions;
import org.example.docelement.DocDocument;

public class ParsingXmlFragment {
	
	public ParsingXmlFragment() throws XmlException, IOException {
		String xml = "<element uri=\"www.apache.org\"/>";
		XmlOptions xmlOptions = new XmlOptions().setDocumentType(DocDocument.Doc.type);
		DocDocument.Doc doc = (DocDocument.Doc) XmlObject.Factory.parse(xml, xmlOptions);
		System.out.println(doc.toString());
		System.out.println(doc.getElement().toString());
	}
	
	public static void main(String[] args) {
		try {
			new ParsingXmlFragment();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
}
