diff options
author | Vincent Hennebert <vhennebert@apache.org> | 2012-03-23 17:38:56 +0000 |
---|---|---|
committer | Vincent Hennebert <vhennebert@apache.org> | 2012-03-23 17:38:56 +0000 |
commit | 2874695d34037474b121b41b178b70cbfb229490 (patch) | |
tree | 8b50ef38808d634b80e63b2ba1cdd38c0721dfdc /test/java/org | |
parent | d88a9fb1d1b932acd92af25d9e8c931bee926adb (diff) | |
download | xmlgraphics-fop-2874695d34037474b121b41b178b70cbfb229490.tar.gz xmlgraphics-fop-2874695d34037474b121b41b178b70cbfb229490.zip |
Removed reference to XML schema from IF schema.
Copied the definition of xml:space into the IF schema.
Removed the setup-xml-schema Ant ask.
xml.xsd is a file under the W3C Document License and we cannot (yet?) redistribute files under such a license.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1304524 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/java/org')
-rw-r--r-- | test/java/org/apache/fop/intermediate/AbstractIFTest.java | 1 | ||||
-rw-r--r-- | test/java/org/apache/fop/intermediate/XMLSchemaResolver.java | 94 |
2 files changed, 0 insertions, 95 deletions
diff --git a/test/java/org/apache/fop/intermediate/AbstractIFTest.java b/test/java/org/apache/fop/intermediate/AbstractIFTest.java index cdb7e0cf9..2e7f37400 100644 --- a/test/java/org/apache/fop/intermediate/AbstractIFTest.java +++ b/test/java/org/apache/fop/intermediate/AbstractIFTest.java @@ -71,7 +71,6 @@ abstract class AbstractIFTest extends AbstractIntermediateTest { } }); - sFactory.setResourceResolver(XMLSchemaResolver.getInstance()); File ifSchemaFile = new File( "src/documentation/intermediate-format-ng/fop-intermediate-format-ng.xsd"); ifSchema = sFactory.newSchema(ifSchemaFile); diff --git a/test/java/org/apache/fop/intermediate/XMLSchemaResolver.java b/test/java/org/apache/fop/intermediate/XMLSchemaResolver.java deleted file mode 100644 index 566e79f71..000000000 --- a/test/java/org/apache/fop/intermediate/XMLSchemaResolver.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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. - */ - -/* $Id$ */ - -package org.apache.fop.intermediate; - -import java.io.InputStream; -import java.util.MissingResourceException; - -import javax.xml.XMLConstants; - -import org.w3c.dom.bootstrap.DOMImplementationRegistry; -import org.w3c.dom.ls.DOMImplementationLS; -import org.w3c.dom.ls.LSInput; -import org.w3c.dom.ls.LSResourceResolver; - -/** - * A resource resolver that returns a cached instance of the XML Schema, that can normally - * be found at {@linkplain http://www.w3.org/2001/xml.xsd}. This can be used to avoid - * unnecessary connection to the W3C website. - */ -final class XMLSchemaResolver implements LSResourceResolver { - - private static final String XML_SCHEMA_SYSTEM_ID = "http://www.w3.org/2001/xml.xsd"; - - private static final LSInput XML_SCHEMA_INPUT; - - private static final XMLSchemaResolver INSTANCE = new XMLSchemaResolver(); - - private XMLSchemaResolver() { } - - static { - DOMImplementationRegistry registry = getDOMImplementationRegistry(); - DOMImplementationLS impl - = (DOMImplementationLS) registry.getDOMImplementation("LS 3.0"); - XML_SCHEMA_INPUT = impl.createLSInput(); - InputStream xmlSchema = loadXMLSchema(); - XML_SCHEMA_INPUT.setByteStream(xmlSchema); - } - - private static DOMImplementationRegistry getDOMImplementationRegistry() { - try { - return DOMImplementationRegistry.newInstance(); - } catch (ClassCastException e) { - throw new ExceptionInInitializerError(e); - } catch (ClassNotFoundException e) { - throw new ExceptionInInitializerError(e); - } catch (InstantiationException e) { - throw new ExceptionInInitializerError(e); - } catch (IllegalAccessException e) { - throw new ExceptionInInitializerError(e); - } - } - - private static InputStream loadXMLSchema() { - String xmlSchemaResource = "xml.xsd"; - InputStream xmlSchema = XMLSchemaResolver.class.getResourceAsStream(xmlSchemaResource); - if (xmlSchema == null) { - throw new MissingResourceException("Schema for XML namespace not found." - + " Did you run ant junit-intermediate-format?", - XMLSchemaResolver.class.getName(), xmlSchemaResource); - } - return xmlSchema; - } - - public static XMLSchemaResolver getInstance() { - return INSTANCE; - } - - public LSInput resolveResource(String type, String namespaceURI, String publicId, - String systemId, String baseURI) { - if (XMLConstants.XML_NS_URI.equals(namespaceURI) && XML_SCHEMA_SYSTEM_ID.equals(systemId)) { - return XML_SCHEMA_INPUT; - } else { - return null; - } - } - -} |