You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Andrew Robinson <an...@gmail.com> on 2010/01/07 00:21:59 UTC

Need some help with the commons digester and XInclude handling

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

Re: Need some help with the commons digester and XInclude handling

Posted by Andrew Robinson <an...@gmail.com>.
Okay,

I figured it out. It turns out Java does not support the xpointer
attribute fully. Looking into the maven-faces-plugin further, I
noticed that it uses digester rules to parse the includes manually. By
adding extra rules to pick up includes in the component-metadata where
the event-types live for the client behavior support, it is now
successfully processing those files. So it turns out that the
xincludes are not processed by the XML engine in the plugin at all,
they are always handled manually.

Man I wish I picked up on this sooner.

-Andrew

On Thu, Jan 7, 2010 at 11:00 AM, Matthias Wessendorf <ma...@apache.org> wrote:
> phew,
>
> that is odd. Did google have some hints? Or ever asked at the digester group?
> (maybe that is not so active?)
>
> -Matthias
>
> On Thu, Jan 7, 2010 at 6:37 PM, Andrew Robinson
> <an...@gmail.com> wrote:
>> Okay, if I compile with Java6 but run the tests with Java5 it works,
>> the xpointer is processed fine. Perhaps there is a problem with the
>> Java 6 on linux?
>> java version "1.6.0_15"
>> Java(TM) SE Runtime Environment (build 1.6.0_15-b03)
>> Java HotSpot(TM) 64-Bit Server VM (build 14.1-b02, mixed mode)
>>
>> Or is anyone aware of changes to the XML parsing in Java6 that require
>> different code for xinclude parsing?
>>
>> -Andrew
>>
>> On Wed, Jan 6, 2010 at 6:10 PM, Andrew Robinson
>> <an...@gmail.com> wrote:
>>> Giving up for the night, but I found that this works:
>>>    <xi:include href="TestInclude.xml" />
>>>
>>> But not this:
>>>    <xi:include href="./TestInclude.xml" xpointer="/faces-config/component/*"/>
>>>
>>> If the xpointer attribute has any value at all it seems to fail.
>>>
>>> On Wed, Jan 6, 2010 at 5:33 PM, Andrew Robinson
>>> <an...@gmail.com> wrote:
>>>> Update:
>>>>
>>>> I changed the code to this:
>>>>  public void merge(
>>>>    FacesConfigBean owner,
>>>>    URL             url) throws MojoExecutionException
>>>>  {
>>>>    try
>>>>    {
>>>>      URLConnection conn = url.openConnection();
>>>>      long lastModified = conn.getLastModified();
>>>>
>>>>      // Establish the current last-modified value
>>>>      // As new components are added, they will remember
>>>>      // this current value as their own last-modified
>>>>      owner.touch(lastModified);
>>>>
>>>>      Digester digester = createDigester();
>>>>      digester.push(url);
>>>>      digester.push(owner);
>>>>      digester.parse(url.toExternalForm());
>>>>    }
>>>>
>>>> Now the path is correct:
>>>> resolveEntity('null',
>>>> 'file:/home/anrobins/development/maven-trinidad/branches/2.0.0-branch/maven-faces-plugin/target/test-classes/META-INF/maven-faces-plugin/components/trinidad/faces/TestInclude.xml')
>>>>
>>>> testGenerate(org.apache.myfaces.trinidadbuild.plugin.faces.GenerateComponentsMojoTest)
>>>>  Time elapsed: 0.359 sec  <<< ERROR!
>>>> org.apache.maven.plugin.MojoExecutionException: Failed to parse
>>>> file:/home/anrobins/development/maven-trinidad/branches/2.0.0-branch/maven-faces-plugin/target/test-classes/META-INF/maven-faces-plugin/components/trinidad/faces/Command.xml
>>>>        at org.apache.myfaces.trinidadbuild.plugin.faces.parse.FacesConfigParser.merge(FacesConfigParser.java:68)
>>>>        at org.apache.myfaces.trinidadbuild.plugin.faces.AbstractFacesMojo.processIndexEntry(AbstractFacesMojo.java:297)
>>>>        at org.apache.myfaces.trinidadbuild.plugin.faces.AbstractFacesMojo.processIndex(AbstractFacesMojo.java:287)
>>>>        at org.apache.myfaces.trinidadbuild.plugin.faces.GenerateComponentsMojo.execute(GenerateComponentsMojo.java:59)
>>>>        at org.apache.myfaces.trinidadbuild.plugin.faces.GenerateComponentsMojoTest.testGenerate(GenerateComponentsMojoTest.java:89)
>>>> Caused by: org.xml.sax.SAXParseException: An 'include' failed, and no
>>>> 'fallback' element was found.
>>>>        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1231)
>>>>        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
>>>>        at org.apache.commons.digester.Digester.parse(Digester.java:1836)
>>>>        at org.apache.myfaces.trinidadbuild.plugin.faces.parse.FacesConfigParser.merge(FacesConfigParser.java:60)
>>>>        ... 30 more
>>>>
>>>> But the include still fails with no helpful information. Still would
>>>> not mind any help.
>>>>
>>>> Thanks,
>>>> Andrew
>>>>
>>>> On Wed, Jan 6, 2010 at 4:51 PM, Andrew Robinson
>>>> <an...@gmail.com> wrote:
>>>>> Forgot to mention that it is looking for:
>>>>> /home/anrobins/development/maven-trinidad/branches/2.0.0-branch/maven-faces-plugin/TestInclude.xml
>>>>> but the correct path is:
>>>>> /home/anrobins/development/maven-trinidad/branches/2.0.0-branch/maven-faces-plugin/src/test/resources/META-INF/maven-faces-plugin/components/trinidad/faces/TestInclude.xml
>>>>>
>>>>> So I need to figure out how to set the base URL for the relative URL handling.
>>>>>
>>>>> -Andrew
>>>>>
>>>>>
>>>>> On Wed, Jan 6, 2010 at 4:21 PM, Andrew Robinson
>>>>> <an...@gmail.com> wrote:
>>>>>> 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
>>>>>>
>>>>>
>>>>
>>>
>>
>
>
>
> --
> Matthias Wessendorf
>
> blog: http://matthiaswessendorf.wordpress.com/
> sessions: http://www.slideshare.net/mwessendorf
> twitter: http://twitter.com/mwessendorf
>

