  | |  | Help needed: cannot resolve symbol symbol : method getConfig () | Help needed: cannot resolve symbol symbol : method getConfig () 2004-08-25 - By Mike Hao
Hi there,
I am trying to use the DOM Level 3 functionalities. I checked out the xml -xerces source from the apach CVS, and built Xerces using the jars-dom3 target, and I got two new jar files: dom3-xml-apis.jar and the dom3-xercesImpl.jar. I included these new jars in my classpath and I run a testing program, but get some compiling error:
C:\Temp>javac Test.java Test.java:35: cannot resolve symbol symbol : method getConfig () location: interface org.w3c.dom.Document DOMConfiguration config = document.getConfig(); ^ Test.java:37: cannot resolve symbol symbol : method setDocumentURI (java.lang.String) location: interface org.w3c.dom.Document document.setDocumentURI("file:///c:/data"); ^ Test.java:43: cannot resolve symbol symbol : method normalizeDocument () location: interface org.w3c.dom.Document document.normalizeDocument(); ^ 3 errors
The following is my test code:
public class Test{
public static void main(String[] args){
Document document = null;
String xmlFile = "file:///c:/data/personal.xml";
try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); document = builder.parse(xmlFile); DOMConfiguration config = document.getConfig(); document.setDocumentURI("file:///c:/data"); config.setParameter("schema-type", "http://www.w3.org/2001/XMLSchema"); config.setParameter("validate", Boolean.TRUE); config.setParameter("schema-location", "personal.xsd"); document.normalizeDocument();
} catch (FactoryConfigurationError e) { // unable to get a document builder factory } catch (ParserConfigurationException e) { // parser was unable to be configured } catch (SAXException e) { // parsing error } catch (IOException e) { // i/o error }
}
}
Can anyone tell me what's going wrong?
Thanks,
Mike
--------------------------------- Do you Yahoo!? Win 1 of 4,000 free domain names from Yahoo! Enter now. <P>Hi there,</P> <P>I am trying to use the DOM Level 3 functionalities. I checked out the xml -xerces source from the apach CVS, and built Xerces using the jars-dom3 target, and I got two new jar files: dom3-xml-apis.jar and the dom3-xercesImpl.jar. I included these new jars in my classpath and I run a testing program, but get some compiling error: </P> <P>C:\Temp>javac Test.java<BR>Test.java:35: cannot resolve symbol<BR>symbol : method getConfig ()<BR>location: interface org.w3c.dom.Document<BR> DOMConfiguration config = document.getConfig();<BR> ^<BR>Test.java:37: cannot resolve symbol<BR>symbol : method setDocumentURI (java.lang.String)<BR >location: interface org.w3c.dom.Document<BR>   ; document.setDocumentURI( "<A href="file:///c:/data">file:///c:/data</A>");<BR>   ; ^<BR>Test.java:43: cannot resolve symbol<BR >symbol : method normalizeDocument ()<BR>location: interface org.w3c.dom .Document<BR> document.normalizeDocument();<BR> ^<BR>3 errors</P> <P>The following is my test code:</P> <P>public class Test{</P> <P> public static void main(String[] args){</P> <P> Document document = null;</P> <P> String xmlFile = "<A href="file:///c:/data/personal.xml">file:///c:/data /personal.xml</A>"; </P> <P> try {<BR>   ;DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();<BR>  ; DocumentBuilder builder = factory .newDocumentBuilder();<BR> document = builder.parse(xmlFile);<BR> DOMConfiguration config = document .getConfig();<BR> <BR> document.setDocumentURI("<A href="file:///c:/data">file:///c:/data</A>");<BR> <BR> config.setParameter("schema-type", "<A href="http://www.w3.org/2001 /XMLSchema">http://www.w3.org/2001/XMLSchema</A>");<BR> config .setParameter("validate", Boolean.TRUE);<BR> config .setParameter("schema-location", "personal.xsd");<BR> <BR>   ; document.normalizeDocument();</P> <P> } catch (FactoryConfigurationError e) {<BR> // unable to get a document builder factory<BR> } catch (ParserConfigurationException e) {<BR> // parser was unable to be configured<BR> } catch (SAXException e) {<BR> // parsing error<BR> } catch (IOException e) {<BR> // i/o error<BR > } <BR> </P> <P> }</P> <P>}</P> <P>Can anyone tell me what's going wrong?</P> <P>Thanks,</P> <P>Mike</P> <P> </P> <P> </P> <P> </P><p> <hr size=1>Do you Yahoo!?<br> Win 1 of 4,000 free domain names from Yahoo! <a href="http://us.rd.yahoo.com/evt=26640/*http://promotions.yahoo.com/goldrush" >Enter now</a>.
|
|
 |