Here is a small program I wrote that also gets stuck (first and only
argument is the xml file path - "bug.xml"):
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import org.apache.xerces.parsers.DOMParser;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/*
* Created on 12/06/2003
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
/** */
public class parserTest {
/** Namespaces feature id (http://xml.org/sax/features/namespaces).
*/
protected static final String NAMESPACES_FEATURE_ID =
"http://xml.org/sax/features/namespaces";
/** Schema validation feature id
(http://apache.org/xml/features/validation/schema). */
protected static final String SCHEMA_VALIDATION_FEATURE_ID =
"http://apache.org/xml/features/validation/schema";
/** Schema full checking feature id
(http://apache.org/xml/features/validation/schema-full-checking). */
protected static final String SCHEMA_FULL_CHECKING_FEATURE_ID =
"http://apache.org/xml/features/validation/schema-full-checking";
/** Validation feature id (http://xml.org/sax/features/validation).
*/
protected static final String VALIDATION_FEATURE_ID =
"http://xml.org/sax/features/validation";
/** Schema normalized value feature id
("http://apache.org/xml/features/validation/schema/normalized-value"). */
protected static final String SCHEMA_NORMALIZED_VALUE_ID=
"http://apache.org/xml/features/validation/schema/normalized-value";
/** Schema element default feature id
"http://apache.org/xml/features/validation/schema/element-default"). */
protected static final String SCHEMA_ELEMENT_DEFAULT_ID=
"http://apache.org/xml/features/validation/schema/element-default";
/** Deferred node expansion feature id
(http://apache.org/xml/features/dom/defer-node-expansion). */
protected static final String DEFERRED_NODE_EXPANSION_ID=
"http://apache.org/xml/features/dom/defer-node-expansion";
public static void main(String[] args) {
DOMParser parser = new DOMParser();
//ParserErrorHandler errHandler = new ParserErrorHandler();
// attempt to activate desired features
try{
//validate the xml definition according to the dtd/xml
schema
parser.setFeature(NAMESPACES_FEATURE_ID, true);
parser.setFeature(SCHEMA_VALIDATION_FEATURE_ID, true);
parser.setFeature(SCHEMA_FULL_CHECKING_FEATURE_ID, true);
parser.setFeature(SCHEMA_ELEMENT_DEFAULT_ID, true);
parser.setFeature(SCHEMA_NORMALIZED_VALUE_ID, true);
parser.setFeature(VALIDATION_FEATURE_ID, true);
parser.setFeature(DEFERRED_NODE_EXPANSION_ID, false);
}catch (SAXException se) {
se.printStackTrace();
}
if (args.length == 0) {
System.out.println("Only argument is xml file to be
parsed.");
System.exit(1);
}
FileInputStream stream;
try {
stream = new FileInputStream(new File(args[0]));
} catch (FileNotFoundException e) {
System.out.print(e.getMessage());
return;
}
//parser.setErrorHandler(errHandler);
InputSource in=new InputSource(stream);
try {
parser.parse(in);
} catch (SAXException e1) {
e1.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
}
System.out.println("Program finished succesfully");
}
}
Ron Rothblum
Active Technologies Department
IBM Haifa Research Labs
Phone: +972 4 829-6459
|---------+---------------------------->
| | "K. Venugopal" |
| | <[EMAIL PROTECTED]|
| | com> |
| | |
| | 11/06/2003 11:50 |
| | Please respond to|
| | xerces-j-user |
|---------+---------------------------->
>--------------------------------------------------------------------------------------------------------------|
|
|
| To: [EMAIL PROTECTED]
|
| cc:
|
| Subject: Re: Bug with patterns?
|
>--------------------------------------------------------------------------------------------------------------|
Hi Ron ,
I was not successful in reproducing the hang (you are facing) using
samples xml files you posted .May be i am missing some thing
Regards
venu
Ron Rothblum wrote:
>I've been getting a strange bug from xerces - when I parse an xml with an
>attribute that does not conform to the pattern defined in my schema,
>the parser just gets stuck and won't proceed after the parse() command. I
>AM getting reports of the error to my error handler but the parser remains
>stuck.
>
>I'm sorry if this issue has been previously covered but the archives are
>down...
>
>Thanks,
>
>Ron.
>
>Ron Rothblum
>Active Technologies Department
>IBM Haifa Research Labs
>Phone: +972 4 829-6459
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]