Re: Need some help with the commons digester and XInclude handling

Posted by Matthias Wessendorf <ma...@apache.org>.
phew,

that is odd. Did google have some hints? Or ever asked at the digester group?
(maybe that is not so active?)

-Matthias

On Thu, Jan 7, 2010 at 6:37 PM, Andrew Robinson
<an...@gmail.com> wrote:
> Okay, if I compile with Java6 but run the tests with Java5 it works,
> the xpointer is processed fine. Perhaps there is a problem with the
> Java 6 on linux?
> java version "1.6.0_15"
> Java(TM) SE Runtime Environment (build 1.6.0_15-b03)
> Java HotSpot(TM) 64-Bit Server VM (build 14.1-b02, mixed mode)
>
> Or is anyone aware of changes to the XML parsing in Java6 that require
> different code for xinclude parsing?
>
> -Andrew
>
> On Wed, Jan 6, 2010 at 6:10 PM, Andrew Robinson
> <an...@gmail.com> wrote:
>> Giving up for the night, but I found that this works:
>>    <xi:include href="TestInclude.xml" />
>>
>> But not this:
>>    <xi:include href="./TestInclude.xml" xpointer="/faces-config/component/*"/>
>>
>> If the xpointer attribute has any value at all it seems to fail.
>>
>> On Wed, Jan 6, 2010 at 5:33 PM, Andrew Robinson
>> <an...@gmail.com> wrote:
>>> Update:
>>>
>>> I changed the code to this:
>>>  public void merge(
>>>    FacesConfigBean owner,
>>>    URL             url) throws MojoExecutionException
>>>  {
>>>    try
>>>    {
>>>      URLConnection conn = url.openConnection();
>>>      long lastModified = conn.getLastModified();
>>>
>>>      // Establish the current last-modified value
>>>      // As new components are added, they will remember
>>>      // this current value as their own last-modified
>>>      owner.touch(lastModified);
>>>
>>>      Digester digester = createDigester();
>>>      digester.push(url);
>>>      digester.push(owner);
>>>      digester.parse(url.toExternalForm());
>>>    }
>>>
>>> Now the path is correct:
>>> resolveEntity('null',
>>> 'file:/home/anrobins/development/maven-trinidad/branches/2.0.0-branch/maven-faces-plugin/target/test-classes/META-INF/maven-faces-plugin/components/trinidad/faces/TestInclude.xml')
>>>
>>> testGenerate(org.apache.myfaces.trinidadbuild.plugin.faces.GenerateComponentsMojoTest)
>>>  Time elapsed: 0.359 sec  <<< ERROR!
>>> org.apache.maven.plugin.MojoExecutionException: Failed to parse
>>> file:/home/anrobins/development/maven-trinidad/branches/2.0.0-branch/maven-faces-plugin/target/test-classes/META-INF/maven-faces-plugin/components/trinidad/faces/Command.xml
>>>        at org.apache.myfaces.trinidadbuild.plugin.faces.parse.FacesConfigParser.merge(FacesConfigParser.java:68)
>>>        at org.apache.myfaces.trinidadbuild.plugin.faces.AbstractFacesMojo.processIndexEntry(AbstractFacesMojo.java:297)
>>>        at org.apache.myfaces.trinidadbuild.plugin.faces.AbstractFacesMojo.processIndex(AbstractFacesMojo.java:287)
>>>        at org.apache.myfaces.trinidadbuild.plugin.faces.GenerateComponentsMojo.execute(GenerateComponentsMojo.java:59)
>>>        at org.apache.myfaces.trinidadbuild.plugin.faces.GenerateComponentsMojoTest.testGenerate(GenerateComponentsMojoTest.java:89)
>>> Caused by: org.xml.sax.SAXParseException: An 'include' failed, and no
>>> 'fallback' element was found.
>>>        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1231)
>>>        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
>>>        at org.apache.commons.digester.Digester.parse(Digester.java:1836)
>>>        at org.apache.myfaces.trinidadbuild.plugin.faces.parse.FacesConfigParser.merge(FacesConfigParser.java:60)
>>>        ... 30 more
>>>
>>> But the include still fails with no helpful information. Still would
>>> not mind any help.
>>>
>>> Thanks,
>>> Andrew
>>>
>>> On Wed, Jan 6, 2010 at 4:51 PM, Andrew Robinson
>>> <an...@gmail.com> wrote:
>>>> Forgot to mention that it is looking for:
>>>> /home/anrobins/development/maven-trinidad/branches/2.0.0-branch/maven-faces-plugin/TestInclude.xml
>>>> but the correct path is:
>>>> /home/anrobins/development/maven-trinidad/branches/2.0.0-branch/maven-faces-plugin/src/test/resources/META-INF/maven-faces-plugin/components/trinidad/faces/TestInclude.xml
>>>>
>>>> So I need to figure out how to set the base URL for the relative URL handling.
>>>>
>>>> -Andrew
>>>>
>>>>
>>>> On Wed, Jan 6, 2010 at 4:21 PM, Andrew Robinson
>>>> <an...@gmail.com> wrote:
>>>>> 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
>>>>>
>>>>
>>>
>>
>



