Hey all, I could really use some help. I have been unable so far to
get the maven-faces-plugin to resolve xml includes in the 2.0.1
version of the plugins. I removed xerces and the other XML
dependencies from the POM so that it would use the Java built-in XML.
Then I made it XInclude aware:
static protected Digester createEmptyDigester()
throws ParserConfigurationException, SAXException
{
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setNamespaceAware(true);
// requires JAXP 1.3, in JavaSE 5.0
spf.setXIncludeAware(true);
Here is the logging output:
resolveEntity('null',
'file:///home/anrobins/development/maven-trinidad/branches/2.0.0-branch/maven-faces-plugin/TestInclude.xml')
Jan 6, 2010 4:10:54 PM org.apache.commons.digester.Digester fatalError
SEVERE: Parse Fatal Error at line 37 column 90: An 'include' failed,
and no 'fallback' element was found.
org.xml.sax.SAXParseException: An 'include' failed, and no 'fallback'
element was found.
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)
at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
at
com.sun.org.apache.xerces.internal.xinclude.XIncludeHandler.reportError(XIncludeHandler.java:2320)
at
com.sun.org.apache.xerces.internal.xinclude.XIncludeHandler.reportFatalError(XIncludeHandler.java:2315)
at
com.sun.org.apache.xerces.internal.xinclude.XIncludeHandler.reportFatalError(XIncludeHandler.java:2311)
at
com.sun.org.apache.xerces.internal.xinclude.XIncludeHandler.endElement(XIncludeHandler.java:1001)
I tried to turn on validation
spt.setValidating(true);
spf.setFeature("http://apache.org/xml/features/validation/schema", true);
But then I ran into this:
SEVERE: Parse Error at line 26 column 73: cvc-elt.1: Cannot find the
declaration of element 'faces-config'.
org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration
of element 'faces-config'.
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1887)
at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:685)
at
com.sun.org.apache.xerces.internal.xinclude.XIncludeHandler.startElement(XIncludeHandler.java:908)
at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400)
In my project I have some of the fmd:* attributes being pulled in
through xi:include elements. Not using include would be a very hard
thing as we have many includes. Anyone know what I can do to get the
includes parsing correctly with the digester?
Thank you!
-Andrew