Hi,
 
I figured out the reason for the error I got. The name of the method getConfig() has been changed to getDomConfig().
 
Thanks,
 
Mike

Mike Hao <[EMAIL PROTECTED]> wrote:

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.


Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!

Reply via email to