-- 
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf

Re: Need some help with the commons digester and XInclude handling

Posted by Andrew Robinson <an...@gmail.com>.
Okay, if I compile with Java6 but run the tests with Java5 it works,
the xpointer is processed fine. Perhaps there is a problem with the
Java 6 on linux?
java version "1.6.0_15"
Java(TM) SE Runtime Environment (build 1.6.0_15-b03)
Java HotSpot(TM) 64-Bit Server VM (build 14.1-b02, mixed mode)

Or is anyone aware of changes to the XML parsing in Java6 that require
different code for xinclude parsing?

-Andrew

On Wed, Jan 6, 2010 at 6:10 PM, Andrew Robinson
<an...@gmail.com> wrote:
> Giving up for the night, but I found that this works:
>    <xi:include href="TestInclude.xml" />
>
> But not this:
>    <xi:include href="./TestInclude.xml" xpointer="/faces-config/component/*"/>
>
> If the xpointer attribute has any value at all it seems to fail.
>
> On Wed, Jan 6, 2010 at 5:33 PM, Andrew Robinson
> <an...@gmail.com> wrote:
>> Update:
>>
>> I changed the code to this:
>>  public void merge(
>>    FacesConfigBean owner,
>>    URL             url) throws MojoExecutionException
>>  {
>>    try
>>    {
>>      URLConnection conn = url.openConnection();
>>      long lastModified = conn.getLastModified();
>>
>>      // Establish the current last-modified value
>>      // As new components are added, they will remember
>>      // this current value as their own last-modified
>>      owner.touch(lastModified);
>>
>>      Digester digester = createDigester();
>>      digester.push(url);
>>      digester.push(owner);
>>      digester.parse(url.toExternalForm());
>>    }
>>
>> Now the path is correct:
>> resolveEntity('null',
>> 'file:/home/anrobins/development/maven-trinidad/branches/2.0.0-branch/maven-faces-plugin/target/test-classes/META-INF/maven-faces-plugin/components/trinidad/faces/TestInclude.xml')
>>
>> testGenerate(org.apache.myfaces.trinidadbuild.plugin.faces.GenerateComponentsMojoTest)
>>  Time elapsed: 0.359 sec  <<< ERROR!
>> org.apache.maven.plugin.MojoExecutionException: Failed to parse
>> file:/home/anrobins/development/maven-trinidad/branches/2.0.0-branch/maven-faces-plugin/target/test-classes/META-INF/maven-faces-plugin/components/trinidad/faces/Command.xml
>>        at org.apache.myfaces.trinidadbuild.plugin.faces.parse.FacesConfigParser.merge(FacesConfigParser.java:68)
>>        at org.apache.myfaces.trinidadbuild.plugin.faces.AbstractFacesMojo.processIndexEntry(AbstractFacesMojo.java:297)
>>        at org.apache.myfaces.trinidadbuild.plugin.faces.AbstractFacesMojo.processIndex(AbstractFacesMojo.java:287)
>>        at org.apache.myfaces.trinidadbuild.plugin.faces.GenerateComponentsMojo.execute(GenerateComponentsMojo.java:59)
>>        at org.apache.myfaces.trinidadbuild.plugin.faces.GenerateComponentsMojoTest.testGenerate(GenerateComponentsMojoTest.java:89)
>> Caused by: org.xml.sax.SAXParseException: An 'include' failed, and no
>> 'fallback' element was found.
>>        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1231)
>>        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
>>        at org.apache.commons.digester.Digester.parse(Digester.java:1836)
>>        at org.apache.myfaces.trinidadbuild.plugin.faces.parse.FacesConfigParser.merge(FacesConfigParser.java:60)
>>        ... 30 more
>>
>> But the include still fails with no helpful information. Still would
>> not mind any help.
>>
>> Thanks,
>> Andrew
>>
>> On Wed, Jan 6, 2010 at 4:51 PM, Andrew Robinson
>> <an...@gmail.com> wrote:
>>> Forgot to mention that it is looking for:
>>> /home/anrobins/development/maven-trinidad/branches/2.0.0-branch/maven-faces-plugin/TestInclude.xml
>>> but the correct path is:
>>> /home/anrobins/development/maven-trinidad/branches/2.0.0-branch/maven-faces-plugin/src/test/resources/META-INF/maven-faces-plugin/components/trinidad/faces/TestInclude.xml
>>>
>>> So I need to figure out how to set the base URL for the relative URL handling.
>>>
>>> -Andrew
>>>
>>>
>>> On Wed, Jan 6, 2010 at 4:21 PM, Andrew Robinson
>>> <an...@gmail.com> wrote:
>>>> 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
>>>>
>>>
>>
>

