import java.io.IOException;
import java.io.StringReader;
import javax.xml.stream.FactoryConfigurationError;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
/**
* TextXML.java
* demonstrates bug in StAX
* Requires StAX 1.0 (JSR 173) available at http://jcp.org/en/jsr/detail?id=173
* and kXML 2 available at http://www.kxml.org/ (based on the Common XML Pull parsing API at http://www.xmlpull.org/)
*
* @author diego http://www.dynamicobjects.com/d2r/
*/
public class TextXML
{
static String sampleXML = "\n" +
"<code01>" +
"<code02>" +
"<code03>" +
"<code04>" +
"<code05>" +
"";
public static void main(String[] s)
{
if (s != null && s.length == 1 && s[0].equals("xmlpull")) {
parseWithXMLPull();
/*
* Result will be: (Correct)
id =
id =
id =
id =
id =
*/
}
else {
parseWithSTAX();
/*
* Result will be: (Incorrect)
id =