forked from mojohaus/xml-maven-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request mojohaus#13 from G-Ork/master
Added support for xinclude in transformation and validation
- Loading branch information
Showing
33 changed files
with
884 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
invoker.goals = clean xml:validate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright 2006 The Apache Software Foundation. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.codehaus.mojo.xml</groupId> | ||
<artifactId>xinclude</artifactId> | ||
<version>0.1</version> | ||
<name>Maven XML Plugin IT xinclude - validate</name> | ||
<description>Integration Test to check xinclude awarenes for the Maven XML Plugin</description> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>xml-maven-plugin</artifactId> | ||
<version>@pom.version@</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>validate</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<validationSets> | ||
<validationSet> | ||
<xincludeAware>true</xincludeAware> | ||
<dir>src/main/xml</dir> | ||
<includes> | ||
<include>book.xml</include> | ||
</includes> | ||
<systemId>src/main/xsd/schema.xsd</systemId> | ||
</validationSet> | ||
</validationSets> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!-- | ||
Copyright 2006 The Apache Software Foundation. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<book xmlns:xi="http://www.w3.org/2001/XInclude" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="../xsd/schema.xsd" > | ||
|
||
<xi:include href="chapter.xml"/> | ||
</book> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!-- | ||
Copyright 2006 The Apache Software Foundation. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<chapter xmlns:xi="http://www.w3.org/2001/XInclude" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="../xsd/schema.xsd" > | ||
|
||
<xi:include href="section.xml"/> | ||
|
||
</chapter> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!-- | ||
Copyright 2006 The Apache Software Foundation. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<section xmlns:xi="http://www.w3.org/2001/XInclude" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="../xsd/schema.xsd" > | ||
Hello World | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<!-- | ||
Copyright 2006 The Apache Software Foundation. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<xs:schema | ||
xmlns:xi="http://www.w3.org/2001/XInclude" | ||
xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||
elementFormDefault="qualified" attributeFormDefault="unqualified"> | ||
|
||
<xs:import namespace="http://www.w3.org/XML/1998/namespace" | ||
schemaLocation="http://www.w3.org/2001/03/xml.xsd" /> | ||
|
||
<xs:element name="book" type="book"/> | ||
<xs:element name="chapter" type="chapter"/> | ||
<xs:element name="section" type="section"/> | ||
|
||
<xs:complexType name="book" > | ||
<xs:sequence> | ||
<xs:element name="chapter" minOccurs="1" maxOccurs="unbounded" | ||
type="chapter" /> | ||
</xs:sequence> | ||
<xs:attribute ref="xml:base" use="optional"/> | ||
</xs:complexType> | ||
|
||
<xs:complexType name="chapter"> | ||
<xs:sequence> | ||
<xs:element name="section" minOccurs="1" maxOccurs="unbounded" | ||
type="section" /> | ||
</xs:sequence> | ||
<xs:attribute ref="xml:base" use="optional"/> | ||
</xs:complexType> | ||
|
||
<xs:complexType name="section" mixed="true"> | ||
<xs:sequence> | ||
<xs:any minOccurs="0" /> | ||
</xs:sequence> | ||
<xs:attribute ref="xml:base" use="optional"/> | ||
</xs:complexType> | ||
|
||
|
||
</xs:schema> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
invoker.goals = clean xml:transform |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright 2006 The Apache Software Foundation. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.codehaus.mojo.xml</groupId> | ||
<artifactId>xinclude</artifactId> | ||
<version>0.1</version> | ||
<name>Maven XML Plugin IT xinclude - transform</name> | ||
<description>Integration Test to check xinclude awarenes for the Maven XML Plugin</description> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>xml-maven-plugin</artifactId> | ||
<version>@pom.version@</version> | ||
<configuration> | ||
<transformationSets> | ||
<transformationSet> | ||
<xincludeAware>true</xincludeAware> | ||
<dir>src/main/xml</dir> | ||
<stylesheet>src/main/xsl/copy.xsl</stylesheet> | ||
<includes> | ||
<include>book.xml</include> | ||
</includes> | ||
</transformationSet> | ||
|
||
<transformationSet> | ||
<xincludeAware>false</xincludeAware> | ||
<dir>src/main/xml</dir> | ||
<stylesheet>src/main/xsl/copy.xsl</stylesheet> | ||
<includes> | ||
<include>chapter.xml</include> | ||
</includes> | ||
</transformationSet> | ||
</transformationSets> | ||
<forceCreation>true</forceCreation> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!-- | ||
Copyright 2006 The Apache Software Foundation. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<book xmlns:xi="http://www.w3.org/2001/XInclude"> | ||
<xi:include href="chapter.xml" xpointer="element(/1)"/> | ||
</book> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!-- | ||
Copyright 2006 The Apache Software Foundation. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<chapter xmlns:xi="http://www.w3.org/2001/XInclude"> | ||
<xi:include href="section.xml" xpointer="element(/1)"> | ||
<xi:fallback> | ||
<fallbackSection/> | ||
</xi:fallback> | ||
</xi:include> | ||
</chapter> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!-- | ||
Copyright 2006 The Apache Software Foundation. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<section xmlns:xi="http://www.w3.org/2001/XInclude">Hello World</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!-- | ||
Copyright 2006 The Apache Software Foundation. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | ||
|
||
<xsl:template match="comment()|processing-instruction()|text()"> | ||
<xsl:copy/> | ||
</xsl:template> | ||
<xsl:template match="*"> | ||
<xsl:copy> | ||
<xsl:copy-of select="@*"/> | ||
<xsl:apply-templates select="comment()|processing-instruction()|text()|*"/> | ||
</xsl:copy> | ||
</xsl:template> | ||
</xsl:stylesheet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import org.codehaus.plexus.util.FileUtils | ||
|
||
File xmlFile = new File(basedir, "/target/generated-resources/xml/xslt/book.xml") | ||
assert xmlFile.isFile() | ||
|
||
def book = new XmlSlurper().parse(xmlFile) | ||
|
||
assert book instanceof groovy.util.slurpersupport.GPathResult | ||
|
||
assert book.chapter.section == 'Hello World' | ||
|
Oops, something went wrong.