Re: Need some help with the commons digester and XInclude handling

Posted by Andrew Robinson <an...@gmail.com>.
Giving up for the night, but I found that this works:
    <xi:include href="TestInclude.xml" />

But not this:
    <xi:include href="./TestInclude.xml" xpointer="/faces-config/component/*"/>

If the xpointer attribute has any value at all it seems to fail.

On Wed, Jan 6, 2010 at 5:33 PM, Andrew Robinson
<an...@gmail.com> wrote:
> Update:
>
> I changed the code to this:
>  public void merge(
>    FacesConfigBean owner,
>    URL             url) throws MojoExecutionException
>  {
>    try
>    {
>      URLConnection conn = url.openConnection();
>      long lastModified = conn.getLastModified();
>
>      // Establish the current last-modified value
>      // As new components are added, they will remember
>      // this current value as their own last-modified
>      owner.touch(lastModified);
>
>      Digester digester = createDigester();
>      digester.push(url);
>      digester.push(owner);
>      digester.parse(url.toExternalForm());
>    }
>
> Now the path is correct:
> resolveEntity('null',
> 'file:/home/anrobins/development/maven-trinidad/branches/2.0.0-branch/maven-faces-plugin/target/test-classes/META-INF/maven-faces-plugin/components/trinidad/faces/TestInclude.xml')
>
> testGenerate(org.apache.myfaces.trinidadbuild.plugin.faces.GenerateComponentsMojoTest)
>  Time elapsed: 0.359 sec  <<< ERROR!
> org.apache.maven.plugin.MojoExecutionException: Failed to parse
> file:/home/anrobins/development/maven-trinidad/branches/2.0.0-branch/maven-faces-plugin/target/test-classes/META-INF/maven-faces-plugin/components/trinidad/faces/Command.xml
>        at org.apache.myfaces.trinidadbuild.plugin.faces.parse.FacesConfigParser.merge(FacesConfigParser.java:68)
>        at org.apache.myfaces.trinidadbuild.plugin.faces.AbstractFacesMojo.processIndexEntry(AbstractFacesMojo.java:297)
>        at org.apache.myfaces.trinidadbuild.plugin.faces.AbstractFacesMojo.processIndex(AbstractFacesMojo.java:287)
>        at org.apache.myfaces.trinidadbuild.plugin.faces.GenerateComponentsMojo.execute(GenerateComponentsMojo.java:59)
>        at org.apache.myfaces.trinidadbuild.plugin.faces.GenerateComponentsMojoTest.testGenerate(GenerateComponentsMojoTest.java:89)
> Caused by: org.xml.sax.SAXParseException: An 'include' failed, and no
> 'fallback' element was found.
>        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1231)
>        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
>        at org.apache.commons.digester.Digester.parse(Digester.java:1836)
>        at org.apache.myfaces.trinidadbuild.plugin.faces.parse.FacesConfigParser.merge(FacesConfigParser.java:60)
>        ... 30 more
>
> But the include still fails with no helpful information. Still would
> not mind any help.
>
> Thanks,
> Andrew
>
> On Wed, Jan 6, 2010 at 4:51 PM, Andrew Robinson
> <an...@gmail.com> wrote:
>> Forgot to mention that it is looking for:
>> /home/anrobins/development/maven-trinidad/branches/2.0.0-branch/maven-faces-plugin/TestInclude.xml
>> but the correct path is:
>> /home/anrobins/development/maven-trinidad/branches/2.0.0-branch/maven-faces-plugin/src/test/resources/META-INF/maven-faces-plugin/components/trinidad/faces/TestInclude.xml
>>
>> So I need to figure out how to set the base URL for the relative URL handling.
>>
>> -Andrew
>>
>>
>> On Wed, Jan 6, 2010 at 4:21 PM, Andrew Robinson
>> <an...@gmail.com> wrote:
>>> 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
>>>
>>
>

Re: Need some help with the commons digester and XInclude handling

Posted by Andrew Robinson <an...@gmail.com>.
Update:

I changed the code to this:
  public void merge(
    FacesConfigBean owner,
    URL             url) throws MojoExecutionException
  {
    try
    {
      URLConnection conn = url.openConnection();
      long lastModified = conn.getLastModified();

      // Establish the current last-modified value
      // As new components are added, they will remember
      // this current value as their own last-modified
      owner.touch(lastModified);

      Digester digester = createDigester();
      digester.push(url);
      digester.push(owner);
      digester.parse(url.toExternalForm());
    }

Now the path is correct:
resolveEntity('null',
'file:/home/anrobins/development/maven-trinidad/branches/2.0.0-branch/maven-faces-plugin/target/test-classes/META-INF/maven-faces-plugin/components/trinidad/faces/TestInclude.xml')

testGenerate(org.apache.myfaces.trinidadbuild.plugin.faces.GenerateComponentsMojoTest)
 Time elapsed: 0.359 sec  <<< ERROR!
org.apache.maven.plugin.MojoExecutionException: Failed to parse
file:/home/anrobins/development/maven-trinidad/branches/2.0.0-branch/maven-faces-plugin/target/test-classes/META-INF/maven-faces-plugin/components/trinidad/faces/Command.xml
	at org.apache.myfaces.trinidadbuild.plugin.faces.parse.FacesConfigParser.merge(FacesConfigParser.java:68)
	at org.apache.myfaces.trinidadbuild.plugin.faces.AbstractFacesMojo.processIndexEntry(AbstractFacesMojo.java:297)
	at org.apache.myfaces.trinidadbuild.plugin.faces.AbstractFacesMojo.processIndex(AbstractFacesMojo.java:287)
	at org.apache.myfaces.trinidadbuild.plugin.faces.GenerateComponentsMojo.execute(GenerateComponentsMojo.java:59)
	at org.apache.myfaces.trinidadbuild.plugin.faces.GenerateComponentsMojoTest.testGenerate(GenerateComponentsMojoTest.java:89)
Caused by: org.xml.sax.SAXParseException: An 'include' failed, and no
'fallback' element was found.
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1231)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
	at org.apache.commons.digester.Digester.parse(Digester.java:1836)
	at org.apache.myfaces.trinidadbuild.plugin.faces.parse.FacesConfigParser.merge(FacesConfigParser.java:60)
	... 30 more

But the include still fails with no helpful information. Still would
not mind any help.

Thanks,
Andrew

On Wed, Jan 6, 2010 at 4:51 PM, Andrew Robinson
<an...@gmail.com> wrote:
> Forgot to mention that it is looking for:
> /home/anrobins/development/maven-trinidad/branches/2.0.0-branch/maven-faces-plugin/TestInclude.xml
> but the correct path is:
> /home/anrobins/development/maven-trinidad/branches/2.0.0-branch/maven-faces-plugin/src/test/resources/META-INF/maven-faces-plugin/components/trinidad/faces/TestInclude.xml
>
> So I need to figure out how to set the base URL for the relative URL handling.
>
> -Andrew
>
>
> On Wed, Jan 6, 2010 at 4:21 PM, Andrew Robinson
> <an...@gmail.com> wrote:
>> 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
>>
>

Re: Need some help with the commons digester and XInclude handling

Posted by Andrew Robinson <an...@gmail.com>.
Forgot to mention that it is looking for:
/home/anrobins/development/maven-trinidad/branches/2.0.0-branch/maven-faces-plugin/TestInclude.xml
but the correct path is:
/home/anrobins/development/maven-trinidad/branches/2.0.0-branch/maven-faces-plugin/src/test/resources/META-INF/maven-faces-plugin/components/trinidad/faces/TestInclude.xml

So I need to figure out how to set the base URL for the relative URL handling.

-Andrew


On Wed, Jan 6, 2010 at 4:21 PM, Andrew Robinson
<an...@gmail.com> wrote:
> 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
>