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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]