xerces-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anthony N. Frasso" <afra...@yahoo.com>
Subject Trouble with setSchema Method
Date Sat, 16 Jul 2005 23:16:41 GMT
Hello, and thanks in advance for all of your help.

I am currently using Xerces (for Java) version 2.7 on Mac OS X 10.3. 
Unfortunately, when I compile my java code, I get an error when
attempting to use the setSchema method of the DocumentBuilderFactory
class.  What is going wrong?

Specifically, I am trying to run the following code:

<code>
public static void main(String args[]) {

    try {

        // Parse the XML Schema Document
        SchemaFactory schemaFactory =
            SchemaFactory.newInstance(
                XMLConstants.W3C_XML_SCHEMA_NS_URI);
        Schema schema = schemaFactory.newSchema(
            new File("playlist.xsd"));
        System.out.println("Schema: " + schema);

        // Set up the XML Parser
        DocumentBuilderFactory documentBuilderFactory =
            DocumentBuilderFactory.newInstance();
        System.out.println("Factory: " + documentBuilderFactory);
        documentBuilderFactory.setSchema(schema);
        documentBuilderFactory.setValidating(true);
        documentBuilderFactory.setNamespaceAware(true);

        // Parse the XML Document
        DocumentBuilder documentBuilder =
            documentBuilderFactory.newDocumentBuilder();
        System.out.println("Builder: " + documentBuilder);
        documentBuilder.setErrorHandler(new ParserErrorHandler());
        return documentBuilder.parse(new File("episodes.xml"));

    } catch ....
}
</code>

>From the command prompt, I attempt to compile the program:

<code>
javac -classpath
Library/resolver.jar:Library/xml-apis.jar:Library/xercesImpl.jar
Source/com/gafungi/SchmediaPlayer/PlaylistParser.java
Source/com/gafungi/SchmediaPlayer/PlaylistParserErrorHandler.java
<code>

Unfortunately, when I run this, I get the following error:

<code>
Source/com/gafungi/SchmediaPlayer/PlaylistParser.java:26:
    cannot resolve symbol
symbol  : method setSchema (javax.xml.validation.Schema)
location: class javax.xml.parsers.DocumentBuilderFactory
            documentBuilderFactory.setSchema(schema);
</code>

Any and all help would be greatly appreciated!

Regards,
Anthony Frasso

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Mime
View raw message