I'm looking into the DOM2XmlPullBuilder class and I get a NullPointerException when attempting to parse the following file:
<?xml version="1.0" encoding="UTF-8"?>
<ServerConfiguration xmlns=" http://your-namespace-here" xmlns:xsi="http://www.w3.org/2001/XMLSchem a-instance" xsi:schemaLocation=" http://your-namespace-here test.xsd">
<Server>savage-m60</Server>
</ServerConfiguration>
Although I can successfully parse the following:
<?xml version="1.0" encoding="UTF-8"?>
<jtc:ServerConfiguration xmlns:jtc="http://your-namespace-here" xmlns:xsi="http://www.w3.org/2001/XMLSchem a-instance " xsi:schemaLocation="http://your-namespace-here test.xsd">
<jtc:Server>savage-m60</jtc
<?xml version="1.0" encoding="UTF-8"?>
<ServerConfiguration xmlns=" http://your-namespace-here" xmlns:xsi="http://www.w3.org/2001/XMLSchem a-instance" xsi:schemaLocation=" http://your-namespace-here test.xsd">
<Server>savage-m60</Server>
</ServerConfiguration>
Although I can successfully parse the following:
<?xml version="1.0" encoding="UTF-8"?>
<jtc:ServerConfiguration xmlns:jtc="http://your-namespace-here" xmlns:xsi="http://www.w3.org/2001/XMLSchem a-instance " xsi:schemaLocation="http://your-namespace-here test.xsd">
<jtc:Server>savage-m60</jtc
:Server>
</jtc:ServerConfiguration>
Is there something wrong with the first form of this instance document?
Respectfully,
Fred Burkley
The sample parse code follows.
import java.io.File;
import java.io.FileReader ;
import org.xmlpull.v1.dom2_builder.DOM2XmlPullBuilder;
public class PullParserTest {
public static void main(String[] args) {
File file;
FileReader fileReader;
DOM2XmlPullBuilder pullBuilder;
if (args.length < 1) {
System.out.println("Enter the name of the XML file on the command line.");
System.exit(0);
}
try {
file = new File(args[0]);
fileReader = new FileReader(file);
pullBuilder = new DOM2XmlPullBuilder();
pullBuilder.parse(fileReader);
}
catch (Exception ex) {
ex.printStackTrace();
}
}
}
</jtc:ServerConfiguration>
Is there something wrong with the first form of this instance document?
Respectfully,
Fred Burkley
The sample parse code follows.
import java.io.File;
import java.io.FileReader ;
import org.xmlpull.v1.dom2_builder.DOM2XmlPullBuilder;
public class PullParserTest {
public static void main(String[] args) {
File file;
FileReader fileReader;
DOM2XmlPullBuilder pullBuilder;
if (args.length < 1) {
System.out.println("Enter the name of the XML file on the command line.");
System.exit(0);
}
try {
file = new File(args[0]);
fileReader = new FileReader(file);
pullBuilder = new DOM2XmlPullBuilder();
pullBuilder.parse(fileReader);
}
catch (Exception ex) {
ex.printStackTrace();
}
}
}