You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by bu...@apache.org on 2001/06/14 19:42:34 UTC
[Bug 2186] New: - ID & IDREF validator tables persist across parser instances
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2186
*** shadow/2186 Thu Jun 14 10:42:34 2001
--- shadow/2186.tmp.20039 Thu Jun 14 10:42:34 2001
***************
*** 0 ****
--- 1,143 ----
+ +============================================================================+
+ | ID & IDREF validator tables persist across parser instances |
+ +----------------------------------------------------------------------------+
+ | Bug #: 2186 Product: Xerces-J |
+ | Status: NEW Version: 1.4 |
+ | Resolution: Platform: All |
+ | Severity: Major OS/Version: All |
+ | Priority: Other Component: Core |
+ +----------------------------------------------------------------------------+
+ | Assigned To: xerces-j-dev@xml.apache.org |
+ | Reported By: lblanchette@grandcentral.com |
+ | CC list: Cc: |
+ +----------------------------------------------------------------------------+
+ | URL: |
+ +============================================================================+
+ | DESCRIPTION |
+ When using dtd validation with SAX or DOM parsers if an ID/IDREF error is
+ encountered the validation tables persist in new parser instances. reset seems
+ to have no effect
+
+ here's code to reproduce/workaround
+
+ import org.apache.xerces.parsers.DOMParser;
+ import org.apache.xerces.parsers.SAXParser;
+
+ // for workaround
+ import org.apache.xerces.validators.datatype.IDREFDatatypeValidator;
+ import org.apache.xerces.validators.datatype.IDDatatypeValidator;
+ import org.apache.xerces.validators.datatype.StateMessageDatatype;
+
+
+ import org.xml.sax.ErrorHandler;
+ import org.xml.sax.SAXParseException;
+ import org.xml.sax.SAXException;
+
+ public class Test implements ErrorHandler {
+
+ static boolean workAround = false;
+ public void fatalError(SAXParseException ex) throws SAXException {throw ex;}
+ public void error(SAXParseException ex) throws SAXException {throw ex;}
+ public void warning(SAXParseException ex) {}
+
+ public Test() {}
+ public void run() {
+ if(workAround) {
+ System.out.println("** Using workaround **");
+ } else {
+ System.out.println("** Not using workaround **");
+ }
+ System.out.println("parse test.xml");
+ try {
+ SAXParser parser = new SAXParser();
+ parser.reset();
+ parser.setFeature("http://xml.org/sax/features/validation",true);
+ parser.setErrorHandler(this);
+ parser.parse("test.xml");
+ } catch (Exception ex) {
+ System.out.println(ex.getMessage());
+ }
+ System.out.println("parse test2.xml");
+ if(workAround) {
+ resetIDREF_ID();
+ }
+ try {
+ SAXParser parser = new SAXParser();
+ parser.reset();
+ parser.setFeature("http://xml.org/sax/features/validation",true);
+ parser.setErrorHandler(this);
+ parser.parse("test2.xml");
+ } catch (Exception ex) {
+ System.out.println(ex.getMessage());
+ }
+ }
+
+ /* work around, use this between parser use */
+ private static void resetIDREF_ID() {
+ try {
+ IDREFDatatypeValidator idr = new IDREFDatatypeValidator();
+ idr.validate(null,
+ new StateMessageDatatype() {
+ public Object getDatatypeObject(){
+ return(Object) null;
+ }
+ public int getDatatypeState(){
+ return IDREFDatatypeValidator.IDREF_CLEAR;
+ }
+ public void setDatatypeObject( Object data ){}
+ });
+ IDDatatypeValidator id = new IDDatatypeValidator();
+ id.validate(null,
+ new StateMessageDatatype() {
+ public Object getDatatypeObject(){
+ return(Object) null;
+ }
+ public int getDatatypeState(){
+ return IDDatatypeValidator.ID_CLEAR;
+ }
+ public void setDatatypeObject( Object data ){}
+ });
+ } catch (Exception ex) {
+ System.out.println("Problem Clearing id/idref");
+ }
+ }
+
+ public static void main(String [] args) {
+ workAround = false;
+ new Test().run();
+ workAround = true;
+ new Test().run();
+ }
+ }
+
+
+ source dtd & docs
+
+ test.dtd
+
+ <?xml version="1.0" encoding="UTF-8"?>
+
+ <!ELEMENT foo (bar) >
+ <!ATTLIST foo
+ name ID #REQUIRED>
+
+ <!ELEMENT bar EMPTY >
+ <!ATTLIST bar
+ name-ref IDREF #REQUIRED>
+
+
+ test.xml (creates id/idref error)
+
+ <?xml version="1.0" ?>
+ <!DOCTYPE foo SYSTEM "test.dtd">
+ <foo name="name1">
+ <bar name-ref="name2"/>
+ </foo>
+
+ test2.xml (should be ok)
+
+ <?xml version="1.0" ?>
+ <!DOCTYPE foo SYSTEM "test.dtd">
+ <foo name="name3">
+ <bar name-ref="name3"/>
+ </foo>
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
Trying to build Xerces Version 1.4.0 from the source code
Posted by "Joanna L. Gilberti" <jl...@cs.columbia.edu>.
On Thu, 14 Jun 2001, Joanna L. Gilberti wrote:
>
>
> Hi,
>
> I am trying to build Xerce Version 1.4.0 (on Unix), however, I am getting
> a bunch of errors. I have followed the README instructions, by typing,
> "make jars" in the directory at the top of the Xerces Java tree. The
> error messages I am getting are, "Cannot resolve symbol...". I noticed
> that a lot of the class files are not being created when I run, "make
> jars". I tried manually compiling various java files throughout the
> directory tree, but run into problems when I reach,
> 'src/javax/org/apache/xerces/validators/schema',
> 'src/javax/org/apache/xerces/validators/datatype',
> 'src/javax/org/apache/xerces/parsers',
> 'src/javax/org/apache/xerces/framework', etc.
>
> I had no trouble building Xerces Version 1.2.3 using, "make jars", and
> have not modified any of the source code for Version 1.4.0. I am simply
> trying to build Xerces Version 1.4.0 (the original unmodified version
> downloaded from the Web).
>
> Any suggestions would be greatly appreciated.
>
> Thanks,
>
> Joanna
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
Re: [Bug 2186] New: - ID & IDREF validator tables persist across
parser instances
Posted by "Joanna L. Gilberti" <jl...@cs.columbia.edu>.
Hi,
I am trying to build Xerce Version 1.4.0 (on Unix), however, I am getting
a bunch of errors. I have followed the README instructions, by typing,
"make jars" in the directory at the top of the Xerces Java tree. The
error messages I am getting are, "Cannot resolve symbol...". I noticed
that a lot of the class files are not being created when I run, "make
jars". I tried manually compiling various java files throughout the
directory tree, but run into problems when I reach,
'src/javax/org/apache/xerces/validators/schema',
'src/javax/org/apache/xerces/validators/datatype',
'src/javax/org/apache/xerces/parsers',
'src/javax/org/apache/xerces/framework', etc.
I had no trouble building Xerces Version 1.2.3 using, "make jars", and
have not modified any of the source code for Version 1.4.0. I am simply
trying to build Xerces Version 1.4.0 (the original unmodified version
downloaded from the Web).
Any suggestions would be greatly appreciated.
Thanks,
Joanna
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org