This is an automated email from the ASF dual-hosted git repository. michaelo pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-doxia.git
The following commit(s) were added to refs/heads/master by this push: new 3b1499d0 [DOXIA-669] Improve/rework CachedFileEntityResolver 3b1499d0 is described below commit 3b1499d0572718fa4dcb7c6b775bedbe757d46c5 Author: Michael Osipov <micha...@apache.org> AuthorDate: Tue Aug 2 20:54:38 2022 +0200 [DOXIA-669] Improve/rework CachedFileEntityResolver This closes #115 --- .../maven/doxia/parser/AbstractXmlParser.java | 107 +++----- .../org/apache/maven/doxia/util/XmlValidator.java | 1 + doxia-core/src/main/resources/xml.xsd | 286 +++++++++++++++++++++ .../apache/maven/doxia/util/XmlValidatorTest.java | 4 +- doxia-core/src/test/resources/test.xhtml | 96 ++++--- .../src/test/resources/test.xml | 2 +- .../doxia-module-fml/src/test/resources/macro.fml | 96 +++---- .../src/test/resources/simpleFaq.fml | 2 +- .../doxia-module-fml/src/test/resources/test.fml | 2 +- .../src/main/resources/xdoc-2.0.xsd | 2 +- .../doxia-module-xdoc/src/test/resources/macro.xml | 2 +- .../src/test/resources/report.xml | 2 +- .../doxia-module-xdoc/src/test/resources/test.xml | 2 +- .../doxia-module-xdoc/src/test/resources/toc.xml | 2 +- .../src/test/resources/test.xhtml | 1 - pom.xml | 1 + 16 files changed, 433 insertions(+), 175 deletions(-) diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java b/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java index 61363bbd..1cf38ad6 100644 --- a/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java +++ b/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java @@ -21,17 +21,16 @@ package org.apache.maven.doxia.parser; import java.io.BufferedReader; import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; -import java.io.OutputStream; import java.io.Reader; import java.io.StringReader; +import java.net.URI; import java.net.URL; +import java.nio.file.Paths; +import java.util.HashMap; import java.util.Hashtable; import java.util.LinkedHashMap; -import java.util.Locale; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -43,13 +42,13 @@ import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet; import org.apache.maven.doxia.util.HtmlTools; import org.apache.maven.doxia.util.XmlValidator; -import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.StringUtils; import org.codehaus.plexus.util.xml.pull.MXParser; import org.codehaus.plexus.util.xml.pull.XmlPullParser; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; - +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; import org.xml.sax.SAXException; @@ -694,9 +693,25 @@ public abstract class AbstractXmlParser public static class CachedFileEntityResolver implements EntityResolver { + private static final Logger LOGGER = LoggerFactory.getLogger( CachedFileEntityResolver.class ); + /** Map with systemId as key and the content of systemId as byte[]. */ protected static final Map<String, byte[]> ENTITY_CACHE = new Hashtable<>(); + private static final Map<String, String> WELL_KNOWN_SYSTEM_IDS = new HashMap<>(); + + static + { + WELL_KNOWN_SYSTEM_IDS.put( "http://www.w3.org/2001/xml.xsd", "xml.xsd" ); + WELL_KNOWN_SYSTEM_IDS.put( "https://www.w3.org/2001/xml.xsd", "xml.xsd" ); + WELL_KNOWN_SYSTEM_IDS.put( "http://maven.apache.org/xsd/xdoc-2.0.xsd", "xdoc-2.0.xsd" ); + WELL_KNOWN_SYSTEM_IDS.put( "https://maven.apache.org/xsd/xdoc-2.0.xsd", "xdoc-2.0.xsd" ); + WELL_KNOWN_SYSTEM_IDS.put( "http://maven.apache.org/xsd/fml-1.0.1.xsd", "fml-1.0.1.xsd" ); + WELL_KNOWN_SYSTEM_IDS.put( "https://maven.apache.org/xsd/fml-1.0.1.xsd", "fml-1.0.1.xsd" ); + WELL_KNOWN_SYSTEM_IDS.put( "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent", "xhtml-lat1.ent" ); + WELL_KNOWN_SYSTEM_IDS.put( "https://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent", "xhtml-lat1.ent" ); + } + /** {@inheritDoc} */ public InputSource resolveEntity( String publicId, String systemId ) throws SAXException, IOException @@ -705,44 +720,36 @@ public abstract class AbstractXmlParser // already cached? if ( res == null ) { - String systemName = FileUtils.getFile( systemId ).getName(); - File temp = new File( System.getProperty( "java.io.tmpdir" ), systemName ); - // maybe already as a temp file? - if ( !temp.exists() ) + if ( WELL_KNOWN_SYSTEM_IDS.containsKey( systemId ) ) { - // is systemId a file or an url? - if ( systemId.toLowerCase( Locale.ENGLISH ).startsWith( "file" ) ) + String resource = "/" + WELL_KNOWN_SYSTEM_IDS.get( systemId ); + URL url = getClass().getResource( resource ); + if ( url != null ) { - // Doxia XSDs are included in the jars, so try to find the resource systemName from - // the classpath... - String resource = "/" + systemName; - URL url = getClass().getResource( resource ); - if ( url != null ) - { - res = toByteArray( url ); - } - else - { - throw new SAXException( "Could not find the SYSTEM entity: " + systemId - + " because '" + resource + "' is not available of the classpath." ); - } + LOGGER.debug( "Resolving SYSTEM '{}' from well-known classpath resource '{}'", + systemId, resource ); + res = toByteArray( url ); } - else + } + + if ( res == null ) + { + URI uri = URI.create( systemId ); + if ( uri.getScheme() == null ) { - res = toByteArray( new URL( systemId ) ); + uri = Paths.get( systemId ).toUri(); } - // write systemId as temp file - copy( res, temp ); - } - else - { - // TODO How to refresh Doxia XSDs from temp dir? - res = toByteArray( temp.toURI().toURL() ); + LOGGER.debug( "Resolving SYSTEM '{}' from URI resource '{}'", systemId, uri ); + res = toByteArray( uri.toURL() ); } ENTITY_CACHE.put( systemId, res ); } + else + { + LOGGER.debug( "Resolved SYSTEM '{}' from cache", systemId ); + } InputSource is = new InputSource( new ByteArrayInputStream( res ) ); is.setPublicId( publicId ); @@ -778,37 +785,5 @@ public abstract class AbstractXmlParser IOUtil.close( is ); } } - - /** - * Wrap {@link IOUtil#copy(byte[], OutputStream)} to throw SAXException. - * - * @param res not null array of byte - * @param f the file where to write the bytes - * @throws SAXException if any - * @see IOUtil#copy(byte[], OutputStream) - */ - private void copy( byte[] res, File f ) - throws SAXException - { - if ( f.isDirectory() ) - { - throw new SAXException( "'" + f.getAbsolutePath() + "' is a directory, can not write it." ); - } - - OutputStream os = null; - try - { - os = new FileOutputStream( f ); - IOUtil.copy( res, os ); - } - catch ( IOException e ) - { - throw new SAXException( e ); - } - finally - { - IOUtil.close( os ); - } - } } } diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/util/XmlValidator.java b/doxia-core/src/main/java/org/apache/maven/doxia/util/XmlValidator.java index 10cd9065..32d6121c 100644 --- a/doxia-core/src/main/java/org/apache/maven/doxia/util/XmlValidator.java +++ b/doxia-core/src/main/java/org/apache/maven/doxia/util/XmlValidator.java @@ -115,6 +115,7 @@ public class XmlValidator xmlReader = XMLReaderFactory.createXMLReader(); xmlReader.setFeature( "http://xml.org/sax/features/validation", true ); + xmlReader.setFeature( "http://apache.org/xml/features/validation/dynamic", true ); xmlReader.setFeature( "http://apache.org/xml/features/validation/schema", true ); xmlReader.setErrorHandler( errorHandler ); xmlReader.setEntityResolver( new CachedFileEntityResolver() ); diff --git a/doxia-core/src/main/resources/xml.xsd b/doxia-core/src/main/resources/xml.xsd new file mode 100644 index 00000000..543bda6b --- /dev/null +++ b/doxia-core/src/main/resources/xml.xsd @@ -0,0 +1,286 @@ +<?xml version='1.0'?> +<?xml-stylesheet href="../../2008/09/xsd.xsl" type="text/xsl"?> +<xs:schema targetNamespace="http://www.w3.org/XML/1998/namespace" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns ="http://www.w3.org/1999/xhtml" + xml:lang="en"> + + <xs:annotation> + <xs:documentation> + <div> + <h1>About the XML namespace</h1> + + <div class="bodytext"> + <p> + This schema document describes the XML namespace, in a form + suitable for import by other schema documents. + </p> + <p> + See <a href="http://www.w3.org/XML/1998/namespace.html"> + http://www.w3.org/XML/1998/namespace.html</a> and + <a href="http://www.w3.org/TR/REC-xml"> + http://www.w3.org/TR/REC-xml</a> for information + about this namespace. + </p> + <p> + Note that local names in this namespace are intended to be + defined only by the World Wide Web Consortium or its subgroups. + The names currently defined in this namespace are listed below. + They should not be used with conflicting semantics by any Working + Group, specification, or document instance. + </p> + <p> + See further below in this document for more information about <a + href="#usage">how to refer to this schema document from your own + XSD schema documents</a> and about <a href="#nsversioning">the + namespace-versioning policy governing this schema document</a>. + </p> + </div> + </div> + </xs:documentation> + </xs:annotation> + + <xs:attribute name="lang"> + <xs:annotation> + <xs:documentation> + <div> + + <h3>lang (as an attribute name)</h3> + <p> + denotes an attribute whose value + is a language code for the natural language of the content of + any element; its value is inherited. This name is reserved + by virtue of its definition in the XML specification.</p> + + </div> + <div> + <h4>Notes</h4> + <p> + Attempting to install the relevant ISO 2- and 3-letter + codes as the enumerated possible values is probably never + going to be a realistic possibility. + </p> + <p> + See BCP 47 at <a href="http://www.rfc-editor.org/rfc/bcp/bcp47.txt"> + http://www.rfc-editor.org/rfc/bcp/bcp47.txt</a> + and the IANA language subtag registry at + <a href="http://www.iana.org/assignments/language-subtag-registry"> + http://www.iana.org/assignments/language-subtag-registry</a> + for further information. + </p> + <p> + The union allows for the 'un-declaration' of xml:lang with + the empty string. + </p> + </div> + </xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:union memberTypes="xs:language"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:enumeration value=""/> + </xs:restriction> + </xs:simpleType> + </xs:union> + </xs:simpleType> + </xs:attribute> + + <xs:attribute name="space"> + <xs:annotation> + <xs:documentation> + <div> + + <h3>space (as an attribute name)</h3> + <p> + denotes an attribute whose + value is a keyword indicating what whitespace processing + discipline is intended for the content of the element; its + value is inherited. This name is reserved by virtue of its + definition in the XML specification.</p> + + </div> + </xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:NCName"> + <xs:enumeration value="default"/> + <xs:enumeration value="preserve"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + + <xs:attribute name="base" type="xs:anyURI"> <xs:annotation> + <xs:documentation> + <div> + + <h3>base (as an attribute name)</h3> + <p> + denotes an attribute whose value + provides a URI to be used as the base for interpreting any + relative URIs in the scope of the element on which it + appears; its value is inherited. This name is reserved + by virtue of its definition in the XML Base specification.</p> + + <p> + See <a + href="http://www.w3.org/TR/xmlbase/">http://www.w3.org/TR/xmlbase/</a> + for information about this attribute. + </p> + </div> + </xs:documentation> + </xs:annotation> + </xs:attribute> + + <xs:attribute name="id" type="xs:ID"> + <xs:annotation> + <xs:documentation> + <div> + + <h3>id (as an attribute name)</h3> + <p> + denotes an attribute whose value + should be interpreted as if declared to be of type ID. + This name is reserved by virtue of its definition in the + xml:id specification.</p> + + <p> + See <a + href="http://www.w3.org/TR/xml-id/">http://www.w3.org/TR/xml-id/</a> + for information about this attribute. + </p> + </div> + </xs:documentation> + </xs:annotation> + </xs:attribute> + + <xs:attributeGroup name="specialAttrs"> + <xs:attribute ref="xml:base"/> + <xs:attribute ref="xml:lang"/> + <xs:attribute ref="xml:space"/> + <xs:attribute ref="xml:id"/> + </xs:attributeGroup> + + <xs:annotation> + <xs:documentation> + <div> + + <h3>Father (in any context at all)</h3> + + <div class="bodytext"> + <p> + denotes Jon Bosak, the chair of + the original XML Working Group. This name is reserved by + the following decision of the W3C XML Plenary and + XML Coordination groups: + </p> + <blockquote> + <p> + In appreciation for his vision, leadership and + dedication the W3C XML Plenary on this 10th day of + February, 2000, reserves for Jon Bosak in perpetuity + the XML name "xml:Father". + </p> + </blockquote> + </div> + </div> + </xs:documentation> + </xs:annotation> + + <xs:annotation> + <xs:documentation> + <div xml:id="usage" id="usage"> + <h2><a name="usage">About this schema document</a></h2> + + <div class="bodytext"> + <p> + This schema defines attributes and an attribute group suitable + for use by schemas wishing to allow <code>xml:base</code>, + <code>xml:lang</code>, <code>xml:space</code> or + <code>xml:id</code> attributes on elements they define. + </p> + <p> + To enable this, such a schema must import this schema for + the XML namespace, e.g. as follows: + </p> + <pre> + <schema . . .> + . . . + <import namespace="http://www.w3.org/XML/1998/namespace" + schemaLocation="http://www.w3.org/2001/xml.xsd"/> + </pre> + <p> + or + </p> + <pre> + <import namespace="http://www.w3.org/XML/1998/namespace" + schemaLocation="http://www.w3.org/2009/01/xml.xsd"/> + </pre> + <p> + Subsequently, qualified reference to any of the attributes or the + group defined below will have the desired effect, e.g. + </p> + <pre> + <type . . .> + . . . + <attributeGroup ref="xml:specialAttrs"/> + </pre> + <p> + will define a type which will schema-validate an instance element + with any of those attributes. + </p> + </div> + </div> + </xs:documentation> + </xs:annotation> + + <xs:annotation> + <xs:documentation> + <div id="nsversioning" xml:id="nsversioning"> + <h2><a name="nsversioning">Versioning policy for this schema document</a></h2> + <div class="bodytext"> + <p> + In keeping with the XML Schema WG's standard versioning + policy, this schema document will persist at + <a href="http://www.w3.org/2009/01/xml.xsd"> + http://www.w3.org/2009/01/xml.xsd</a>. + </p> + <p> + At the date of issue it can also be found at + <a href="http://www.w3.org/2001/xml.xsd"> + http://www.w3.org/2001/xml.xsd</a>. + </p> + <p> + The schema document at that URI may however change in the future, + in order to remain compatible with the latest version of XML + Schema itself, or with the XML namespace itself. In other words, + if the XML Schema or XML namespaces change, the version of this + document at <a href="http://www.w3.org/2001/xml.xsd"> + http://www.w3.org/2001/xml.xsd + </a> + will change accordingly; the version at + <a href="http://www.w3.org/2009/01/xml.xsd"> + http://www.w3.org/2009/01/xml.xsd + </a> + will not change. + </p> + <p> + Previous dated (and unchanging) versions of this schema + document are at: + </p> + <ul> + <li><a href="http://www.w3.org/2009/01/xml.xsd"> + http://www.w3.org/2009/01/xml.xsd</a></li> + <li><a href="http://www.w3.org/2007/08/xml.xsd"> + http://www.w3.org/2007/08/xml.xsd</a></li> + <li><a href="http://www.w3.org/2004/10/xml.xsd"> + http://www.w3.org/2004/10/xml.xsd</a></li> + <li><a href="http://www.w3.org/2001/03/xml.xsd"> + http://www.w3.org/2001/03/xml.xsd</a></li> + </ul> + </div> + </div> + </xs:documentation> + </xs:annotation> + +</xs:schema> diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/util/XmlValidatorTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/util/XmlValidatorTest.java index a08e6539..b4351239 100644 --- a/doxia-core/src/test/java/org/apache/maven/doxia/util/XmlValidatorTest.java +++ b/doxia-core/src/test/java/org/apache/maven/doxia/util/XmlValidatorTest.java @@ -36,9 +36,9 @@ public class XmlValidatorTest public void testValidate() throws Exception { - String xml = IOUtil.toString( new XmlStreamReader( this.getClass().getResourceAsStream( "/test.xhtml" ) ) ); + String xml = IOUtil.toString( new XmlStreamReader( this.getClass().getResourceAsStream( "/test.xml" ) ) ); - XmlValidator validator = new XmlValidator( ); + XmlValidator validator = new XmlValidator(); validator.validate( xml ); } diff --git a/doxia-core/src/test/resources/test.xhtml b/doxia-core/src/test/resources/test.xhtml index fc9f4443..65911a43 100644 --- a/doxia-core/src/test/resources/test.xhtml +++ b/doxia-core/src/test/resources/test.xhtml @@ -1,50 +1,46 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - -<!-- -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you 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. ---> - -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <title>XHTML 1.0 Strict Example</title> - <script type="text/javascript"> - //<![CDATA[ - function loadpdf() { - document.getElementById("pdf-object").src="http://www.w3.org/TR/xhtml1/xhtml1.pdf"; - } - //]]> - </script> - </head> - <body onload="loadpdf()"> - <p>This is an example of an - <abbr title="Extensible HyperText Markup Language">XHTML</abbr> 1.0 Strict document.<br /> - <img id="validation-icon" - src="http://www.w3.org/Icons/valid-xhtml10" - alt="Valid XHTML 1.0 Strict" /><br /> - <object id="pdf-object" - name="pdf-object" - type="application/pdf" - data="http://www.w3.org/TR/xhtml1/xhtml1.pdf" - width="100%" - height="500"> - </object> - </p> - </body> -</html> +<!DOCTYPE html> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you 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. +--> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <meta charset="utf-8" /> + <title>XHTML 5 Example</title> + <script> + function loadpdf() { + document.getElementById("pdf-object").src="http://www.w3.org/TR/xhtml1/xhtml1.pdf"; + } + </script> + </head> + <body onload="loadpdf()"> + <p>This is an example of an + <abbr title="Extensible HyperText Markup Language">XHTML</abbr> 1.0 Strict document.<br /> + <img id="validation-icon" + src="http://www.w3.org/Icons/valid-xhtml10" + alt="Valid XHTML 1.0 Strict" /><br /> + <object id="pdf-object" + name="pdf-object" + type="application/pdf" + data="http://www.w3.org/TR/xhtml1/xhtml1.pdf" + width="100" + height="500"> + </object> + </p> + </body> +</html> diff --git a/doxia-modules/doxia-module-xdoc/src/test/resources/test.xml b/doxia-core/src/test/resources/test.xml similarity index 97% copy from doxia-modules/doxia-module-xdoc/src/test/resources/test.xml copy to doxia-core/src/test/resources/test.xml index d4fafcbe..8acb9059 100644 --- a/doxia-modules/doxia-module-xdoc/src/test/resources/test.xml +++ b/doxia-core/src/test/resources/test.xml @@ -19,7 +19,7 @@ --> <document xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 file:../../main/resources/xdoc-2.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 https://maven.apache.org/xsd/xdoc-2.0.xsd"> <properties> <title>Title</title> diff --git a/doxia-modules/doxia-module-fml/src/test/resources/macro.fml b/doxia-modules/doxia-module-fml/src/test/resources/macro.fml index d7e997aa..8d4553af 100644 --- a/doxia-modules/doxia-module-fml/src/test/resources/macro.fml +++ b/doxia-modules/doxia-module-fml/src/test/resources/macro.fml @@ -1,49 +1,49 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!-- -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you 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. ---> - -<faqs xmlns="http://maven.apache.org/FML/1.0.1" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/FML/1.0.1 file:../../main/resources/fml-1.0.1.xsd" - title="Frequently Asked Questions"> - - <part id="general"> - <title>Test the macro support</title> - - <faq id="test-macro"> - <question>Question</question> - <answer> - <p>Answer with macro</p> - <macro name="snippet"> - <param name="id" value="superpom"/> - <param name="file" value="src/test/resources/macro.fml"/> - </macro> - </answer> +<?xml version="1.0" encoding="ISO-8859-1"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you 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. +--> + +<faqs xmlns="http://maven.apache.org/FML/1.0.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/FML/1.0.1 https://maven.apache.org/xsd/fml-1.0.1.xsd" + title="Frequently Asked Questions"> + + <part id="general"> + <title>Test the macro support</title> + + <faq id="test-macro"> + <question>Question</question> + <answer> + <p>Answer with macro</p> + <macro name="snippet"> + <param name="id" value="superpom"/> + <param name="file" value="src/test/resources/macro.fml"/> + </macro> + </answer> </faq> - -<!-- START SNIPPET: fmlmacro --> - <faq id="macro-definition"> - <question>Macro Question</question> - <answer> - <p>Macro Answer</p> - </answer> - </faq> -<!-- END SNIPPET: fmlmacro --> - </part> -</faqs> + +<!-- START SNIPPET: fmlmacro --> + <faq id="macro-definition"> + <question>Macro Question</question> + <answer> + <p>Macro Answer</p> + </answer> + </faq> +<!-- END SNIPPET: fmlmacro --> + </part> +</faqs> diff --git a/doxia-modules/doxia-module-fml/src/test/resources/simpleFaq.fml b/doxia-modules/doxia-module-fml/src/test/resources/simpleFaq.fml index aced1327..27b7f0e3 100644 --- a/doxia-modules/doxia-module-fml/src/test/resources/simpleFaq.fml +++ b/doxia-modules/doxia-module-fml/src/test/resources/simpleFaq.fml @@ -20,7 +20,7 @@ under the License. <faqs xmlns="http://maven.apache.org/FML/1.0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/FML/1.0.1 file:../../main/resources/fml-1.0.1.xsd" + xsi:schemaLocation="http://maven.apache.org/FML/1.0.1 https://maven.apache.org/xsd/fml-1.0.1.xsd" title="Frequently Asked Questions"> <part id="general"> diff --git a/doxia-modules/doxia-module-fml/src/test/resources/test.fml b/doxia-modules/doxia-module-fml/src/test/resources/test.fml index 8128fe9b..49e868a7 100644 --- a/doxia-modules/doxia-module-fml/src/test/resources/test.fml +++ b/doxia-modules/doxia-module-fml/src/test/resources/test.fml @@ -21,7 +21,7 @@ under the License. <!-- TODO [later]: faqs need some sorting --> <faqs xmlns="http://maven.apache.org/FML/1.0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/FML/1.0.1 file:../../main/resources/fml-1.0.1.xsd" + xsi:schemaLocation="http://maven.apache.org/FML/1.0.1 https://maven.apache.org/xsd/fml-1.0.1.xsd" title="Frequently Asked Questions"> <part id="general"> diff --git a/doxia-modules/doxia-module-xdoc/src/main/resources/xdoc-2.0.xsd b/doxia-modules/doxia-module-xdoc/src/main/resources/xdoc-2.0.xsd index f24886dc..50850020 100644 --- a/doxia-modules/doxia-module-xdoc/src/main/resources/xdoc-2.0.xsd +++ b/doxia-modules/doxia-module-xdoc/src/main/resources/xdoc-2.0.xsd @@ -39,7 +39,7 @@ </xs:documentation> </xs:annotation> - <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/> + <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="https://www.w3.org/2001/xml.xsd"/> <xs:annotation> <xs:documentation> diff --git a/doxia-modules/doxia-module-xdoc/src/test/resources/macro.xml b/doxia-modules/doxia-module-xdoc/src/test/resources/macro.xml index c99baee0..16ec77dd 100644 --- a/doxia-modules/doxia-module-xdoc/src/test/resources/macro.xml +++ b/doxia-modules/doxia-module-xdoc/src/test/resources/macro.xml @@ -20,7 +20,7 @@ under the License. <document xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 file:../../main/resources/xdoc-2.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 https://maven.apache.org/xsd/xdoc-2.0.xsd"> <properties> <title>Test DOXIA-77</title> <author email="vsive...@apache.org">Vincent Siveton</author> diff --git a/doxia-modules/doxia-module-xdoc/src/test/resources/report.xml b/doxia-modules/doxia-module-xdoc/src/test/resources/report.xml index 933ff946..b906821f 100644 --- a/doxia-modules/doxia-module-xdoc/src/test/resources/report.xml +++ b/doxia-modules/doxia-module-xdoc/src/test/resources/report.xml @@ -19,7 +19,7 @@ under the License. <document xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 file:../../main/resources/xdoc-2.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 https://maven.apache.org/xsd/xdoc-2.0.xsd"> <properties> <title>Synchronization report for Codehaus</title> <author>meeper</author> diff --git a/doxia-modules/doxia-module-xdoc/src/test/resources/test.xml b/doxia-modules/doxia-module-xdoc/src/test/resources/test.xml index d4fafcbe..8acb9059 100644 --- a/doxia-modules/doxia-module-xdoc/src/test/resources/test.xml +++ b/doxia-modules/doxia-module-xdoc/src/test/resources/test.xml @@ -19,7 +19,7 @@ --> <document xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 file:../../main/resources/xdoc-2.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 https://maven.apache.org/xsd/xdoc-2.0.xsd"> <properties> <title>Title</title> diff --git a/doxia-modules/doxia-module-xdoc/src/test/resources/toc.xml b/doxia-modules/doxia-module-xdoc/src/test/resources/toc.xml index 0afe53b5..265da10f 100644 --- a/doxia-modules/doxia-module-xdoc/src/test/resources/toc.xml +++ b/doxia-modules/doxia-module-xdoc/src/test/resources/toc.xml @@ -20,7 +20,7 @@ under the License. <document xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 file:../../main/resources/xdoc-2.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 https://maven.apache.org/xsd/xdoc-2.0.xsd"> <properties> <title>Test DOXIA-40</title> <author email="vsive...@apache.org">Vincent Siveton</author> diff --git a/doxia-modules/doxia-module-xhtml5/src/test/resources/test.xhtml b/doxia-modules/doxia-module-xhtml5/src/test/resources/test.xhtml index 45f924dc..a93e0d3f 100644 --- a/doxia-modules/doxia-module-xhtml5/src/test/resources/test.xhtml +++ b/doxia-modules/doxia-module-xhtml5/src/test/resources/test.xhtml @@ -1,5 +1,4 @@ <!DOCTYPE html> - <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file diff --git a/pom.xml b/pom.xml index 87c5ea47..8c01e047 100644 --- a/pom.xml +++ b/pom.xml @@ -274,6 +274,7 @@ under the License. <artifactId>apache-rat-plugin</artifactId> <configuration> <excludes combine.children="append"> + <exclude>src/main/resources/xml.xsd</exclude> <exclude>src/test/resources/**/*.apt</exclude> <exclude>src/test/resources/**/*.apt.vm</exclude> <exclude>src/test/resources/**/*.md</exclude>