hi Fred,
an excellent bug report - now in bugzilla
http://www.extreme.indiana.edu/bugzilla/show_bug.cgi?id=246
and it is now fixed in xpp3-1.1.4 and in CVS - it is just one-liner (see
below)
thanks,
alek
Revision Changes Path
1.9 +29 -26
xmlpull-api-v1/addons/java/dom2_builder/src/org/xmlpull/v1/dom2_builder/DOM2XmlP\
ullBuilder.java
Index: DOM2XmlPullBuilder.java
===================================================================
RCS file:
/l/extreme/cvspub/xmlpull-api-v1/addons/java/dom2_builder/src/org/xmlpull/v1/dom\
2_builder/DOM2XmlPullBuilder.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -t -w -r1.8 -r1.9
--- DOM2XmlPullBuilder.java 23 Oct 2006 04:01:08 -0000 1.8
+++ DOM2XmlPullBuilder.java 23 Oct 2006 05:05:58 -0000 1.9
@@ -182,7 +182,10 @@
String prefix = pp.getNamespacePrefix(i);
for (int j = top; j > i; --j)
{
- if(prefix.equals(pp.getNamespacePrefix(j))) {
+ String prefixJ = pp.getNamespacePrefix(j);
+ if((prefix != null && prefix.equals(prefixJ))
+ || (prefix != null && prefix == prefixJ) )
+ {
// prefix is already declared -- skip it
continue LOOP;
}
Frederick Burkley wrote:
> 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
> <http://your-namespace-here/>"
> xmlns:xsi="http://www.w3.org/2001/XMLSchem a-instance
> <http://www.w3.org/2001/XMLSchema-instance>" xsi:schemaLocation="
> http://your-namespace-here <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
> <http://your-namespace-here/>"
> xmlns:xsi="http://www.w3.org/2001/XMLSchem a-instance
> <http://www.w3.org/2001/XMLSchema-instance>"
> xsi:schemaLocation="http://your-namespace-here
> <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();
> }
> }
> }
>
>
>
--
The best way to predict the future is to invent it - Alan Kay