[prev in list] [next in list] [prev in thread] [next in thread]
List: xerces-j-dev
Subject: Re: Bogus duplicate attribute bug
From: Norman Walsh <ndw () nwalsh ! com>
Date: 2001-09-28 11:55:10
[Download RAW message or body]
FWIW, I reduced the problem to a small test case, submitted here for
your consideration. Using the latest CVS of Xerces J 2 and JDK 1.2.2 on
Linux, the attached program reports:
org.xml.sax.SAXException: Attribute "bar" bound to namespace "" was already specified for element "test".
at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:979)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:346)
at xread.main(xread.java:48)
when presented with the attached document.
[Attachment #2 (text/x-java)]
// xread.java - A simple command-line XML parser
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.DataInputStream;
import java.net.URL;
import java.net.MalformedURLException;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
import javax.xml.parsers.*;
public class xread
{
public static void main (String[] args)
throws FileNotFoundException, IOException {
if (args.length != 1) {
System.out.println("Usage: xread xmlfile");
System.exit(1);
}
String xmlfile = args[0];
URL base = null;
try {
base = new URL("file://" + xmlfile);
} catch (MalformedURLException e) {
System.out.println("Malformed URL: " + xmlfile);
System.exit(2);
}
SAXParserFactory spf = null;
try {
spf = SAXParserFactory.newInstance();
spf.setNamespaceAware(true);
spf.setValidating(false);
DataInputStream inStream = new DataInputStream(base.openStream());
SAXParser parser = spf.newSAXParser();
System.out.println("Parsing " + base.toString());
parser.parse(new InputSource(inStream), new DefaultHandler());
} catch (Exception e) {
e.printStackTrace();
}
}
}
[Attachment #3 (application/octet-stream)]
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic