tags:

views:

38

answers:

0

Here what I have.

      System.setProperty(
    "javax.xml.parsers.DocumentBuilderFactory",
  "net.sf.saxon.dom.DocumentBuilderFactoryImpl");


  DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
  //factory.setNamespaceAware(true);
  //factory.setIgnoringElementContentWhitespace(true);
  //factory.setValidating(false);
  //factory.setIgnoringComments(true);

  DocumentBuilder builder = factory.newDocumentBuilder();
  Document xml = builder.parse(file.getAbsolutePath());

Saxon parser doesn't allow me to set the commentet properties:

    javax.xml.parsers.ParserConfigurationException: Saxon parser does not allow whitespace in element content to be ignored
 at net.sf.saxon.dom.DocumentBuilderFactoryImpl.newDocumentBuilder(DocumentBuilderFactoryImpl.java:98)

I thought i could set those features in other way, like

factory.setAttribute(string, bool)
factory.setFeature(string, bool)

But I can't find anywhere the values for "string". I tried net.sf.saxon.FeatureKeys whitout success.

My question is: what's the correct way to do that?