Hi
I hava a problem when parsing an InputSource with SAX and Xerces. 
when I'm parsing a file by giving its name, it's working fine:
Parser parser = ParserFactory.makeParser(parserName);
            parser.setDocumentHandler(counter);
            parser.setErrorHandler(counter);
                        
                        try {
                //if (validate && parser instanceof XMLReader)
                if ( parser instanceof XMLReader ){
                    ((XMLReader)parser).setFeature(
"http://xml.org/sax/features/validation";,
                                                    validate);
                    ((XMLReader)parser).setFeature(
"http://xml.org/sax/features/namespaces";,
                                                    setNameSpaces );
                    ((XMLReader)parser).setFeature(
"http://apache.org/xml/features/validation/schema";,
                                                    setSchemaSupport );
                    ((XMLReader)parser).setFeature(
"http://apache.org/xml/features/nonvalidating/load-external-dtd";,
                                                    setLoadExternalDTD );
                    ((XMLReader)parser).setFeature(
"http://apache.org/xml/features/validation/schema-full-checking";,
                                                    setSchemaFullSupport );

                }
            } catch (Exception ex) {
            }
                        if (!uri.equals(""))
              parser.parse(uri);

uri is the name of the file.
but when I try to do the same thing parsing an InputSource instead of an
url, it is not working. 
parser.parse(new InputSource(new StringReader(myString)))
make an error on the first tag. the error is something like:
[Error] :3:136: Element type "FIRSTTAG" must be declared.

Thanks for any help

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to