Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Parser Problems (jaxp)

843834Oct 9 2003 — edited Oct 9 2003
I am trying to parse a document and my program freezes at the factory.newDocumentBuilder() method. I have the same jar files that I have in my build path. I am confused. Any guidance would be appreciated. Thank you.

try{
System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
System.setProperty("javax.xml.parsers.SAXParserFactory", "org.apache.xerces.jaxp.SAXParserFactoryImpl");
System.setProperty("javax.xml.transform.TransformerFactory", "org.apache.xalan.processor.TransformerFactoryImpl");
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(false);
factory.setValidating(false);
////FREEZES HERE at factory.newDocumentBuilder()\\\\
DocumentBuilder builder = factory.newDocumentBuilder();
InputSource inps = new InputSource(new StringReader(xml));
Document doc = builder.parse(inps);
}catch (SAXException e) {
System.out.println(xml + " is not well-formed.");
return null;
} catch (FactoryConfigurationError e) {
System.out.println("Could not locate a factory class");
return null;
} catch (ParserConfigurationException e) {
System.out.println("Could not locate a JAXP parser");
return null;
} catch (Exception e) {
System.out.println("Exception: " + e.getMessage());
e.printStackTrace();
return null;
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 6 2003
Added on Oct 9 2003
8 comments
172 views