#1160 - Update code style.

This commit is contained in:
Greg L. Turnquist
2020-09-29 20:27:41 -05:00
parent 419b0b2180
commit d24b4fb5d5
747 changed files with 8602 additions and 10072 deletions

View File

@@ -42,7 +42,8 @@ public class DocumentBuilderFactoryUtils {
factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
} catch (IllegalArgumentException e) {
if (log.isWarnEnabled()) {
log.warn(XMLConstants.ACCESS_EXTERNAL_DTD + " property not supported by " + factory.getClass().getCanonicalName());
log.warn(
XMLConstants.ACCESS_EXTERNAL_DTD + " property not supported by " + factory.getClass().getCanonicalName());
}
}
@@ -50,7 +51,8 @@ public class DocumentBuilderFactoryUtils {
factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");
} catch (IllegalArgumentException e) {
if (log.isWarnEnabled()) {
log.warn(XMLConstants.ACCESS_EXTERNAL_SCHEMA + " property not supported by " + factory.getClass().getCanonicalName());
log.warn(XMLConstants.ACCESS_EXTERNAL_SCHEMA + " property not supported by "
+ factory.getClass().getCanonicalName());
}
}
@@ -58,7 +60,8 @@ public class DocumentBuilderFactoryUtils {
factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
} catch (ParserConfigurationException e) {
if (log.isWarnEnabled()) {
log.warn("FEATURE 'http://apache.org/xml/features/disallow-doctype-decl' is probably not supported by " + factory.getClass().getCanonicalName());
log.warn("FEATURE 'http://apache.org/xml/features/disallow-doctype-decl' is probably not supported by "
+ factory.getClass().getCanonicalName());
}
}
@@ -66,7 +69,8 @@ public class DocumentBuilderFactoryUtils {
factory.setFeature("http://xml.org/sax/features/external-general-entities", false);
} catch (ParserConfigurationException e) {
if (log.isWarnEnabled()) {
log.warn("FEATURE 'http://xml.org/sax/features/external-general-entities' is probably not supported by " + factory.getClass().getCanonicalName());
log.warn("FEATURE 'http://xml.org/sax/features/external-general-entities' is probably not supported by "
+ factory.getClass().getCanonicalName());
}
}
@@ -74,7 +78,8 @@ public class DocumentBuilderFactoryUtils {
factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
} catch (ParserConfigurationException e) {
if (log.isWarnEnabled()) {
log.warn("FEATURE 'http://xml.org/sax/features/external-parameter-entities' is probably not supported by " + factory.getClass().getCanonicalName());
log.warn("FEATURE 'http://xml.org/sax/features/external-parameter-entities' is probably not supported by "
+ factory.getClass().getCanonicalName());
}
}
@@ -82,7 +87,9 @@ public class DocumentBuilderFactoryUtils {
factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
} catch (ParserConfigurationException e) {
if (log.isWarnEnabled()) {
log.warn("FEATURE 'http://apache.org/xml/features/nonvalidating/load-external-dtd' is probably not supported by " + factory.getClass().getCanonicalName());
log.warn(
"FEATURE 'http://apache.org/xml/features/nonvalidating/load-external-dtd' is probably not supported by "
+ factory.getClass().getCanonicalName());
}
}

View File

@@ -21,8 +21,8 @@ import org.springframework.util.ClassUtils;
/**
* Helper class used to find the current version of JAXP. We cannot depend on the Java version, since JAXP can be
* upgraded independently of the Java version.
*
* <p>Only distinguishes between JAXP 1.0, 1.1, 1.3, 1.4, and 1.5, since JAXP 1.2 was a maintenance release with no new
* <p>
* Only distinguishes between JAXP 1.0, 1.1, 1.3, 1.4, and 1.5, since JAXP 1.2 was a maintenance release with no new
* classes.
*
* @author Arjen Poutsma
@@ -57,7 +57,7 @@ public abstract class JaxpVersion {
public static final int JAXP_15 = 5;
private static final String JAXP_14_CLASS_NAME = "javax.xml.transform.stax.StAXSource";
private static final String JAXP_15_CLASS_NAME = "javax.xml.validation.SchemaFactoryConfigurationError";
private static int jaxpVersion;
@@ -104,4 +104,4 @@ public abstract class JaxpVersion {
return getJaxpVersion() >= JAXP_14;
}
}
}

View File

@@ -25,14 +25,14 @@ public class XMLInputFactoryUtils {
/**
* Build an {@link XMLInputFactory} and set properties to prevent external entities from accessing.
*
* @see XMLInputFactory#newInstance()
* @see XMLInputFactory#newInstance()
*/
public static XMLInputFactory newInstance() {
XMLInputFactory factory = XMLInputFactory.newInstance();
factory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
factory.setProperty("javax.xml.stream.isSupportingExternalEntities", false);
return factory;
}

View File

@@ -39,7 +39,7 @@ public abstract class XmlException extends NestedRuntimeException {
/**
* Constructs a new instance of the {@code XmlException} with the specific detail message and exception.
*
* @param message the detail message
* @param message the detail message
* @param throwable the wrapped exception
*/
protected XmlException(String message, Throwable throwable) {

View File

@@ -19,6 +19,7 @@ package org.springframework.xml.dom;
import java.util.ArrayList;
import java.util.List;
import org.springframework.util.Assert;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -29,8 +30,6 @@ import org.xml.sax.ContentHandler;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
import org.springframework.util.Assert;
/**
* SAX {@code ContentHandler} that transforms callback calls to DOM {@code Node}s.
*
@@ -56,8 +55,7 @@ public class DomContentHandler implements ContentHandler {
this.node = node;
if (node instanceof Document) {
document = (Document) node;
}
else {
} else {
document = node.getOwnerDocument();
}
Assert.notNull(document, "document must not be null");
@@ -66,8 +64,7 @@ public class DomContentHandler implements ContentHandler {
private Node getParent() {
if (!elements.isEmpty()) {
return elements.get(elements.size() - 1);
}
else {
} else {
return node;
}
}
@@ -100,8 +97,7 @@ public class DomContentHandler implements ContentHandler {
Node lastChild = parent.getLastChild();
if (lastChild != null && lastChild.getNodeType() == Node.TEXT_NODE) {
((Text) lastChild).appendData(data);
}
else {
} else {
Text text = document.createTextNode(data);
parent.appendChild(text);
}
@@ -119,30 +115,23 @@ public class DomContentHandler implements ContentHandler {
*/
@Override
public void setDocumentLocator(Locator locator) {
}
public void setDocumentLocator(Locator locator) {}
@Override
public void startDocument() throws SAXException {
}
public void startDocument() throws SAXException {}
@Override
public void endDocument() throws SAXException {
}
public void endDocument() throws SAXException {}
@Override
public void startPrefixMapping(String prefix, String uri) throws SAXException {
}
public void startPrefixMapping(String prefix, String uri) throws SAXException {}
@Override
public void endPrefixMapping(String prefix) throws SAXException {
}
public void endPrefixMapping(String prefix) throws SAXException {}
@Override
public void ignorableWhitespace(char ch[], int start, int length) throws SAXException {
}
public void ignorableWhitespace(char ch[], int start, int length) throws SAXException {}
@Override
public void skippedEntity(String name) throws SAXException {
}
public void skippedEntity(String name) throws SAXException {}
}

View File

@@ -17,27 +17,34 @@
package org.springframework.xml.namespace;
import java.beans.PropertyEditorSupport;
import javax.xml.namespace.QName;
import org.springframework.util.StringUtils;
/**
* PropertyEditor for {@code javax.xml.namespace.QName}, to populate a property of type QName from a String value.
*
* <p>Expects the syntax
* <p>
* Expects the syntax
*
* <pre>
* localPart
* </pre>
*
* or
*
* <pre>
* {namespace}localPart
* </pre>
*
* or
*
* <pre>
* {namespace}prefix:localPart
* </pre>
* This resembles the {@code toString()} representation of {@code QName} itself, but allows for prefixes to be
* specified as well.
*
* This resembles the {@code toString()} representation of {@code QName} itself, but allows for prefixes to be specified
* as well.
*
* @author Arjen Poutsma
* @see javax.xml.namespace.QName
@@ -57,17 +64,14 @@ public class QNameEditor extends PropertyEditorSupport {
Object value = getValue();
if (value == null || !(value instanceof QName)) {
return "";
}
else {
} else {
QName qName = (QName) value;
String prefix = qName.getPrefix();
if (StringUtils.hasLength(qName.getNamespaceURI()) && StringUtils.hasLength(prefix)) {
return "{" + qName.getNamespaceURI() + "}" + prefix + ":" + qName.getLocalPart();
}
else if (StringUtils.hasLength(qName.getNamespaceURI())) {
} else if (StringUtils.hasLength(qName.getNamespaceURI())) {
return "{" + qName.getNamespaceURI() + "}" + qName.getLocalPart();
}
else {
} else {
return qName.getLocalPart();
}
}

View File

@@ -18,10 +18,9 @@ package org.springframework.xml.namespace;
import javax.xml.namespace.QName;
import org.w3c.dom.Node;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.w3c.dom.Node;
/**
* Helper class for using {@link QName}.
@@ -34,12 +33,12 @@ public abstract class QNameUtils {
/**
* Creates a new {@code QName} with the given parameters. Sets the prefix if possible, i.e. if the
* {@code QName(String, String, String)} constructor can be found. If this constructor is not available (as is
* the case on older implementations of JAX-RPC), the prefix is ignored.
* {@code QName(String, String, String)} constructor can be found. If this constructor is not available (as is the
* case on older implementations of JAX-RPC), the prefix is ignored.
*
* @param namespaceUri namespace URI of the {@code QName}
* @param localPart local part of the {@code QName}
* @param prefix prefix of the {@code QName}. May be ignored.
* @param localPart local part of the {@code QName}
* @param prefix prefix of the {@code QName}. May be ignored.
* @return the created {@code QName}
* @see QName#QName(String,String,String)
* @deprecated in favor of {@link QName#QName(String, String, String)}
@@ -92,16 +91,12 @@ public abstract class QNameUtils {
*/
public static QName getQNameForNode(Node node) {
if (node.getNamespaceURI() != null && node.getPrefix() != null && node.getLocalName() != null) {
return new QName(node.getNamespaceURI(), node.getLocalName(),
node.getPrefix());
}
else if (node.getNamespaceURI() != null && node.getLocalName() != null) {
return new QName(node.getNamespaceURI(), node.getLocalName(), node.getPrefix());
} else if (node.getNamespaceURI() != null && node.getLocalName() != null) {
return new QName(node.getNamespaceURI(), node.getLocalName());
}
else if (node.getLocalName() != null) {
} else if (node.getLocalName() != null) {
return new QName(node.getLocalName());
}
else {
} else {
// as a last resort, use the node name
return new QName(node.getNodeName());
}
@@ -118,17 +113,16 @@ public abstract class QNameUtils {
String prefix = qName.getPrefix();
if (!StringUtils.hasLength(prefix)) {
return qName.getLocalPart();
}
else {
} else {
return prefix + ":" + qName.getLocalPart();
}
}
/**
* Convert a namespace URI and DOM or SAX qualified name to a {@code QName}. The qualified name can have the
* form {@code prefix:localname} or {@code localName}.
* Convert a namespace URI and DOM or SAX qualified name to a {@code QName}. The qualified name can have the form
* {@code prefix:localname} or {@code localName}.
*
* @param namespaceUri the namespace URI
* @param namespaceUri the namespace URI
* @param qualifiedName the qualified name
* @return a QName
*/
@@ -136,18 +130,15 @@ public abstract class QNameUtils {
int idx = qualifiedName.indexOf(':');
if (idx == -1) {
return new QName(namespaceUri, qualifiedName);
}
else {
return new QName(namespaceUri, qualifiedName.substring(idx + 1),
qualifiedName.substring(0, idx));
} else {
return new QName(namespaceUri, qualifiedName.substring(idx + 1), qualifiedName.substring(0, idx));
}
}
/**
* Parse the given qualified name string into a {@code QName}. Expects the syntax {@code localPart},
* {@code {namespace}localPart}, or {@code {namespace}prefix:localPart}. This format resembles the
* {@code toString()} representation of {@code QName} itself, but allows for prefixes to be specified as
* well.
* {@code {namespace}localPart}, or {@code {namespace}prefix:localPart}. This format resembles the {@code toString()}
* representation of {@code QName} itself, but allows for prefixes to be specified as well.
*
* @return a corresponding QName instance
* @throws IllegalArgumentException when the given string is {@code null} or empty.
@@ -156,19 +147,16 @@ public abstract class QNameUtils {
Assert.hasLength(qNameString, "QName text may not be null or empty");
if (qNameString.charAt(0) != '{') {
return new QName(qNameString);
}
else {
} else {
int endOfNamespaceURI = qNameString.indexOf('}');
if (endOfNamespaceURI == -1) {
throw new IllegalArgumentException(
"Cannot create QName from \"" + qNameString + "\", missing closing \"}\"");
throw new IllegalArgumentException("Cannot create QName from \"" + qNameString + "\", missing closing \"}\"");
}
int prefixSeperator = qNameString.indexOf(':', endOfNamespaceURI + 1);
String namespaceURI = qNameString.substring(1, endOfNamespaceURI);
if (prefixSeperator == -1) {
return new QName(namespaceURI, qNameString.substring(endOfNamespaceURI + 1));
}
else {
} else {
return new QName(namespaceURI, qNameString.substring(prefixSeperator + 1),
qNameString.substring(endOfNamespaceURI + 1, prefixSeperator));
}

View File

@@ -23,15 +23,15 @@ import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import javax.xml.XMLConstants;
import javax.xml.namespace.NamespaceContext;
import org.springframework.util.Assert;
/**
* Simple {@code javax.xml.namespace.NamespaceContext} implementation. Follows the standard
* {@code NamespaceContext} contract, and is loadable via a {@code java.util.Map} or
* {@code java.util.Properties} object
* Simple {@code javax.xml.namespace.NamespaceContext} implementation. Follows the standard {@code NamespaceContext}
* contract, and is loadable via a {@code java.util.Map} or {@code java.util.Properties} object
*
* @author Arjen Poutsma
* @since 1.0.0
@@ -47,11 +47,9 @@ public class SimpleNamespaceContext implements NamespaceContext {
Assert.notNull(prefix, "prefix is null");
if (XMLConstants.XML_NS_PREFIX.equals(prefix)) {
return XMLConstants.XML_NS_URI;
}
else if (XMLConstants.XMLNS_ATTRIBUTE.equals(prefix)) {
} else if (XMLConstants.XMLNS_ATTRIBUTE.equals(prefix)) {
return XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
}
else if (prefixToNamespaceUri.containsKey(prefix)) {
} else if (prefixToNamespaceUri.containsKey(prefix)) {
return prefixToNamespaceUri.get(prefix);
}
return XMLConstants.NULL_NS_URI;
@@ -93,21 +91,20 @@ public class SimpleNamespaceContext implements NamespaceContext {
/**
* Binds the given prefix to the given namespace.
*
* @param prefix the namespace prefix
* @param prefix the namespace prefix
* @param namespaceUri the namespace uri
*/
public void bindNamespaceUri(String prefix, String namespaceUri) {
Assert.notNull(prefix, "No prefix given");
Assert.notNull(namespaceUri, "No namespaceUri given");
if (XMLConstants.XML_NS_PREFIX.equals(prefix)) {
Assert.isTrue(XMLConstants.XML_NS_URI.equals(namespaceUri), "Prefix \"" + prefix +
"\" bound to namespace \"" + namespaceUri + "\" (should be \"" + XMLConstants.XML_NS_URI + "\")");
Assert.isTrue(XMLConstants.XML_NS_URI.equals(namespaceUri), "Prefix \"" + prefix + "\" bound to namespace \""
+ namespaceUri + "\" (should be \"" + XMLConstants.XML_NS_URI + "\")");
} else if (XMLConstants.XMLNS_ATTRIBUTE.equals(prefix)) {
Assert.isTrue(XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceUri), "Prefix \"" + prefix +
"\" bound to namespace \"" + namespaceUri + "\" (should be \"" +
XMLConstants.XMLNS_ATTRIBUTE_NS_URI + "\")");
}
else {
Assert.isTrue(XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceUri),
"Prefix \"" + prefix + "\" bound to namespace \"" + namespaceUri + "\" (should be \""
+ XMLConstants.XMLNS_ATTRIBUTE_NS_URI + "\")");
} else {
prefixToNamespaceUri.put(prefix, namespaceUri);
getPrefixesInternal(namespaceUri).add(prefix);
}
@@ -134,11 +131,9 @@ public class SimpleNamespaceContext implements NamespaceContext {
private Set<String> getPrefixesInternal(String namespaceUri) {
if (XMLConstants.XML_NS_URI.equals(namespaceUri)) {
return Collections.singleton(XMLConstants.XML_NS_PREFIX);
}
else if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceUri)) {
} else if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceUri)) {
return Collections.singleton(XMLConstants.XMLNS_ATTRIBUTE);
}
else {
} else {
Set<String> set = namespaceUriToPrefixes.get(namespaceUri);
if (set == null) {
set = new LinkedHashSet<String>();

View File

@@ -1,6 +1,7 @@
<html>
<body>
Provides classes for XML handling: version detection and a base XML exception class. Mostly for internal use by the
framework.
</body>
<body>
Provides classes for XML handling: version detection and a base XML exception class. Mostly for internal use by
the
framework.
</body>
</html>

View File

@@ -26,8 +26,8 @@ import org.xml.sax.XMLReader;
import org.xml.sax.ext.LexicalHandler;
/**
* Abstract base class for SAX {@code XMLReader} implementations. Contains properties as defined in {@link
* XMLReader}, and does not recognize any features
* Abstract base class for SAX {@code XMLReader} implementations. Contains properties as defined in {@link XMLReader},
* and does not recognize any features
*
* @author Arjen Poutsma
* @see #setContentHandler(org.xml.sax.ContentHandler)
@@ -95,8 +95,7 @@ public abstract class AbstractXmlReader implements XMLReader {
/**
* Throws a {@code SAXNotRecognizedException} exception.
*
* @throws org.xml.sax.SAXNotRecognizedException
* always
* @throws org.xml.sax.SAXNotRecognizedException always
*/
@Override
public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
@@ -114,29 +113,27 @@ public abstract class AbstractXmlReader implements XMLReader {
}
/**
* Throws a {@code SAXNotRecognizedException} exception when the given property does not signify a lexical
* handler. The property name for a lexical handler is {@code http://xml.org/sax/properties/lexical-handler}.
* Throws a {@code SAXNotRecognizedException} exception when the given property does not signify a lexical handler.
* The property name for a lexical handler is {@code http://xml.org/sax/properties/lexical-handler}.
*/
@Override
public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
if ("http://xml.org/sax/properties/lexical-handler".equals(name)) {
return lexicalHandler;
}
else {
} else {
throw new SAXNotRecognizedException(name);
}
}
/**
* Throws a {@code SAXNotRecognizedException} exception when the given property does not signify a lexical
* handler. The property name for a lexical handler is {@code http://xml.org/sax/properties/lexical-handler}.
* Throws a {@code SAXNotRecognizedException} exception when the given property does not signify a lexical handler.
* The property name for a lexical handler is {@code http://xml.org/sax/properties/lexical-handler}.
*/
@Override
public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException {
if ("http://xml.org/sax/properties/lexical-handler".equals(name)) {
lexicalHandler = (LexicalHandler) value;
}
else {
} else {
throw new SAXNotRecognizedException(name);
}
}

View File

@@ -20,10 +20,9 @@ import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import org.springframework.core.io.Resource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.core.io.Resource;
import org.xml.sax.InputSource;
/**
@@ -56,12 +55,10 @@ public abstract class SaxUtils {
public static String getSystemId(Resource resource) {
try {
return new URI(resource.getURL().toExternalForm()).toString();
}
catch (IOException ex) {
} catch (IOException ex) {
logger.debug("Could not get System ID from [" + resource + "], ex");
return null;
}
catch (URISyntaxException e) {
} catch (URISyntaxException e) {
logger.debug("Could not get System ID from [" + resource + "], ex");
return null;
}

View File

@@ -17,11 +17,11 @@
package org.springframework.xml.transform;
import java.io.IOException;
import javax.xml.transform.sax.SAXSource;
import org.springframework.core.io.Resource;
import org.springframework.xml.sax.SaxUtils;
import org.xml.sax.XMLReader;
/**

View File

@@ -17,11 +17,12 @@
package org.springframework.xml.transform;
import java.io.StringWriter;
import javax.xml.transform.stream.StreamResult;
/**
* Convenient subclass of {@code StreamResult} that writes to a {@code StringWriter}. The resulting string can
* be retrieved via {@code toString()}.
* Convenient subclass of {@code StreamResult} that writes to a {@code StringWriter}. The resulting string can be
* retrieved via {@code toString()}.
*
* @author Arjen Poutsma
* @see #toString()

View File

@@ -19,13 +19,14 @@ package org.springframework.xml.transform;
import java.io.InputStream;
import java.io.Reader;
import java.io.StringReader;
import javax.xml.transform.stream.StreamSource;
import org.springframework.util.Assert;
/**
* Convenient subclass of {@code StreamSource} that reads from a {@code StringReader}. The string to be read
* can be set via the constructor.
* Convenient subclass of {@code StreamSource} that reads from a {@code StringReader}. The string to be read can be set
* via the constructor.
*
* @author Arjen Poutsma
* @since 1.0.0

View File

@@ -59,15 +59,17 @@ public class TransformerFactoryUtils {
factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
} catch (IllegalArgumentException e) {
if (log.isWarnEnabled()) {
log.warn(XMLConstants.ACCESS_EXTERNAL_DTD + " property not supported by " + factory.getClass().getCanonicalName());
log.warn(
XMLConstants.ACCESS_EXTERNAL_DTD + " property not supported by " + factory.getClass().getCanonicalName());
}
}
try {
factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");
} catch (IllegalArgumentException e) {
if (log.isWarnEnabled()) {
log.warn(XMLConstants.ACCESS_EXTERNAL_STYLESHEET + " property not supported by " + factory.getClass().getCanonicalName());
log.warn(XMLConstants.ACCESS_EXTERNAL_STYLESHEET + " property not supported by "
+ factory.getClass().getCanonicalName());
}
}

View File

@@ -26,8 +26,8 @@ import javax.xml.transform.TransformerFactory;
import org.springframework.util.Assert;
/**
* Helper class for {@link Transformer} usage. Provides {@link #createTransformer()} and {@link #transform(Source,
* Result)}.
* Helper class for {@link Transformer} usage. Provides {@link #createTransformer()} and
* {@link #transform(Source, Result)}.
*
* @author Arjen Poutsma
* @since 3.0
@@ -41,8 +41,7 @@ public class TransformerHelper {
/**
* Initializes a new instance of the {@code TransformerHelper}.
*/
public TransformerHelper() {
}
public TransformerHelper() {}
/**
* Initializes a new instance of the {@code TransformerHelper} with the specified {@link TransformerFactory}.
@@ -68,12 +67,12 @@ public class TransformerHelper {
/**
* Instantiate a new TransformerFactory.
*
* <p>The default implementation simply calls {@link TransformerFactory#newInstance()}. If a {@link
* #setTransformerFactoryClass transformerFactoryClass} has been specified explicitly, the default constructor of
* the specified class will be called instead.
*
* <p>Can be overridden in subclasses.
* <p>
* The default implementation simply calls {@link TransformerFactory#newInstance()}. If a
* {@link #setTransformerFactoryClass transformerFactoryClass} has been specified explicitly, the default constructor
* of the specified class will be called instead.
* <p>
* Can be overridden in subclasses.
*
* @param transformerFactoryClass the specified factory class (if any)
* @return the new TransactionFactory instance
@@ -112,16 +111,15 @@ public class TransformerHelper {
* Creates a new {@code Transformer}. Must be called per thread, as transformers are not thread-safe.
*
* @return the created transformer
* @throws TransformerConfigurationException
* if thrown by JAXP methods
* @throws TransformerConfigurationException if thrown by JAXP methods
*/
public Transformer createTransformer() throws TransformerConfigurationException {
return getTransformerFactory().newTransformer();
}
/**
* Transforms the given {@link Source} to the given {@link Result}. Creates a new {@link Transformer} for every
* call, as transformers are not thread-safe.
* Transforms the given {@link Source} to the given {@link Result}. Creates a new {@link Transformer} for every call,
* as transformers are not thread-safe.
*
* @param source the source to transform from
* @param result the result to transform to

View File

@@ -27,9 +27,9 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Convenient base class for objects that use a {@code Transformer}. Subclasses can call {@link
* #createTransformer()} or {@link #transform(Source, Result)}. This should be done per thread (i.e. per incoming
* request), because {@code Transformer} instances are not thread-safe.
* Convenient base class for objects that use a {@code Transformer}. Subclasses can call {@link #createTransformer()} or
* {@link #transform(Source, Result)}. This should be done per thread (i.e. per incoming request), because
* {@code Transformer} instances are not thread-safe.
*
* @author Arjen Poutsma
* @see Transformer
@@ -52,10 +52,13 @@ public abstract class TransformerObjectSupport {
}
/**
* Instantiate a new TransformerFactory. <p>The default implementation simply calls {@link
* TransformerFactory#newInstance()}. If a {@link #setTransformerFactoryClass "transformerFactoryClass"} has been
* specified explicitly, the default constructor of the specified class will be called instead. <p>Can be overridden
* in subclasses.
* Instantiate a new TransformerFactory.
* <p>
* The default implementation simply calls {@link TransformerFactory#newInstance()}. If a
* {@link #setTransformerFactoryClass "transformerFactoryClass"} has been specified explicitly, the default
* constructor of the specified class will be called instead.
* <p>
* Can be overridden in subclasses.
*
* @param transformerFactoryClass the specified factory class (if any)
* @return the new TransactionFactory instance
@@ -77,16 +80,15 @@ public abstract class TransformerObjectSupport {
* Creates a new {@code Transformer}. Must be called per request, as transformers are not thread-safe.
*
* @return the created transformer
* @throws TransformerConfigurationException
* if thrown by JAXP methods
* @throws TransformerConfigurationException if thrown by JAXP methods
*/
protected final Transformer createTransformer() throws TransformerConfigurationException {
return transformerHelper.createTransformer();
}
/**
* Transforms the given {@link Source} to the given {@link Result}. Creates a new {@link Transformer} for every
* call, as transformers are not thread-safe.
* Transforms the given {@link Source} to the given {@link Result}. Creates a new {@link Transformer} for every call,
* as transformers are not thread-safe.
*
* @param source the source to transform from
* @param result the result to transform to

View File

@@ -20,6 +20,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLEventWriter;
import javax.xml.stream.XMLStreamReader;
@@ -37,7 +38,6 @@ import javax.xml.transform.stream.StreamSource;
import org.springframework.util.StringUtils;
import org.springframework.util.xml.StaxUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.xml.sax.ContentHandler;
@@ -63,11 +63,9 @@ public abstract class TraxUtils {
Node node = source.getNode();
if (node instanceof Document) {
return (Document) node;
}
else if (node != null) {
} else if (node != null) {
return node.getOwnerDocument();
}
else {
} else {
return null;
}
}
@@ -76,40 +74,35 @@ public abstract class TraxUtils {
* Performs the given {@linkplain SourceCallback callback} operation on a {@link Source}. Supports both the JAXP 1.4
* {@link StAXSource} and the Spring 3.0 {@link StaxUtils#createStaxSource StaxSource}.
*
* @param source source to look at
* @param source source to look at
* @param callback the callback to invoke for each kind of source
*/
public static void doWithSource(Source source, SourceCallback callback) throws Exception {
if (source instanceof DOMSource) {
callback.domSource(((DOMSource) source).getNode());
return;
}
else if (StaxUtils.isStaxSource(source)) {
} else if (StaxUtils.isStaxSource(source)) {
XMLStreamReader streamReader = StaxUtils.getXMLStreamReader(source);
if (streamReader != null) {
callback.staxSource(streamReader);
return;
}
else {
} else {
XMLEventReader eventReader = StaxUtils.getXMLEventReader(source);
if (eventReader != null) {
callback.staxSource(eventReader);
return;
}
}
}
else if (source instanceof SAXSource) {
} else if (source instanceof SAXSource) {
SAXSource saxSource = (SAXSource) source;
callback.saxSource(saxSource.getXMLReader(), saxSource.getInputSource());
return;
}
else if (source instanceof StreamSource) {
} else if (source instanceof StreamSource) {
StreamSource streamSource = (StreamSource) source;
if (streamSource.getInputStream() != null) {
callback.streamSource(streamSource.getInputStream());
return;
}
else if (streamSource.getReader() != null) {
} else if (streamSource.getReader() != null) {
callback.streamSource(streamSource.getReader());
return;
}
@@ -117,50 +110,45 @@ public abstract class TraxUtils {
if (StringUtils.hasLength(source.getSystemId())) {
String systemId = source.getSystemId();
callback.source(systemId);
}
else {
} else {
throw new IllegalArgumentException("Unknown Source type: " + source.getClass());
}
}
/**
* Performs the given {@linkplain org.springframework.xml.transform.TraxUtils.ResultCallback callback} operation on a {@link javax.xml.transform.Result}. Supports both the JAXP 1.4
* {@link javax.xml.transform.stax.StAXResult} and the Spring 3.0 {@link org.springframework.util.xml.StaxUtils#createStaxResult StaxSource}.
* Performs the given {@linkplain org.springframework.xml.transform.TraxUtils.ResultCallback callback} operation on a
* {@link javax.xml.transform.Result}. Supports both the JAXP 1.4 {@link javax.xml.transform.stax.StAXResult} and the
* Spring 3.0 {@link org.springframework.util.xml.StaxUtils#createStaxResult StaxSource}.
*
* @param result result to look at
* @param result result to look at
* @param callback the callback to invoke for each kind of result
*/
public static void doWithResult(Result result, ResultCallback callback) throws Exception {
if (result instanceof DOMResult) {
callback.domResult(((DOMResult) result).getNode());
return;
}
else if (StaxUtils.isStaxResult(result)) {
} else if (StaxUtils.isStaxResult(result)) {
XMLStreamWriter streamWriter = StaxUtils.getXMLStreamWriter(result);
if (streamWriter != null) {
callback.staxResult(streamWriter);
return;
}
else {
} else {
XMLEventWriter eventWriter = StaxUtils.getXMLEventWriter(result);
if (eventWriter != null) {
callback.staxResult(eventWriter);
return;
}
}
}
else if (result instanceof SAXResult) {
} else if (result instanceof SAXResult) {
SAXResult saxSource = (SAXResult) result;
callback.saxResult(saxSource.getHandler(), saxSource.getLexicalHandler());
return;
}
else if (result instanceof StreamResult) {
} else if (result instanceof StreamResult) {
StreamResult streamSource = (StreamResult) result;
if (streamSource.getOutputStream() != null) {
callback.streamResult(streamSource.getOutputStream());
return;
}
else if (streamSource.getWriter() != null) {
} else if (streamSource.getWriter() != null) {
callback.streamResult(streamSource.getWriter());
return;
}
@@ -168,8 +156,7 @@ public abstract class TraxUtils {
if (StringUtils.hasLength(result.getSystemId())) {
String systemId = result.getSystemId();
callback.result(systemId);
}
else {
} else {
throw new IllegalArgumentException("Unknown Result type: " + result.getClass());
}
}
@@ -191,7 +178,7 @@ public abstract class TraxUtils {
/**
* Perform an operation on the {@code XMLReader} and {@code InputSource} contained in a {@link SAXSource}.
*
* @param reader the reader, can be {@code null}
* @param reader the reader, can be {@code null}
* @param inputSource the input source, can be {@code null}
*/
void saxSource(XMLReader reader, InputSource inputSource) throws Exception;
@@ -233,7 +220,6 @@ public abstract class TraxUtils {
*/
void source(String systemId) throws Exception;
}
/**
@@ -251,8 +237,7 @@ public abstract class TraxUtils {
void domResult(Node node) throws Exception;
/**
* Perform an operation on the {@code ContentHandler} and {@code LexicalHandler} contained in a {@link
* SAXResult}.
* Perform an operation on the {@code ContentHandler} and {@code LexicalHandler} contained in a {@link SAXResult}.
*
* @param contentHandler the content handler
* @param lexicalHandler the lexicalHandler, can be {@code null}
@@ -298,5 +283,4 @@ public abstract class TraxUtils {
}
}

View File

@@ -19,15 +19,15 @@ package org.springframework.xml.validation;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.xml.transform.Source;
import javax.xml.validation.Schema;
import javax.xml.validation.Validator;
import org.springframework.core.io.Resource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.springframework.core.io.Resource;
/**
* Internal class that uses JAXP 1.0 features to create {@code XmlValidator} instances.
*
@@ -41,8 +41,7 @@ abstract class Jaxp13ValidatorFactory {
try {
Schema schema = SchemaLoaderUtils.loadSchema(resources, schemaLanguage);
return new Jaxp13Validator(schema);
}
catch (SAXException ex) {
} catch (SAXException ex) {
throw new XmlValidationException("Could not create Schema: " + ex.getMessage(), ex);
}
}
@@ -70,8 +69,7 @@ abstract class Jaxp13ValidatorFactory {
try {
validator.validate(source);
return errorHandler.getErrors();
}
catch (SAXException ex) {
} catch (SAXException ex) {
throw new XmlValidationException("Could not validate source: " + ex.getMessage(), ex);
}
}
@@ -88,8 +86,7 @@ abstract class Jaxp13ValidatorFactory {
}
@Override
public void warning(SAXParseException ex) throws SAXException {
}
public void warning(SAXParseException ex) throws SAXException {}
@Override
public void error(SAXParseException ex) throws SAXException {

View File

@@ -19,6 +19,7 @@ package org.springframework.xml.validation;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.xml.XMLConstants;
import javax.xml.transform.Source;
import javax.xml.validation.Schema;
@@ -26,16 +27,15 @@ import javax.xml.validation.Validator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.core.io.Resource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
import org.xml.sax.SAXParseException;
import org.springframework.core.io.Resource;
/**
* Internal class that uses JAXP 1.5 features to create an {@code XmlValidator} with settings to prevent
* external entity access.
* Internal class that uses JAXP 1.5 features to create an {@code XmlValidator} with settings to prevent external entity
* access.
*
* @author Arjen Poutsma
* @author Greg Turnquist
@@ -45,13 +45,11 @@ abstract class Jaxp15ValidatorFactory {
private static final Log log = LogFactory.getLog(Jaxp15ValidatorFactory.class);
static XmlValidator createValidator(Resource[] resources, String schemaLanguage) throws IOException {
try {
Schema schema = SchemaLoaderUtils.loadSchema(resources, schemaLanguage);
return new Jaxp15Validator(schema);
}
catch (SAXException ex) {
} catch (SAXException ex) {
throw new XmlValidationException("Could not create Schema: " + ex.getMessage(), ex);
}
}
@@ -80,7 +78,8 @@ abstract class Jaxp15ValidatorFactory {
validator.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, "");
} catch (SAXNotRecognizedException | SAXNotSupportedException e) {
if (log.isWarnEnabled()) {
log.warn(XMLConstants.ACCESS_EXTERNAL_DTD + " property not supported by " + validator.getClass().getCanonicalName());
log.warn(XMLConstants.ACCESS_EXTERNAL_DTD + " property not supported by "
+ validator.getClass().getCanonicalName());
}
}
@@ -88,7 +87,8 @@ abstract class Jaxp15ValidatorFactory {
validator.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");
} catch (SAXNotRecognizedException | SAXNotSupportedException e) {
if (log.isWarnEnabled()) {
log.warn(XMLConstants.ACCESS_EXTERNAL_SCHEMA + " property not supported by " + validator.getClass().getCanonicalName());
log.warn(XMLConstants.ACCESS_EXTERNAL_SCHEMA + " property not supported by "
+ validator.getClass().getCanonicalName());
}
}
@@ -96,8 +96,7 @@ abstract class Jaxp15ValidatorFactory {
try {
validator.validate(source);
return errorHandler.getErrors();
}
catch (SAXException ex) {
} catch (SAXException ex) {
throw new XmlValidationException("Could not validate source: " + ex.getMessage(), ex);
}
}
@@ -114,8 +113,7 @@ abstract class Jaxp15ValidatorFactory {
}
@Override
public void warning(SAXParseException ex) throws SAXException {
}
public void warning(SAXParseException ex) throws SAXException {}
@Override
public void error(SAXParseException ex) throws SAXException {

View File

@@ -35,7 +35,7 @@ public class SchemaFactoryUtils {
/**
* Build a {@link SchemaFactory} and set properties to prevent external entities from accessing.
*
* @see SchemaFactory#newInstance(String)
* @see SchemaFactory#newInstance(String)
*/
public static SchemaFactory newInstance(String schemaLanguage) {
SchemaFactory schemaFactory = SchemaFactory.newInstance(schemaLanguage);
@@ -44,16 +44,19 @@ public class SchemaFactoryUtils {
schemaFactory.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, "");
} catch (SAXNotRecognizedException | SAXNotSupportedException e) {
if (log.isWarnEnabled()) {
log.warn(XMLConstants.ACCESS_EXTERNAL_DTD + " property not supported by " + schemaFactory.getClass().getCanonicalName());
log.warn(XMLConstants.ACCESS_EXTERNAL_DTD + " property not supported by "
+ schemaFactory.getClass().getCanonicalName());
}
}
try {
schemaFactory.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, ResourceUtils.URL_PROTOCOL_FILE + "," + "jar:file" + "," + ResourceUtils.URL_PROTOCOL_WSJAR);
schemaFactory.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA,
ResourceUtils.URL_PROTOCOL_FILE + "," + "jar:file" + "," + ResourceUtils.URL_PROTOCOL_WSJAR);
} catch (SAXNotRecognizedException | SAXNotSupportedException e) {
if (log.isWarnEnabled()) {
log.warn(XMLConstants.ACCESS_EXTERNAL_SCHEMA + " property not supported by " + schemaFactory.getClass().getCanonicalName());
log.warn(XMLConstants.ACCESS_EXTERNAL_SCHEMA + " property not supported by "
+ schemaFactory.getClass().getCanonicalName());
}
}

View File

@@ -17,16 +17,16 @@
package org.springframework.xml.validation;
import java.io.IOException;
import javax.xml.transform.Source;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.springframework.core.io.Resource;
import org.springframework.util.Assert;
import org.springframework.xml.transform.ResourceSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
/**
* Convenient utility methods for loading of {@link Schema} objects, performing standard handling of input streams.
@@ -39,25 +39,25 @@ public abstract class SchemaLoaderUtils {
/**
* Load schema from the given resource.
*
* @param resource the resource to load from
* @param resource the resource to load from
* @param schemaLanguage the language of the schema. Can be {@code XMLConstants.W3C_XML_SCHEMA_NS_URI} or
* {@code XMLConstants.RELAXNG_NS_URI}.
* @throws IOException if loading failed
* {@code XMLConstants.RELAXNG_NS_URI}.
* @throws IOException if loading failed
* @throws SAXException if loading failed
* @see javax.xml.XMLConstants#W3C_XML_SCHEMA_NS_URI
* @see javax.xml.XMLConstants#RELAXNG_NS_URI
*/
public static Schema loadSchema(Resource resource, String schemaLanguage) throws IOException, SAXException {
return loadSchema(new Resource[]{resource}, schemaLanguage);
return loadSchema(new Resource[] { resource }, schemaLanguage);
}
/**
* Load schema from the given resource.
*
* @param resources the resources to load from
* @param resources the resources to load from
* @param schemaLanguage the language of the schema. Can be {@code XMLConstants.W3C_XML_SCHEMA_NS_URI} or
* {@code XMLConstants.RELAXNG_NS_URI}.
* @throws IOException if loading failed
* {@code XMLConstants.RELAXNG_NS_URI}.
* @throws IOException if loading failed
* @throws SAXException if loading failed
* @see javax.xml.XMLConstants#W3C_XML_SCHEMA_NS_URI
* @see javax.xml.XMLConstants#RELAXNG_NS_URI
@@ -81,10 +81,9 @@ public abstract class SchemaLoaderUtils {
public static String getSystemId(Resource resource) {
try {
return resource.getURL().toString();
}
catch (IOException e) {
} catch (IOException e) {
return null;
}
}
}
}

View File

@@ -21,6 +21,7 @@ import org.xml.sax.SAXParseException;
/**
* Subinterface of {@link ErrorHandler} that allows the registered errors to be retrieved.
*
* @author Arjen Poutsma
* @since 2.0.1
*/
@@ -28,6 +29,7 @@ public interface ValidationErrorHandler extends ErrorHandler {
/**
* Returns the errors collected by this error handler.
*
* @return the errors
*/
SAXParseException[] getErrors();

View File

@@ -28,7 +28,7 @@ public class XMLReaderFactoryUtils {
/**
* Build a {@link XMLReader} and set properties to prevent external entity access.
*
* @see XMLReaderFactory#createXMLReader()
* @see XMLReaderFactory#createXMLReader()
*/
public static XMLReader createXMLReader() throws SAXException {
XMLReader xmlReader = XMLReaderFactory.createXMLReader();

View File

@@ -17,14 +17,15 @@
package org.springframework.xml.validation;
import java.io.IOException;
import javax.xml.transform.Source;
import org.xml.sax.SAXParseException;
/**
* Simple processor that validates a given {@link Source}. Can be created via the {@link XmlValidatorFactory}.
*
* <p>Instances of this class are designed to be thread safe.
* <p>
* Instances of this class are designed to be thread safe.
*
* @author Arjen Poutsma
* @see XmlValidatorFactory#createValidator(org.springframework.core.io.Resource, String)
@@ -33,26 +34,26 @@ import org.xml.sax.SAXParseException;
public interface XmlValidator {
/**
* Validates the given {@link Source}, and returns an array of {@link SAXParseException}s as result. The array will
* be empty if no validation errors are found.
* Validates the given {@link Source}, and returns an array of {@link SAXParseException}s as result. The array will be
* empty if no validation errors are found.
*
* @param source the input document
* @return an array of {@code SAXParseException}s
* @throws IOException if the {@code source} cannot be read
* @throws IOException if the {@code source} cannot be read
* @throws XmlValidationException if the {@code source} cannot be validated
*/
SAXParseException[] validate(Source source) throws IOException;
/**
* Validates the given {@link Source} and {@link ValidationErrorHandler}, and returns an array of {@link
* SAXParseException}s as result. The array will be empty if no validation errors are found.
* Validates the given {@link Source} and {@link ValidationErrorHandler}, and returns an array of
* {@link SAXParseException}s as result. The array will be empty if no validation errors are found.
*
* @param source the input document
* @param errorHandler the error handler to use. May be {@code null}, in which case a default will be used.
* @return an array of {@code SAXParseException}s
* @throws IOException if the {@code source} cannot be read
* @throws IOException if the {@code source} cannot be read
* @throws XmlValidationException if the {@code source} cannot be validated
*/
SAXParseException[] validate(Source source, ValidationErrorHandler errorHandler) throws IOException;
}
}

View File

@@ -17,11 +17,11 @@
package org.springframework.xml.validation;
import java.io.IOException;
import javax.xml.validation.Validator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.core.io.Resource;
import org.springframework.util.Assert;
import org.springframework.xml.JaxpVersion;
@@ -29,8 +29,8 @@ import org.springframework.xml.JaxpVersion;
/**
* Factory for {@link XmlValidator} objects, being aware of JAXP 1.3 {@link Validator}s, and JAXP 1.0 parsing
* capabilities. Mainly for internal use within the framework.
*
* <p>The goal of this class is to avoid runtime dependencies on JAXP 1.3 by using the best validation implementation that
* <p>
* The goal of this class is to avoid runtime dependencies on JAXP 1.3 by using the best validation implementation that
* is available. Prefers JAXP 1.3 {@link XmlValidator} implementations to a custom, SAX-based implementation.
*
* @author Arjen Poutsma
@@ -48,34 +48,34 @@ public abstract class XmlValidatorFactory {
public static final String SCHEMA_RELAX_NG = "http://relaxng.org/ns/structure/1.0";
/**
* Create a {@link XmlValidator} with the given schema resource and schema language type. The schema language must
* be one of the {@code SCHEMA_XXX} constants.
* Create a {@link XmlValidator} with the given schema resource and schema language type. The schema language must be
* one of the {@code SCHEMA_XXX} constants.
*
* @param schemaResource a resource that locates the schema to validate against
* @param schemaLanguage the language of the schema
* @return a validator
* @throws IOException if the schema resource cannot be read
* @throws IOException if the schema resource cannot be read
* @throws IllegalArgumentException if the schema language is not supported
* @throws IllegalStateException if JAXP 1.0 cannot be located
* @throws XmlValidationException if a {@code XmlValidator} cannot be created
* @throws IllegalStateException if JAXP 1.0 cannot be located
* @throws XmlValidationException if a {@code XmlValidator} cannot be created
* @see #SCHEMA_RELAX_NG
* @see #SCHEMA_W3C_XML
*/
public static XmlValidator createValidator(Resource schemaResource, String schemaLanguage) throws IOException {
return createValidator(new Resource[]{schemaResource}, schemaLanguage);
return createValidator(new Resource[] { schemaResource }, schemaLanguage);
}
/**
* Create a {@link XmlValidator} with the given schema resources and schema language type. The schema language must
* be one of the {@code SCHEMA_XXX} constants.
* Create a {@link XmlValidator} with the given schema resources and schema language type. The schema language must be
* one of the {@code SCHEMA_XXX} constants.
*
* @param schemaResources an array of resource that locate the schemas to validate against
* @param schemaLanguage the language of the schemas
* @param schemaLanguage the language of the schemas
* @return a validator
* @throws IOException if the schema resource cannot be read
* @throws IOException if the schema resource cannot be read
* @throws IllegalArgumentException if the schema language is not supported
* @throws IllegalStateException if JAXP 1.0 cannot be located
* @throws XmlValidationException if a {@code XmlValidator} cannot be created
* @throws IllegalStateException if JAXP 1.0 cannot be located
* @throws XmlValidationException if a {@code XmlValidator} cannot be created
* @see #SCHEMA_RELAX_NG
* @see #SCHEMA_W3C_XML
*/
@@ -91,12 +91,10 @@ public abstract class XmlValidatorFactory {
if (JaxpVersion.getJaxpVersion() >= JaxpVersion.JAXP_15) {
logger.trace("Creating JAXP 1.5 XmlValidator");
return Jaxp15ValidatorFactory.createValidator(schemaResources, schemaLanguage);
}
else if (JaxpVersion.getJaxpVersion() >= JaxpVersion.JAXP_13) {
} else if (JaxpVersion.getJaxpVersion() >= JaxpVersion.JAXP_13) {
logger.trace("Creating JAXP 1.3 XmlValidator");
return Jaxp13ValidatorFactory.createValidator(schemaResources, schemaLanguage);
}
else {
} else {
throw new IllegalStateException("Could not locate JAXP 1.3.");
}
}

View File

@@ -17,17 +17,17 @@
package org.springframework.xml.xpath;
import java.util.Map;
import javax.xml.transform.Source;
import javax.xml.transform.TransformerException;
import javax.xml.transform.dom.DOMResult;
import org.springframework.xml.transform.TransformerObjectSupport;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.springframework.xml.transform.TransformerObjectSupport;
/**
* Abstract base class for implementations of {@link XPathOperations}. Contains a namespaces property.
*

View File

@@ -48,8 +48,7 @@ abstract class JaxenXPathExpressionFactory {
try {
XPath xpath = new DOMXPath(expression);
return new JaxenXpathExpression(xpath, expression);
}
catch (JaxenException ex) {
} catch (JaxenException ex) {
throw new org.springframework.xml.xpath.XPathParseException(
"Could not compile [" + expression + "] to a XPathExpression: " + ex.getMessage(), ex);
}
@@ -68,8 +67,7 @@ abstract class JaxenXPathExpressionFactory {
XPath xpath = new DOMXPath(expression);
xpath.setNamespaceContext(new SimpleNamespaceContext(namespaces));
return new JaxenXpathExpression(xpath, expression);
}
catch (JaxenException ex) {
} catch (JaxenException ex) {
throw new org.springframework.xml.xpath.XPathParseException(
"Could not compile [" + expression + "] to a XPathExpression: " + ex.getMessage(), ex);
}
@@ -95,8 +93,7 @@ abstract class JaxenXPathExpressionFactory {
public Node evaluateAsNode(Node node) {
try {
return (Node) xpath.selectSingleNode(node);
}
catch (JaxenException ex) {
} catch (JaxenException ex) {
throw new XPathException("Could not evaluate XPath expression [" + xpath + "] :" + ex.getMessage(), ex);
}
}
@@ -105,8 +102,7 @@ abstract class JaxenXPathExpressionFactory {
public boolean evaluateAsBoolean(Node node) {
try {
return xpath.booleanValueOf(node);
}
catch (JaxenException ex) {
} catch (JaxenException ex) {
throw new XPathException("Could not evaluate XPath expression [" + xpath + "] :" + ex.getMessage(), ex);
}
}
@@ -115,8 +111,7 @@ abstract class JaxenXPathExpressionFactory {
public double evaluateAsNumber(Node node) {
try {
return xpath.numberValueOf(node).doubleValue();
}
catch (JaxenException ex) {
} catch (JaxenException ex) {
throw new XPathException("Could not evaluate XPath expression [" + xpath + "] :" + ex.getMessage(), ex);
}
}
@@ -125,8 +120,7 @@ abstract class JaxenXPathExpressionFactory {
public String evaluateAsString(Node node) {
try {
return xpath.stringValueOf(node);
}
catch (JaxenException ex) {
} catch (JaxenException ex) {
throw new XPathException("Could not evaluate XPath expression [" + xpath + "] :" + ex.getMessage(), ex);
}
}
@@ -136,8 +130,7 @@ abstract class JaxenXPathExpressionFactory {
public List<Node> evaluateAsNodeList(Node node) {
try {
return xpath.selectNodes(node);
}
catch (JaxenException ex) {
} catch (JaxenException ex) {
throw new XPathException("Could not evaluate XPath expression [" + xpath + "] :" + ex.getMessage(), ex);
}
}
@@ -149,16 +142,13 @@ abstract class JaxenXPathExpressionFactory {
if (result != null) {
try {
return nodeMapper.mapNode(result, 0);
}
catch (DOMException ex) {
} catch (DOMException ex) {
throw new XPathException("Mapping resulted in DOMException", ex);
}
}
else {
} else {
return null;
}
}
catch (JaxenException ex) {
} catch (JaxenException ex) {
throw new XPathException("Could not evaluate XPath expression [" + xpath + "] :" + ex.getMessage(), ex);
}
}
@@ -172,14 +162,12 @@ abstract class JaxenXPathExpressionFactory {
Node node = (Node) nodes.get(i);
try {
results.add(nodeMapper.mapNode(node, i));
}
catch (DOMException ex) {
} catch (DOMException ex) {
throw new XPathException("Mapping resulted in DOMException", ex);
}
}
return results;
}
catch (JaxenException ex) {
} catch (JaxenException ex) {
throw new XPathException("Could not evaluate XPath expression [" + xpath + "] :" + ex.getMessage(), ex);
}
}

View File

@@ -18,6 +18,7 @@ package org.springframework.xml.xpath;
import java.util.ArrayList;
import java.util.List;
import javax.xml.transform.Source;
import javax.xml.transform.TransformerException;
@@ -31,8 +32,8 @@ import org.w3c.dom.Node;
/**
* Implementation of {@link XPathOperations} that uses Jaxen.
*
* <p>Namespaces can be set using the {@code namespaces} property.
* <p>
* Namespaces can be set using the {@code namespaces} property.
*
* @author Arjen Poutsma
* @see <a href="http://www.jaxen.org/">Jaxen</a>
@@ -46,11 +47,9 @@ public class JaxenXPathTemplate extends AbstractXPathTemplate {
XPath xpath = createXPath(expression);
Element element = getRootElement(context);
return xpath.booleanValueOf(element);
}
catch (JaxenException ex) {
} catch (JaxenException ex) {
throw new XPathException("Could not evaluate XPath expression [" + expression + "]", ex);
}
catch (TransformerException ex) {
} catch (TransformerException ex) {
throw new XPathException("Could not transform context to DOM Node", ex);
}
}
@@ -61,11 +60,9 @@ public class JaxenXPathTemplate extends AbstractXPathTemplate {
XPath xpath = createXPath(expression);
Element element = getRootElement(context);
return (Node) xpath.selectSingleNode(element);
}
catch (JaxenException ex) {
} catch (JaxenException ex) {
throw new XPathException("Could not evaluate XPath expression [" + expression + "]", ex);
}
catch (TransformerException ex) {
} catch (TransformerException ex) {
throw new XPathException("Could not transform context to DOM Node", ex);
}
}
@@ -77,11 +74,9 @@ public class JaxenXPathTemplate extends AbstractXPathTemplate {
XPath xpath = createXPath(expression);
Element element = getRootElement(context);
return xpath.selectNodes(element);
}
catch (JaxenException ex) {
} catch (JaxenException ex) {
throw new XPathException("Could not evaluate XPath expression [" + expression + "]", ex);
}
catch (TransformerException ex) {
} catch (TransformerException ex) {
throw new XPathException("Could not transform context to DOM Node", ex);
}
}
@@ -92,11 +87,9 @@ public class JaxenXPathTemplate extends AbstractXPathTemplate {
XPath xpath = createXPath(expression);
Element element = getRootElement(context);
return xpath.numberValueOf(element).doubleValue();
}
catch (JaxenException ex) {
} catch (JaxenException ex) {
throw new XPathException("Could not evaluate XPath expression [" + expression + "]", ex);
}
catch (TransformerException ex) {
} catch (TransformerException ex) {
throw new XPathException("Could not transform context to DOM Node", ex);
}
}
@@ -107,11 +100,9 @@ public class JaxenXPathTemplate extends AbstractXPathTemplate {
XPath xpath = createXPath(expression);
Element element = getRootElement(context);
return xpath.stringValueOf(element);
}
catch (JaxenException ex) {
} catch (JaxenException ex) {
throw new XPathException("Could not evaluate XPath expression [" + expression + "]", ex);
}
catch (TransformerException ex) {
} catch (TransformerException ex) {
throw new XPathException("Could not transform context to DOM Node", ex);
}
}
@@ -125,20 +116,16 @@ public class JaxenXPathTemplate extends AbstractXPathTemplate {
if (node != null) {
try {
return nodeMapper.mapNode(node, 0);
}
catch (DOMException ex) {
} catch (DOMException ex) {
throw new XPathException("Mapping resulted in DOMException", ex);
}
}
else {
} else {
return null;
}
}
catch (JaxenException ex) {
} catch (JaxenException ex) {
throw new XPathException("Could not evaluate XPath expression [" + expression + "]", ex);
}
catch (TransformerException ex) {
} catch (TransformerException ex) {
throw new XPathException("Could not transform context to DOM Node", ex);
}
}
@@ -154,17 +141,14 @@ public class JaxenXPathTemplate extends AbstractXPathTemplate {
Node node = (Node) nodes.get(i);
try {
results.add(nodeMapper.mapNode(node, i));
}
catch (DOMException ex) {
} catch (DOMException ex) {
throw new XPathException("Mapping resulted in DOMException", ex);
}
}
return results;
}
catch (JaxenException ex) {
} catch (JaxenException ex) {
throw new XPathException("Could not evaluate XPath expression [" + expression + "]", ex);
}
catch (TransformerException ex) {
} catch (TransformerException ex) {
throw new XPathException("Could not transform context to DOM Node", ex);
}
}

View File

@@ -19,18 +19,18 @@ package org.springframework.xml.xpath;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.xml.namespace.QName;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.springframework.xml.namespace.SimpleNamespaceContext;
import org.w3c.dom.DOMException;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.springframework.xml.namespace.SimpleNamespaceContext;
/**
* JAXP 1.3-specific factory creating {@link XPathExpression} objects.
*
@@ -55,8 +55,7 @@ abstract class Jaxp13XPathExpressionFactory {
XPath xpath = createXPath();
javax.xml.xpath.XPathExpression xpathExpression = xpath.compile(expression);
return new Jaxp13XPathExpression(xpathExpression, expression);
}
catch (XPathExpressionException ex) {
} catch (XPathExpressionException ex) {
throw new org.springframework.xml.xpath.XPathParseException(
"Could not compile [" + expression + "] to a XPathExpression: " + ex.getMessage(), ex);
}
@@ -78,8 +77,7 @@ abstract class Jaxp13XPathExpressionFactory {
xpath.setNamespaceContext(namespaceContext);
javax.xml.xpath.XPathExpression xpathExpression = xpath.compile(expression);
return new Jaxp13XPathExpression(xpathExpression, expression);
}
catch (XPathExpressionException ex) {
} catch (XPathExpressionException ex) {
throw new org.springframework.xml.xpath.XPathParseException(
"Could not compile [" + expression + "] to a XPathExpression: " + ex.getMessage(), ex);
}
@@ -89,7 +87,6 @@ abstract class Jaxp13XPathExpressionFactory {
return xpathFactory.newXPath();
}
/** JAXP 1.3 implementation of the {@code XPathExpression} interface. */
private static class Jaxp13XPathExpression implements XPathExpression {
@@ -123,8 +120,7 @@ abstract class Jaxp13XPathExpressionFactory {
synchronized (xpathExpression) {
return xpathExpression.evaluate(node, returnType);
}
}
catch (XPathExpressionException ex) {
} catch (XPathExpressionException ex) {
throw new XPathException("Could not evaluate XPath expression:" + ex.getMessage(), ex);
}
}
@@ -158,12 +154,10 @@ abstract class Jaxp13XPathExpressionFactory {
if (result != null) {
try {
return nodeMapper.mapNode(result, 0);
}
catch (DOMException ex) {
} catch (DOMException ex) {
throw new XPathException("Mapping resulted in DOMException", ex);
}
}
else {
} else {
return null;
}
}
@@ -175,8 +169,7 @@ abstract class Jaxp13XPathExpressionFactory {
for (int i = 0; i < nodes.getLength(); i++) {
try {
results.add(nodeMapper.mapNode(nodes.item(i), i));
}
catch (DOMException ex) {
} catch (DOMException ex) {
throw new XPathException("Mapping resulted in DOMException", ex);
}
}

View File

@@ -20,6 +20,7 @@ import java.io.InputStream;
import java.io.Reader;
import java.util.ArrayList;
import java.util.List;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLStreamException;
@@ -33,6 +34,10 @@ import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import javax.xml.xpath.XPathFactoryConfigurationException;
import org.springframework.util.xml.StaxUtils;
import org.springframework.xml.namespace.SimpleNamespaceContext;
import org.springframework.xml.transform.TransformerHelper;
import org.springframework.xml.transform.TraxUtils;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -41,15 +46,10 @@ import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import org.springframework.util.xml.StaxUtils;
import org.springframework.xml.namespace.SimpleNamespaceContext;
import org.springframework.xml.transform.TransformerHelper;
import org.springframework.xml.transform.TraxUtils;
/**
* Implementation of {@link XPathOperations} that uses JAXP 1.3. JAXP 1.3 is part of Java SE since 1.5.
*
* <p>Namespaces can be set using the {@code namespaces} property.
* <p>
* Namespaces can be set using the {@code namespaces} property.
*
* @author Arjen Poutsma
* @see #setNamespaces(java.util.Map)
@@ -66,8 +66,7 @@ public class Jaxp13XPathTemplate extends AbstractXPathTemplate {
public Jaxp13XPathTemplate(String xpathFactoryUri) {
try {
xpathFactory = XPathFactory.newInstance(xpathFactoryUri);
}
catch (XPathFactoryConfigurationException ex) {
} catch (XPathFactoryConfigurationException ex) {
throw new XPathException("Could not create XPathFactory", ex);
}
}
@@ -110,12 +109,10 @@ public class Jaxp13XPathTemplate extends AbstractXPathTemplate {
if (node != null) {
try {
return nodeMapper.mapNode(node, 0);
}
catch (DOMException ex) {
} catch (DOMException ex) {
throw new XPathException("Mapping resulted in DOMException", ex);
}
}
else {
} else {
return null;
}
}
@@ -127,8 +124,7 @@ public class Jaxp13XPathTemplate extends AbstractXPathTemplate {
for (int i = 0; i < nodes.getLength(); i++) {
try {
results.add(nodeMapper.mapNode(nodes.item(i), i));
}
catch (DOMException ex) {
} catch (DOMException ex) {
throw new XPathException("Mapping resulted in DOMException", ex);
}
}
@@ -146,14 +142,11 @@ public class Jaxp13XPathTemplate extends AbstractXPathTemplate {
EvaluationCallback callback = new EvaluationCallback(xpath, expression, returnType);
TraxUtils.doWithSource(context, callback);
return callback.result;
}
catch (javax.xml.xpath.XPathException ex) {
} catch (javax.xml.xpath.XPathException ex) {
throw new XPathException("Could not evaluate XPath expression [" + expression + "]", ex);
}
catch (TransformerException ex) {
} catch (TransformerException ex) {
throw new XPathException("Could not transform context to DOM Node", ex);
}
catch (Exception ex) {
} catch (Exception ex) {
throw new XPathException(ex.getMessage(), ex);
}
}
@@ -231,6 +224,4 @@ public class Jaxp13XPathTemplate extends AbstractXPathTemplate {
}
}

View File

@@ -23,8 +23,8 @@ import org.w3c.dom.Node;
* An interface used by {@link XPathOperations} implementations for processing {@link Node} objects on a per-node basis.
* Implementations of this interface perform the actual work of processing nodes, but don't need to worry about
* exception handling.
*
* <p>Consider using a {@link NodeMapper} instead if you need to map exactly result object per node, assembling them in a
* <p>
* Consider using a {@link NodeMapper} instead if you need to map exactly result object per node, assembling them in a
* List.
*
* @author Arjen Poutsma

View File

@@ -36,7 +36,7 @@ public interface NodeMapper<T> {
/**
* Maps a single node to an arbitrary object.
*
* @param node the node to map
* @param node the node to map
* @param nodeNum the number of the current node
* @return object for the current node
* @throws DOMException in case of DOM errors

View File

@@ -39,7 +39,7 @@ public class XPathException extends XmlException {
/**
* Constructs a new instance of the {@code XPathException} with the specific detail message and exception.
*
* @param message the detail message
* @param message the detail message
* @param throwable the wrapped exception
*/
public XPathException(String message, Throwable throwable) {

View File

@@ -21,10 +21,10 @@ import java.util.List;
import org.w3c.dom.Node;
/**
* Defines the contract for a precompiled XPath expression. Concrete instances can be obtained through the {@link
* XPathExpressionFactory}.
*
* <p>Implementations of this interface are precompiled, and thus faster, but less flexible, than the XPath expressions
* Defines the contract for a precompiled XPath expression. Concrete instances can be obtained through the
* {@link XPathExpressionFactory}.
* <p>
* Implementations of this interface are precompiled, and thus faster, but less flexible, than the XPath expressions
* used by {@link XPathOperations} implementations.
*
* @author Arjen Poutsma
@@ -35,13 +35,12 @@ public interface XPathExpression {
/**
* Evaluates the given expression as a {@code boolean}. Returns the boolean evaluation of the expression, or
* {@code false} if it is invalid.
*
* <p>The return value is determined per the {@code boolean()} function defined in the XPath specification.
* This means that an expression that selects zero nodes will return {@code false}, while an expression that
* selects one or more nodes will return {@code true}.
* An expression that returns a string returns {@code false} for empty strings and {@code true} for all other
* strings.
* An expression that returns a number returns {@code false} for zero and {@code true} for non-zero numbers.
* <p>
* The return value is determined per the {@code boolean()} function defined in the XPath specification. This means
* that an expression that selects zero nodes will return {@code false}, while an expression that selects one or more
* nodes will return {@code true}. An expression that returns a string returns {@code false} for empty strings and
* {@code true} for all other strings. An expression that returns a number returns {@code false} for zero and
* {@code true} for non-zero numbers.
*
* @param node the starting point
* @return the result of the evaluation
@@ -51,8 +50,8 @@ public interface XPathExpression {
boolean evaluateAsBoolean(Node node) throws XPathException;
/**
* Evaluates the given expression as a {@link Node}. Returns the evaluation of the expression, or {@code null}
* if it is invalid.
* Evaluates the given expression as a {@link Node}. Returns the evaluation of the expression, or {@code null} if it
* is invalid.
*
* @param node the starting point
* @return the result of the evaluation
@@ -73,11 +72,11 @@ public interface XPathExpression {
List<Node> evaluateAsNodeList(Node node) throws XPathException;
/**
* Evaluates the given expression as a number ({@code double}). Returns the numeric evaluation of the
* expression, or {@link Double#NaN} if it is invalid.
*
* <p>The return value is determined per the {@code number()} function as defined in the XPath specification.
* This means that if the expression selects multiple nodes, it will return the number value of the first node.
* Evaluates the given expression as a number ({@code double}). Returns the numeric evaluation of the expression, or
* {@link Double#NaN} if it is invalid.
* <p>
* The return value is determined per the {@code number()} function as defined in the XPath specification. This means
* that if the expression selects multiple nodes, it will return the number value of the first node.
*
* @param node the starting point
* @return the result of the evaluation
@@ -88,9 +87,9 @@ public interface XPathExpression {
/**
* Evaluates the given expression as a String. Returns {@code null} if no result could be found.
*
* <p>The return value is determined per the {@code string()} function as defined in the XPath specification.
* This means that if the expression selects multiple nodes, it will return the string value of the first node.
* <p>
* The return value is determined per the {@code string()} function as defined in the XPath specification. This means
* that if the expression selects multiple nodes, it will return the string value of the first node.
*
* @param node the starting point
* @return the result of the evaluation
@@ -102,7 +101,7 @@ public interface XPathExpression {
/**
* Evaluates the given expression, mapping a single {@link Node} result to a Java object via a {@link NodeMapper}.
*
* @param node the starting point
* @param node the starting point
* @param nodeMapper object that will map one object per node
* @return the single mapped object
* @throws XPathException in case of XPath errors
@@ -111,10 +110,9 @@ public interface XPathExpression {
<T> T evaluateAsObject(Node node, NodeMapper<T> nodeMapper) throws XPathException;
/**
* Evaluates the given expression, mapping each result {@link Node} objects to a Java object via a {@link
* NodeMapper}.
* Evaluates the given expression, mapping each result {@link Node} objects to a Java object via a {@link NodeMapper}.
*
* @param node the starting point
* @param node the starting point
* @param nodeMapper object that will map one object per node
* @return the result list, containing mapped objects
* @throws XPathException in case of XPath errors

View File

@@ -19,16 +19,15 @@ package org.springframework.xml.xpath;
import java.util.Collections;
import java.util.Map;
import org.springframework.util.Assert;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.util.Assert;
/**
* Factory for compiled {@code XPathExpression}s, being aware of JAXP 1.3+ XPath functionality, and Jaxen. Mainly
* for internal use of the framework.
*
* <p>The goal of this class is to avoid runtime dependencies a specific XPath engine, simply using the best XPath
* Factory for compiled {@code XPathExpression}s, being aware of JAXP 1.3+ XPath functionality, and Jaxen. Mainly for
* internal use of the framework.
* <p>
* The goal of this class is to avoid runtime dependencies a specific XPath engine, simply using the best XPath
* implementation that is available. Prefers JAXP 1.3+ XPath implementations to Jaxen.
*
* @author Arjen Poutsma
@@ -45,11 +44,11 @@ public abstract class XPathExpressionFactory {
* @param expression the XPath expression
* @return the compiled XPath expression
* @throws IllegalStateException if neither JAXP 1.3+, or Jaxen are available
* @throws XPathParseException if the given expression cannot be parsed
* @throws XPathParseException if the given expression cannot be parsed
*/
public static XPathExpression createXPathExpression(String expression)
throws IllegalStateException, XPathParseException {
return createXPathExpression(expression, Collections.<String, String>emptyMap());
return createXPathExpression(expression, Collections.<String, String> emptyMap());
}
/**
@@ -60,7 +59,7 @@ public abstract class XPathExpressionFactory {
* @param namespaces a map that binds string prefixes to string namespaces
* @return the compiled XPath expression
* @throws IllegalStateException if neither JAXP 1.3+, or Jaxen are available
* @throws XPathParseException if the given expression cannot be parsed
* @throws XPathParseException if the given expression cannot be parsed
*/
public static XPathExpression createXPathExpression(String expression, Map<String, String> namespaces)
throws IllegalStateException, XPathParseException {
@@ -71,11 +70,9 @@ public abstract class XPathExpressionFactory {
try {
logger.trace("Creating [javax.xml.xpath.XPathExpression]");
return Jaxp13XPathExpressionFactory.createXPathExpression(expression, namespaces);
}
catch (XPathException e) {
} catch (XPathException e) {
throw e;
}
}
}

View File

@@ -26,8 +26,8 @@ import org.springframework.util.CollectionUtils;
/**
* Spring {@link FactoryBean} for {@link XPathExpression} object. Facilitates injection of XPath expressions into
* endpoint beans.
*
* <p>Uses {@link XPathExpressionFactory} underneath, so support is provided for JAXP 1.3, and Jaxen XPaths.
* <p>
* Uses {@link XPathExpressionFactory} underneath, so support is provided for JAXP 1.3, and Jaxen XPaths.
*
* @author Arjen Poutsma
* @see #setExpression(String)
@@ -56,8 +56,7 @@ public class XPathExpressionFactoryBean implements FactoryBean<XPathExpression>,
Assert.notNull(expressionString, "expression is required");
if (CollectionUtils.isEmpty(namespaces)) {
expression = XPathExpressionFactory.createXPathExpression(expressionString);
}
else {
} else {
expression = XPathExpressionFactory.createXPathExpression(expressionString, namespaces);
}
}

View File

@@ -17,6 +17,7 @@
package org.springframework.xml.xpath;
import java.util.List;
import javax.xml.transform.Source;
import org.w3c.dom.Node;
@@ -24,9 +25,10 @@ import org.w3c.dom.Node;
/**
* Interface that specifies a basic set of XPath operations, implemented by various XPathTemplates. Contains numerous
* evaluation methods,
*
* <p>The templates that implement this interface do not use precompiled XPath expressions. Consider using the {@link
* XPathExpressionFactory} or the {@link XPathExpressionFactoryBean} for optimal performance, but less flexibility.
* <p>
* The templates that implement this interface do not use precompiled XPath expressions. Consider using the
* {@link XPathExpressionFactory} or the {@link XPathExpressionFactoryBean} for optimal performance, but less
* flexibility.
*
* @author Arjen Poutsma
* @see Jaxp13XPathTemplate
@@ -38,16 +40,15 @@ public interface XPathOperations {
/**
* Evaluates the given expression as a {@code boolean}. Returns the boolean evaluation of the expression, or
* {@code false} if it is invalid.
*
* <p>The return value is determined per the {@code boolean()} function defined in the XPath specification.
* This means that an expression that selects zero nodes will return {@code false}, while an expression that
* selects one or more nodes will return {@code true}.
* An expression that returns a string returns {@code false} for empty strings and {@code true} for all other
* strings.
* An expression that returns a number returns {@code false} for zero and {@code true} for non-zero numbers.
* <p>
* The return value is determined per the {@code boolean()} function defined in the XPath specification. This means
* that an expression that selects zero nodes will return {@code false}, while an expression that selects one or more
* nodes will return {@code true}. An expression that returns a string returns {@code false} for empty strings and
* {@code true} for all other strings. An expression that returns a number returns {@code false} for zero and
* {@code true} for non-zero numbers.
*
* @param expression the XPath expression
* @param context the context starting point
* @param context the context starting point
* @return the result of the evaluation
* @throws XPathException in case of XPath errors
* @see <a href="http://www.w3.org/TR/xpath/#function-boolean">XPath specification - boolean() function</a>
@@ -55,11 +56,11 @@ public interface XPathOperations {
boolean evaluateAsBoolean(String expression, Source context) throws XPathException;
/**
* Evaluates the given expression as a {@link Node}. Returns the evaluation of the expression, or {@code null}
* if it is invalid.
* Evaluates the given expression as a {@link Node}. Returns the evaluation of the expression, or {@code null} if it
* is invalid.
*
* @param expression the XPath expression
* @param context the context starting point
* @param context the context starting point
* @return the result of the evaluation
* @throws XPathException in case of XPath errors
* @see <a href="http://www.w3.org/TR/xpath#node-sets">XPath specification</a>
@@ -71,7 +72,7 @@ public interface XPathOperations {
* empty list if no results are found.
*
* @param expression the XPath expression
* @param context the context starting point
* @param context the context starting point
* @return the result of the evaluation
* @throws XPathException in case of XPath errors
* @see <a href="http://www.w3.org/TR/xpath#node-sets">XPath specification</a>
@@ -79,14 +80,14 @@ public interface XPathOperations {
List<Node> evaluateAsNodeList(String expression, Source context) throws XPathException;
/**
* Evaluates the given expression as a {@code double}. Returns the evaluation of the expression, or {@link
* Double#NaN} if it is invalid.
*
* <p>The return value is determined per the {@code number()} function as defined in the XPath specification.
* This means that if the expression selects multiple nodes, it will return the number value of the first node.
* Evaluates the given expression as a {@code double}. Returns the evaluation of the expression, or {@link Double#NaN}
* if it is invalid.
* <p>
* The return value is determined per the {@code number()} function as defined in the XPath specification. This means
* that if the expression selects multiple nodes, it will return the number value of the first node.
*
* @param expression the XPath expression
* @param context the context starting point
* @param context the context starting point
* @return the result of the evaluation
* @throws XPathException in case of XPath errors
* @see <a href="http://www.w3.org/TR/xpath/#function-number">XPath specification - number() function</a>
@@ -94,14 +95,14 @@ public interface XPathOperations {
double evaluateAsDouble(String expression, Source context) throws XPathException;
/**
* Evaluates the given expression as a {@link String}. Returns the evaluation of the expression, or
* {@code null} if it is invalid.
*
* <p>The return value is determined per the {@code string()} function as defined in the XPath specification.
* This means that if the expression selects multiple nodes, it will return the string value of the first node.
* Evaluates the given expression as a {@link String}. Returns the evaluation of the expression, or {@code null} if it
* is invalid.
* <p>
* The return value is determined per the {@code string()} function as defined in the XPath specification. This means
* that if the expression selects multiple nodes, it will return the string value of the first node.
*
* @param expression the XPath expression
* @param context the context starting point
* @param context the context starting point
* @return the result of the evaluation
* @throws XPathException in case of XPath errors
* @see <a href="http://www.w3.org/TR/xpath/#function-string">XPath specification - string() function</a>
@@ -112,7 +113,7 @@ public interface XPathOperations {
* Evaluates the given expression, mapping a single {@link Node} result to a Java object via a {@link NodeMapper}.
*
* @param expression the XPath expression
* @param context the context starting point
* @param context the context starting point
* @param nodeMapper object that will map one object per node
* @return the single mapped object
* @throws XPathException in case of XPath errors
@@ -121,11 +122,10 @@ public interface XPathOperations {
<T> T evaluateAsObject(String expression, Source context, NodeMapper<T> nodeMapper) throws XPathException;
/**
* Evaluates the given expression, mapping each result {@link Node} objects to a Java object via a {@link
* NodeMapper}.
* Evaluates the given expression, mapping each result {@link Node} objects to a Java object via a {@link NodeMapper}.
*
* @param expression the XPath expression
* @param context the context starting point
* @param context the context starting point
* @param nodeMapper object that will map one object per node
* @return the result list, containing mapped objects
* @throws XPathException in case of XPath errors
@@ -134,11 +134,11 @@ public interface XPathOperations {
<T> List<T> evaluate(String expression, Source context, NodeMapper<T> nodeMapper) throws XPathException;
/**
* Evaluates the given expression, handling the result {@link Node} objects on a per-node basis with a {@link
* NodeCallbackHandler}.
* Evaluates the given expression, handling the result {@link Node} objects on a per-node basis with a
* {@link NodeCallbackHandler}.
*
* @param expression the XPath expression
* @param context the context starting point
* @param expression the XPath expression
* @param context the context starting point
* @param callbackHandler object that will extract results, one row at a time
* @throws XPathException in case of XPath errors
* @see <a href="http://www.w3.org/TR/xpath#node-sets">XPath specification</a>

View File

@@ -35,10 +35,9 @@ public class XPathParseException extends XPathException {
}
/**
* Constructs a new instance of the {@code XPathParseException} with the specific detail message and
* exception.
* Constructs a new instance of the {@code XPathParseException} with the specific detail message and exception.
*
* @param message the detail message
* @param message the detail message
* @param throwable the wrapped exception
*/
public XPathParseException(String message, Throwable throwable) {

View File

@@ -17,6 +17,7 @@
package org.springframework.xml.xsd;
import java.io.IOException;
import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -24,10 +25,6 @@ import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.io.Resource;
import org.springframework.util.Assert;
@@ -35,11 +32,14 @@ import org.springframework.xml.DocumentBuilderFactoryUtils;
import org.springframework.xml.sax.SaxUtils;
import org.springframework.xml.validation.XmlValidator;
import org.springframework.xml.validation.XmlValidatorFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
/**
* The default {@link XsdSchema} implementation.
*
* <p>Allows a XSD to be set by the {@link #setXsd(Resource)}, or directly in the {@link #SimpleXsdSchema(Resource)
* <p>
* Allows a XSD to be set by the {@link #setXsd(Resource)}, or directly in the {@link #SimpleXsdSchema(Resource)
* constructor}.
*
* @author Mark LaFond
@@ -65,14 +65,13 @@ public class SimpleXsdSchema implements XsdSchema, InitializingBean {
/**
* Create a new instance of the {@link SimpleXsdSchema} class.
*
* <p>A subsequent call to the {@link #setXsd(Resource)} method is required.
* <p>
* A subsequent call to the {@link #setXsd(Resource)} method is required.
*/
public SimpleXsdSchema() {
}
public SimpleXsdSchema() {}
/**
* Create a new instance of the {@link SimpleXsdSchema} class with the specified resource.
* Create a new instance of the {@link SimpleXsdSchema} class with the specified resource.
*
* @param xsdResource the XSD resource; must not be {@code null}
* @throws IllegalArgumentException if the supplied {@code xsdResource} is {@code null}
@@ -94,8 +93,9 @@ public class SimpleXsdSchema implements XsdSchema, InitializingBean {
@Override
public String getTargetNamespace() {
Assert.notNull(schemaElement, "schemaElement must not be null! Did you run afterPropertiesSet() or register this as a Spring bean?");
Assert.notNull(schemaElement,
"schemaElement must not be null! Did you run afterPropertiesSet() or register this as a Spring bean?");
return schemaElement.getAttribute("targetNamespace");
}
@@ -108,8 +108,7 @@ public class SimpleXsdSchema implements XsdSchema, InitializingBean {
public XmlValidator createValidator() {
try {
return XmlValidatorFactory.createValidator(xsdResource, XmlValidatorFactory.SCHEMA_W3C_XML);
}
catch (IOException ex) {
} catch (IOException ex) {
throw new XsdSchemaException(ex.getMessage(), ex);
}
}
@@ -127,9 +126,9 @@ public class SimpleXsdSchema implements XsdSchema, InitializingBean {
schemaElement = schemaDocument.getDocumentElement();
Assert.isTrue(SCHEMA_NAME.getLocalPart().equals(schemaElement.getLocalName()),
xsdResource + " has invalid root element : [" + schemaElement.getLocalName() + "] instead of [schema]");
Assert.isTrue(SCHEMA_NAME.getNamespaceURI().equals(schemaElement.getNamespaceURI()), xsdResource +
" has invalid root element: [" + schemaElement.getNamespaceURI() + "] instead of [" +
SCHEMA_NAME.getNamespaceURI() + "]");
Assert.isTrue(SCHEMA_NAME.getNamespaceURI().equals(schemaElement.getNamespaceURI()),
xsdResource + " has invalid root element: [" + schemaElement.getNamespaceURI() + "] instead of ["
+ SCHEMA_NAME.getNamespaceURI() + "]");
Assert.hasText(getTargetNamespace(), xsdResource + " has no targetNamespace");
}
@@ -141,4 +140,4 @@ public class SimpleXsdSchema implements XsdSchema, InitializingBean {
return builder.toString();
}
}
}

View File

@@ -22,6 +22,7 @@ import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import javax.xml.namespace.QName;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
@@ -30,8 +31,6 @@ import javax.xml.transform.stream.StreamSource;
import org.apache.ws.commons.schema.XmlSchema;
import org.apache.ws.commons.schema.XmlSchemaCollection;
import org.apache.ws.commons.schema.XmlSchemaSerializer;
import org.w3c.dom.Document;
import org.springframework.beans.BeanInstantiationException;
import org.springframework.beans.BeanUtils;
import org.springframework.core.io.Resource;
@@ -40,6 +39,7 @@ import org.springframework.util.Assert;
import org.springframework.xml.validation.XmlValidator;
import org.springframework.xml.validation.XmlValidatorFactory;
import org.springframework.xml.xsd.XsdSchema;
import org.w3c.dom.Document;
/**
* Implementation of the {@link XsdSchema} interface that uses Apache WS-Commons XML Schema.
@@ -55,7 +55,7 @@ public class CommonsXsdSchema implements XsdSchema {
private final XmlSchemaCollection collection;
/**
* Create a new instance of the {@code CommonsXsdSchema} class with the specified {@link XmlSchema} reference.
* Create a new instance of the {@code CommonsXsdSchema} class with the specified {@link XmlSchema} reference.
*
* @param schema the Commons {@code XmlSchema} object; must not be {@code null}
* @throws IllegalArgumentException if the supplied {@code schema} is {@code null}
@@ -65,10 +65,10 @@ public class CommonsXsdSchema implements XsdSchema {
}
/**
* Create a new instance of the {@code CommonsXsdSchema} class with the specified {@link XmlSchema} and {@link
* XmlSchemaCollection} reference.
* Create a new instance of the {@code CommonsXsdSchema} class with the specified {@link XmlSchema} and
* {@link XmlSchemaCollection} reference.
*
* @param schema the Commons {@code XmlSchema} object; must not be {@code null}
* @param schema the Commons {@code XmlSchema} object; must not be {@code null}
* @param collection the Commons {@code XmlSchemaCollection} object; can be {@code null}
* @throws IllegalArgumentException if the supplied {@code schema} is {@code null}
*/
@@ -98,18 +98,15 @@ public class CommonsXsdSchema implements XsdSchema {
}
Document[] serializedSchemas = serializer.serializeSchema(schema, false);
return new DOMSource(serializedSchemas[0]);
}
catch (BeanInstantiationException ex) {
} catch (BeanInstantiationException ex) {
// ignore
}
catch (XmlSchemaSerializer.XmlSchemaSerializerException ex) {
} catch (XmlSchemaSerializer.XmlSchemaSerializerException ex) {
// ignore
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
schema.write(bos);
}
catch (UnsupportedEncodingException ex) {
} catch (UnsupportedEncodingException ex) {
throw new CommonsXsdSchemaException(ex.getMessage(), ex);
}
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
@@ -120,15 +117,13 @@ public class CommonsXsdSchema implements XsdSchema {
public XmlValidator createValidator() {
try {
Resource resource = new UrlResource(schema.getSourceURI());
return XmlValidatorFactory
.createValidator(resource, XmlValidatorFactory.SCHEMA_W3C_XML);
}
catch (IOException ex) {
return XmlValidatorFactory.createValidator(resource, XmlValidatorFactory.SCHEMA_W3C_XML);
} catch (IOException ex) {
throw new CommonsXsdSchemaException(ex.getMessage(), ex);
}
}
/** Returns the wrapped Commons {@code XmlSchema} object. */
/** Returns the wrapped Commons {@code XmlSchema} object. */
public XmlSchema getSchema() {
return schema;
}

View File

@@ -32,8 +32,6 @@ import org.apache.ws.commons.schema.XmlSchemaInclude;
import org.apache.ws.commons.schema.XmlSchemaObject;
import org.apache.ws.commons.schema.resolver.DefaultURIResolver;
import org.apache.ws.commons.schema.resolver.URIResolver;
import org.xml.sax.InputSource;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ResourceLoaderAware;
import org.springframework.core.io.Resource;
@@ -46,13 +44,14 @@ import org.springframework.xml.validation.XmlValidator;
import org.springframework.xml.validation.XmlValidatorFactory;
import org.springframework.xml.xsd.XsdSchema;
import org.springframework.xml.xsd.XsdSchemaCollection;
import org.xml.sax.InputSource;
/**
* Implementation of the {@link XsdSchemaCollection} that uses Apache WS-Commons XML Schema.
*
* <p>Setting the {@link #setInline(boolean) inline} flag to {@code true} will result in all referenced schemas
* (included and imported) being merged into the referred schema. When including the schemas into a WSDL, this greatly
* simplifies the deployment of the schemas.
* <p>
* Setting the {@link #setInline(boolean) inline} flag to {@code true} will result in all referenced schemas (included
* and imported) being merged into the referred schema. When including the schemas into a WSDL, this greatly simplifies
* the deployment of the schemas.
*
* @author Arjen Poutsma
* @see <a href="http://ws.apache.org/commons/XmlSchema/">Commons XML Schema</a>
@@ -76,11 +75,10 @@ public class CommonsXsdSchemaCollection implements XsdSchemaCollection, Initiali
/**
* Constructs a new, empty instance of the {@code CommonsXsdSchemaCollection}.
*
* <p>A subsequent call to the {@link #setXsds(Resource[])} is required.
* <p>
* A subsequent call to the {@link #setXsds(Resource[])} is required.
*/
public CommonsXsdSchemaCollection() {
}
public CommonsXsdSchemaCollection() {}
/**
* Constructs a new instance of the {@code CommonsXsdSchemaCollection} based on the given resources.
@@ -102,8 +100,8 @@ public class CommonsXsdSchemaCollection implements XsdSchemaCollection, Initiali
/**
* Defines whether included schemas should be inlined into the including schema.
*
* <p>Defaults to {@code false}.
* <p>
* Defaults to {@code false}.
*/
public void setInline(boolean inline) {
this.inline = inline;
@@ -111,8 +109,8 @@ public class CommonsXsdSchemaCollection implements XsdSchemaCollection, Initiali
/**
* Sets the WS-Commons uri resolver to use when resolving (relative) schemas.
*
* <p>Default is an internal subclass of {@link DefaultURIResolver} which correctly handles schemas on the classpath.
* <p>
* Default is an internal subclass of {@link DefaultURIResolver} which correctly handles schemas on the classpath.
*/
public void setUriResolver(URIResolver uriResolver) {
Assert.notNull(uriResolver, "'uriResolver' must not be null");
@@ -136,16 +134,14 @@ public class CommonsXsdSchemaCollection implements XsdSchemaCollection, Initiali
for (Resource xsdResource : xsdResources) {
Assert.isTrue(xsdResource.exists(), xsdResource + " does not exist");
try {
XmlSchema xmlSchema =
schemaCollection.read(SaxUtils.createInputSource(xsdResource));
XmlSchema xmlSchema = schemaCollection.read(SaxUtils.createInputSource(xsdResource));
xmlSchemas.add(xmlSchema);
if (inline) {
inlineIncludes(xmlSchema, processedIncludes, processedImports);
findImports(xmlSchema, processedImports, processedIncludes);
}
}
catch (Exception ex) {
} catch (Exception ex) {
throw new CommonsXsdSchemaException("Schema [" + xsdResource + "] could not be loaded", ex);
}
}
@@ -176,8 +172,7 @@ public class CommonsXsdSchemaCollection implements XsdSchemaCollection, Initiali
resources[i] = new UrlResource(sourceUri);
}
}
return XmlValidatorFactory
.createValidator(resources, XmlValidatorFactory.SCHEMA_W3C_XML);
return XmlValidatorFactory.createValidator(resources, XmlValidatorFactory.SCHEMA_W3C_XML);
} catch (IOException ex) {
throw new CommonsXsdSchemaException(ex.getMessage(), ex);
}
@@ -213,8 +208,8 @@ public class CommonsXsdSchemaCollection implements XsdSchemaCollection, Initiali
if (external instanceof XmlSchemaImport) {
XmlSchemaImport schemaImport = (XmlSchemaImport) external;
XmlSchema importedSchema = schemaImport.getSchema();
if (!"http://www.w3.org/XML/1998/namespace".equals(schemaImport.getNamespace()) &&
importedSchema != null && !processedImports.contains(importedSchema)) {
if (!"http://www.w3.org/XML/1998/namespace".equals(schemaImport.getNamespace()) && importedSchema != null
&& !processedImports.contains(importedSchema)) {
inlineIncludes(importedSchema, processedIncludes, processedImports);
findImports(importedSchema, processedImports, processedIncludes);
xmlSchemas.add(importedSchema);
@@ -247,8 +242,7 @@ public class CommonsXsdSchemaCollection implements XsdSchemaCollection, Initiali
Resource resource = resourceLoader.getResource(schemaLocation);
if (resource.exists()) {
return createInputSource(resource);
}
else if (StringUtils.hasLength(baseUri)) {
} else if (StringUtils.hasLength(baseUri)) {
// let's try and find it relative to the baseUri, see SWS-413
try {
Resource baseUriResource = new UrlResource(baseUri);
@@ -256,8 +250,7 @@ public class CommonsXsdSchemaCollection implements XsdSchemaCollection, Initiali
if (resource.exists()) {
return createInputSource(resource);
}
}
catch (IOException e) {
} catch (IOException e) {
// fall through
}
}
@@ -274,8 +267,7 @@ public class CommonsXsdSchemaCollection implements XsdSchemaCollection, Initiali
private InputSource createInputSource(Resource resource) {
try {
return SaxUtils.createInputSource(resource);
}
catch (IOException ex) {
} catch (IOException ex) {
throw new CommonsXsdSchemaException("Could not resolve location", ex);
}
}

View File

@@ -16,34 +16,33 @@
package org.springframework.xml.dom;
import static org.custommonkey.xmlunit.XMLAssert.*;
import java.io.StringReader;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.junit.Before;
import org.junit.Test;
import org.springframework.xml.DocumentBuilderFactoryUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;
import org.springframework.xml.DocumentBuilderFactoryUtils;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual;
public class DomContentHandlerTest {
private static final String XML_1 = "<?xml version='1.0' encoding='UTF-8'?>" + "<?pi content?>" +
"<root xmlns='namespace'>" +
"<prefix:child xmlns:prefix='namespace2' xmlns:prefix2='namespace3' prefix2:attr='value'>content</prefix:child>" +
"</root>";
private static final String XML_1 = "<?xml version='1.0' encoding='UTF-8'?>" + "<?pi content?>"
+ "<root xmlns='namespace'>"
+ "<prefix:child xmlns:prefix='namespace2' xmlns:prefix2='namespace3' prefix2:attr='value'>content</prefix:child>"
+ "</root>";
private static final String XML_2_EXPECTED = "<?xml version='1.0' encoding='UTF-8'?>" + "<root xmlns='namespace'>" +
"<child xmlns='namespace2' />" + "</root>";
private static final String XML_2_EXPECTED = "<?xml version='1.0' encoding='UTF-8'?>" + "<root xmlns='namespace'>"
+ "<child xmlns='namespace2' />" + "</root>";
private static final String XML_2_SNIPPET =
"<?xml version='1.0' encoding='UTF-8'?>" + "<child xmlns='namespace2' />";
private static final String XML_2_SNIPPET = "<?xml version='1.0' encoding='UTF-8'?>" + "<child xmlns='namespace2' />";
private Document expected;
@@ -94,4 +93,4 @@ public class DomContentHandlerTest {
assertXMLEqual("Invalid result", expected, result);
}
}
}

View File

@@ -56,9 +56,10 @@ public class QNameEditorTest {
editor.setAsText(text);
QName result = (QName) editor.getValue();
Assert.assertNotNull("getValue returns null", result);
Assert.assertEquals("Parsed QName local part is not equal to original", qname.getLocalPart(), result.getLocalPart());
Assert.assertEquals("Parsed QName local part is not equal to original", qname.getLocalPart(),
result.getLocalPart());
Assert.assertEquals("Parsed QName prefix is not equal to original", qname.getPrefix(), result.getPrefix());
Assert.assertEquals("Parsed QName namespace is not equal to original", qname.getNamespaceURI(),
result.getNamespaceURI());
}
}
}

View File

@@ -22,11 +22,10 @@ import javax.xml.parsers.DocumentBuilderFactory;
import org.junit.Assert;
import org.junit.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.springframework.util.StringUtils;
import org.springframework.xml.DocumentBuilderFactoryUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
public class QNameUtilsTest {
@@ -114,5 +113,4 @@ public class QNameUtilsTest {
Assert.assertEquals("invalid localname", "localName", result.getLocalPart());
}
}

View File

@@ -18,6 +18,7 @@ package org.springframework.xml.namespace;
import java.util.Collections;
import java.util.Iterator;
import javax.xml.XMLConstants;
import org.junit.Assert;
@@ -36,31 +37,32 @@ public class SimpleNamespaceContextTest {
@Test
public void testGetNamespaceURI() {
Assert.assertEquals("Invalid namespaceURI for default namespace", "", context
.getNamespaceURI(XMLConstants.DEFAULT_NS_PREFIX));
Assert.assertEquals("Invalid namespaceURI for default namespace", "",
context.getNamespaceURI(XMLConstants.DEFAULT_NS_PREFIX));
String defaultNamespaceUri = "defaultNamespace";
context.bindNamespaceUri(XMLConstants.DEFAULT_NS_PREFIX, defaultNamespaceUri);
Assert.assertEquals("Invalid namespaceURI for default namespace", defaultNamespaceUri, context
.getNamespaceURI(XMLConstants.DEFAULT_NS_PREFIX));
Assert.assertEquals("Invalid namespaceURI for default namespace", defaultNamespaceUri,
context.getNamespaceURI(XMLConstants.DEFAULT_NS_PREFIX));
Assert.assertEquals("Invalid namespaceURI for bound prefix", "namespaceURI", context.getNamespaceURI("prefix"));
Assert.assertEquals("Invalid namespaceURI for unbound prefix", "", context.getNamespaceURI("unbound"));
Assert.assertEquals("Invalid namespaceURI for namespace prefix", XMLConstants.XML_NS_URI, context
.getNamespaceURI(XMLConstants.XML_NS_PREFIX));
Assert.assertEquals("Invalid namespaceURI for attribute prefix", XMLConstants.XMLNS_ATTRIBUTE_NS_URI, context
.getNamespaceURI(XMLConstants.XMLNS_ATTRIBUTE));
Assert.assertEquals("Invalid namespaceURI for namespace prefix", XMLConstants.XML_NS_URI,
context.getNamespaceURI(XMLConstants.XML_NS_PREFIX));
Assert.assertEquals("Invalid namespaceURI for attribute prefix", XMLConstants.XMLNS_ATTRIBUTE_NS_URI,
context.getNamespaceURI(XMLConstants.XMLNS_ATTRIBUTE));
}
@Test
public void testGetPrefix() {
context.bindDefaultNamespaceUri("defaultNamespaceURI");
Assert.assertEquals("Invalid prefix for default namespace", XMLConstants.DEFAULT_NS_PREFIX, context.getPrefix("defaultNamespaceURI"));
Assert.assertEquals("Invalid prefix for default namespace", XMLConstants.DEFAULT_NS_PREFIX,
context.getPrefix("defaultNamespaceURI"));
Assert.assertEquals("Invalid prefix for bound namespace", "prefix", context.getPrefix("namespaceURI"));
Assert.assertNull("Invalid prefix for unbound namespace", context.getPrefix("unbound"));
Assert.assertEquals("Invalid prefix for namespace", XMLConstants.XML_NS_PREFIX, context
.getPrefix(XMLConstants.XML_NS_URI));
Assert.assertEquals("Invalid prefix for attribute namespace", XMLConstants.XMLNS_ATTRIBUTE, context
.getPrefix(XMLConstants.XMLNS_ATTRIBUTE_NS_URI));
Assert.assertEquals("Invalid prefix for namespace", XMLConstants.XML_NS_PREFIX,
context.getPrefix(XMLConstants.XML_NS_URI));
Assert.assertEquals("Invalid prefix for attribute namespace", XMLConstants.XMLNS_ATTRIBUTE,
context.getPrefix(XMLConstants.XMLNS_ATTRIBUTE_NS_URI));
}
@Test
@@ -130,8 +132,8 @@ public class SimpleNamespaceContextTest {
String prefix1 = "prefix1";
String prefix2 = "prefix2";
String namespaceUri = "namespaceUri";
context.bindNamespaceUri(prefix1, namespaceUri);
context.bindNamespaceUri(prefix2, namespaceUri);
context.bindNamespaceUri(prefix1, namespaceUri);
context.bindNamespaceUri(prefix2, namespaceUri);
Iterator<String> iter = context.getPrefixes(namespaceUri);
Assert.assertTrue("iterator is empty", iter.hasNext());
Assert.assertEquals(prefix1, iter.next());

View File

@@ -16,11 +16,10 @@
package org.springframework.xml.sax;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
public class SaxUtilsTest {
@@ -31,4 +30,4 @@ public class SaxUtilsTest {
Assert.assertNotNull("No systemId returned", systemId);
Assert.assertTrue("Invalid system id", systemId.endsWith("path%20with%20spaces/file%20with%20spaces.txt"));
}
}
}

View File

@@ -21,9 +21,8 @@ import javax.xml.transform.dom.DOMResult;
import org.junit.Assert;
import org.junit.Test;
import org.w3c.dom.Element;
import org.springframework.core.io.ClassPathResource;
import org.w3c.dom.Element;
public class ResourceSourceTest {
@@ -39,4 +38,4 @@ public class ResourceSourceTest {
Assert.assertEquals("Invalid namespace", "namespace", rootElement.getNamespaceURI());
}
}
}

View File

@@ -16,17 +16,16 @@
package org.springframework.xml.transform;
import static org.custommonkey.xmlunit.XMLAssert.*;
import javax.xml.transform.Transformer;
import javax.xml.transform.dom.DOMSource;
import org.junit.Test;
import org.springframework.xml.DocumentBuilderFactoryUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.springframework.xml.DocumentBuilderFactoryUtils;
import static org.custommonkey.xmlunit.XMLAssert.*;
public class StringResultTest {
@Test
@@ -40,4 +39,4 @@ public class StringResultTest {
assertXMLEqual("Invalid result", "<prefix:localName xmlns:prefix='namespace'/>", result.toString());
}
}
}

View File

@@ -18,7 +18,6 @@ package org.springframework.xml.transform;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMResult;
import org.junit.Assert;
@@ -38,4 +37,4 @@ public class StringSourceTest {
Assert.assertEquals("Invalid prefix", "prefix", rootElement.getPrefix());
Assert.assertEquals("Invalid namespace", "namespace", rootElement.getNamespaceURI());
}
}
}

View File

@@ -16,7 +16,11 @@
package org.springframework.xml.transform;
import static org.custommonkey.xmlunit.XMLAssert.*;
import static org.easymock.EasyMock.*;
import java.io.IOException;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
@@ -26,9 +30,6 @@ import org.junit.Before;
import org.junit.Test;
import org.xml.sax.SAXException;
import static org.custommonkey.xmlunit.XMLAssert.*;
import static org.easymock.EasyMock.*;
public class TransformerHelperTest {
private TransformerHelper helper;
@@ -45,12 +46,12 @@ public class TransformerHelperTest {
doTest();
}
// @Ignore
// @Test
// public void customTransformerFactory() throws TransformerException, IOException, SAXException {
// helper.setTransformerFactoryClass(TransformerFactoryImpl.class);
// doTest();
// }
// @Ignore
// @Test
// public void customTransformerFactory() throws TransformerException, IOException, SAXException {
// helper.setTransformerFactoryClass(TransformerFactoryImpl.class);
// doTest();
// }
private void doTest() throws TransformerException, SAXException, IOException {
String xml = "<root xmlns='http://springframework.org/spring-ws'><child>text</child></root>";

View File

@@ -16,6 +16,8 @@
package org.springframework.xml.transform;
import static org.easymock.EasyMock.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
@@ -24,6 +26,7 @@ import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.stream.XMLEventReader;
@@ -43,6 +46,9 @@ import javax.xml.transform.stream.StreamSource;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.util.xml.StaxUtils;
import org.springframework.xml.DocumentBuilderFactoryUtils;
import org.springframework.xml.XMLInputFactoryUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.ContentHandler;
@@ -53,12 +59,6 @@ import org.xml.sax.ext.LexicalHandler;
import org.xml.sax.helpers.DefaultHandler;
import org.xml.sax.helpers.XMLReaderFactory;
import org.springframework.util.xml.StaxUtils;
import org.springframework.xml.XMLInputFactoryUtils;
import org.springframework.xml.DocumentBuilderFactoryUtils;
import static org.easymock.EasyMock.*;
public class TraxUtilsTest {
@Test
@@ -283,13 +283,11 @@ public class TraxUtilsTest {
verify(mock);
}
@Test
public void testDoWithInvalidSource() throws Exception {
Source source = new Source() {
public void setSystemId(String systemId) {
}
public void setSystemId(String systemId) {}
public String getSystemId() {
return null;
@@ -299,8 +297,7 @@ public class TraxUtilsTest {
try {
TraxUtils.doWithSource(source, null);
Assert.fail("IllegalArgumentException expected");
}
catch (IllegalArgumentException ex) {
} catch (IllegalArgumentException ex) {
// expected
}
}
@@ -309,8 +306,7 @@ public class TraxUtilsTest {
public void testDoWithInvalidResult() throws Exception {
Result result = new Result() {
public void setSystemId(String systemId) {
}
public void setSystemId(String systemId) {}
public String getSystemId() {
return null;
@@ -320,9 +316,8 @@ public class TraxUtilsTest {
try {
TraxUtils.doWithResult(result, null);
Assert.fail("IllegalArgumentException expected");
}
catch (IllegalArgumentException ex) {
} catch (IllegalArgumentException ex) {
// expected
}
}
}
}

View File

@@ -17,6 +17,7 @@
package org.springframework.xml.validation;
import java.io.InputStream;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
@@ -27,16 +28,15 @@ import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.xml.DocumentBuilderFactoryUtils;
import org.springframework.xml.transform.ResourceSource;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.xml.transform.ResourceSource;
import org.springframework.xml.DocumentBuilderFactoryUtils;
public abstract class AbstractValidatorFactoryTestCase {
private XmlValidator validator;
@@ -47,8 +47,8 @@ public abstract class AbstractValidatorFactoryTestCase {
@Before
public void setUp() throws Exception {
Resource[] schemaResource =
new Resource[]{new ClassPathResource("schema.xsd", AbstractValidatorFactoryTestCase.class)};
Resource[] schemaResource = new Resource[] {
new ClassPathResource("schema.xsd", AbstractValidatorFactoryTestCase.class) };
validator = createValidator(schemaResource, XmlValidatorFactory.SCHEMA_W3C_XML);
validInputStream = AbstractValidatorFactoryTestCase.class.getResourceAsStream("validDocument.xml");
invalidInputStream = AbstractValidatorFactoryTestCase.class.getResourceAsStream("invalidDocument.xml");
@@ -101,8 +101,7 @@ public abstract class AbstractValidatorFactoryTestCase {
public void testHandleValidMessageDom() throws Exception {
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactoryUtils.newInstance();
documentBuilderFactory.setNamespaceAware(true);
Document document = documentBuilderFactory.newDocumentBuilder()
.parse(new InputSource(validInputStream));
Document document = documentBuilderFactory.newDocumentBuilder().parse(new InputSource(validInputStream));
SAXParseException[] errors = validator.validate(new DOMSource(document));
Assert.assertNotNull("Null returned for errors", errors);
Assert.assertEquals("ValidationErrors returned", 0, errors.length);
@@ -112,8 +111,7 @@ public abstract class AbstractValidatorFactoryTestCase {
public void testHandleInvalidMessageDom() throws Exception {
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactoryUtils.newInstance();
documentBuilderFactory.setNamespaceAware(true);
Document document = documentBuilderFactory.newDocumentBuilder()
.parse(new InputSource(invalidInputStream));
Document document = documentBuilderFactory.newDocumentBuilder().parse(new InputSource(invalidInputStream));
SAXParseException[] errors = validator.validate(new DOMSource(document));
Assert.assertNotNull("Null returned for errors", errors);
Assert.assertEquals("ValidationErrors returned", 3, errors.length);
@@ -121,9 +119,9 @@ public abstract class AbstractValidatorFactoryTestCase {
@Test
public void testMultipleSchemasValidMessage() throws Exception {
Resource[] schemaResources = new Resource[]{
Resource[] schemaResources = new Resource[] {
new ClassPathResource("multipleSchemas1.xsd", AbstractValidatorFactoryTestCase.class),
new ClassPathResource("multipleSchemas2.xsd", AbstractValidatorFactoryTestCase.class)};
new ClassPathResource("multipleSchemas2.xsd", AbstractValidatorFactoryTestCase.class) };
validator = createValidator(schemaResources, XmlValidatorFactory.SCHEMA_W3C_XML);
Source document = new ResourceSource(
@@ -144,14 +142,11 @@ public abstract class AbstractValidatorFactoryTestCase {
return new SAXParseException[0];
}
public void warning(SAXParseException exception) throws SAXException {
}
public void warning(SAXParseException exception) throws SAXException {}
public void error(SAXParseException exception) throws SAXException {
}
public void error(SAXParseException exception) throws SAXException {}
public void fatalError(SAXParseException exception) throws SAXException {
}
public void fatalError(SAXParseException exception) throws SAXException {}
};
SAXParseException[] errors = validator.validate(new StreamSource(invalidInputStream), myHandler);
Assert.assertNotNull("Null returned for errors", errors);

View File

@@ -26,4 +26,4 @@ public class Jaxp13ValidatorFactoryTest extends AbstractValidatorFactoryTestCase
protected XmlValidator createValidator(Resource[] schemaResources, String schemaLanguage) throws IOException {
return Jaxp13ValidatorFactory.createValidator(schemaResources, schemaLanguage);
}
}
}

View File

@@ -26,4 +26,4 @@ public class Jaxp15ValidatorFactoryTest extends AbstractValidatorFactoryTestCase
protected XmlValidator createValidator(Resource[] schemaResources, String schemaLanguage) throws IOException {
return Jaxp15ValidatorFactory.createValidator(schemaResources, schemaLanguage);
}
}
}

View File

@@ -19,11 +19,10 @@ package org.springframework.xml.validation;
import javax.xml.XMLConstants;
import javax.xml.validation.Schema;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
public class SchemaLoaderUtilsTest {
@@ -41,8 +40,7 @@ public class SchemaLoaderUtilsTest {
Resource nonExistant = new ClassPathResource("bla");
SchemaLoaderUtils.loadSchema(nonExistant, XMLConstants.W3C_XML_SCHEMA_NS_URI);
Assert.fail("Should have thrown an IllegalArgumentException");
}
catch (IllegalArgumentException e) {
} catch (IllegalArgumentException e) {
// expected
}
}
@@ -52,8 +50,7 @@ public class SchemaLoaderUtilsTest {
try {
SchemaLoaderUtils.loadSchema((Resource) null, XMLConstants.W3C_XML_SCHEMA_NS_URI);
Assert.fail("Should have thrown an IllegalArgumentException");
}
catch (IllegalArgumentException e) {
} catch (IllegalArgumentException e) {
// expected
}
}
@@ -62,10 +59,10 @@ public class SchemaLoaderUtilsTest {
public void testLoadMultipleSchemas() throws Exception {
Resource envelope = new ClassPathResource("envelope.xsd", getClass());
Resource encoding = new ClassPathResource("encoding.xsd", getClass());
Schema schema =
SchemaLoaderUtils.loadSchema(new Resource[]{envelope, encoding}, XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = SchemaLoaderUtils.loadSchema(new Resource[] { envelope, encoding },
XMLConstants.W3C_XML_SCHEMA_NS_URI);
Assert.assertNotNull("No schema returned", schema);
Assert.assertFalse("Resource not closed", envelope.isOpen());
Assert.assertFalse("Resource not closed", encoding.isOpen());
}
}
}

View File

@@ -24,7 +24,6 @@ import java.net.URL;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.core.io.AbstractResource;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
@@ -44,8 +43,7 @@ public class XmlValidatorFactoryTest {
try {
XmlValidatorFactory.createValidator(resource, XmlValidatorFactory.SCHEMA_W3C_XML);
Assert.fail("IllegalArgumentException expected");
}
catch (IllegalArgumentException ex) {
} catch (IllegalArgumentException ex) {
// expected
}
}
@@ -56,8 +54,7 @@ public class XmlValidatorFactoryTest {
try {
XmlValidatorFactory.createValidator(resource, "bla");
Assert.fail("IllegalArgumentException expected");
}
catch (IllegalArgumentException ex) {
} catch (IllegalArgumentException ex) {
// expected
}
}
@@ -114,4 +111,4 @@ public class XmlValidatorFactoryTest {
return false;
}
}
}
}

View File

@@ -21,20 +21,20 @@ import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.springframework.util.StringUtils;
import org.springframework.xml.DocumentBuilderFactoryUtils;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.xml.sax.SAXException;
import org.springframework.util.StringUtils;
import org.springframework.xml.DocumentBuilderFactoryUtils;
public abstract class AbstractXPathExpressionFactoryTestCase {
private Document noNamespacesDocument;
@@ -53,15 +53,13 @@ public abstract class AbstractXPathExpressionFactoryTestCase {
InputStream inputStream = getClass().getResourceAsStream("nonamespaces.xml");
try {
noNamespacesDocument = documentBuilder.parse(inputStream);
}
finally {
} finally {
inputStream.close();
}
inputStream = getClass().getResourceAsStream("namespaces.xml");
try {
namespacesDocument = documentBuilder.parse(inputStream);
}
finally {
} finally {
inputStream.close();
}
}
@@ -88,8 +86,8 @@ public abstract class AbstractXPathExpressionFactoryTestCase {
@Test
public void testEvaluateAsBooleanNamespaces() throws IOException, SAXException {
XPathExpression expression =
createXPathExpression("/prefix1:root/prefix2:child/prefix2:boolean/text()", namespaces);
XPathExpression expression = createXPathExpression("/prefix1:root/prefix2:child/prefix2:boolean/text()",
namespaces);
boolean result = expression.evaluateAsBoolean(namespacesDocument);
Assert.assertTrue("Invalid result", result);
}
@@ -117,8 +115,7 @@ public abstract class AbstractXPathExpressionFactoryTestCase {
@Test
public void testEvaluateAsDoubleNamespaces() throws IOException, SAXException {
XPathExpression expression =
createXPathExpression("/prefix1:root/prefix2:child/prefix2:number/text()", namespaces);
XPathExpression expression = createXPathExpression("/prefix1:root/prefix2:child/prefix2:number/text()", namespaces);
double result = expression.evaluateAsNumber(namespacesDocument);
Assert.assertEquals("Invalid result", 42D, result, 0D);
}
@@ -192,8 +189,7 @@ public abstract class AbstractXPathExpressionFactoryTestCase {
@Test
public void testEvaluateAsStringNamespaces() throws IOException, SAXException {
XPathExpression expression =
createXPathExpression("/prefix1:root/prefix2:child/prefix2:text/text()", namespaces);
XPathExpression expression = createXPathExpression("/prefix1:root/prefix2:child/prefix2:text/text()", namespaces);
String result = expression.evaluateAsString(namespacesDocument);
Assert.assertEquals("Invalid result", "text", result);
}
@@ -237,8 +233,7 @@ public abstract class AbstractXPathExpressionFactoryTestCase {
try {
createXPathExpression("\\");
Assert.fail("No XPathParseException thrown");
}
catch (XPathParseException ex) {
} catch (XPathParseException ex) {
// Expected behaviour
}
}

View File

@@ -20,6 +20,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
@@ -31,14 +32,13 @@ import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stax.StAXSource;
import javax.xml.transform.stream.StreamSource;
import org.springframework.core.io.ClassPathResource;
import org.springframework.xml.sax.SaxUtils;
import org.springframework.xml.transform.ResourceSource;
import org.springframework.xml.DocumentBuilderFactoryUtils;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.springframework.core.io.ClassPathResource;
import org.springframework.xml.DocumentBuilderFactoryUtils;
import org.springframework.xml.sax.SaxUtils;
import org.springframework.xml.transform.ResourceSource;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
@@ -57,8 +57,7 @@ public abstract class AbstractXPathTemplateTestCase {
public final void setUp() throws Exception {
template = createTemplate();
namespaces = new ResourceSource(new ClassPathResource("namespaces.xml", AbstractXPathTemplateTestCase.class));
nonamespaces =
new ResourceSource(new ClassPathResource("nonamespaces.xml", AbstractXPathTemplateTestCase.class));
nonamespaces = new ResourceSource(new ClassPathResource("nonamespaces.xml", AbstractXPathTemplateTestCase.class));
}
protected abstract XPathOperations createTemplate() throws Exception;
@@ -132,8 +131,8 @@ public abstract class AbstractXPathTemplateTestCase {
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactoryUtils.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document document = documentBuilder.parse(SaxUtils.createInputSource(
new ClassPathResource("nonamespaces.xml", AbstractXPathTemplateTestCase.class)));
Document document = documentBuilder.parse(
SaxUtils.createInputSource(new ClassPathResource("nonamespaces.xml", AbstractXPathTemplateTestCase.class)));
String result = template.evaluateAsString("/root/child/text", new DOMSource(document));
Assert.assertEquals("Invalid result", "text", result);
@@ -176,8 +175,7 @@ public abstract class AbstractXPathTemplateTestCase {
try {
template.evaluateAsBoolean("\\", namespaces);
Assert.fail("No XPathException thrown");
}
catch (XPathException ex) {
} catch (XPathException ex) {
// Expected behaviour
}
}

View File

@@ -31,4 +31,4 @@ public class JaxenXPathTemplateTest extends AbstractXPathTemplateTestCase {
return template;
}
}
}

View File

@@ -29,4 +29,4 @@ public class Jaxp13XPathExpressionFactoryTest extends AbstractXPathExpressionFac
protected XPathExpression createXPathExpression(String expression, Map<String, String> namespaces) {
return Jaxp13XPathExpressionFactory.createXPathExpression(expression, namespaces);
}
}
}

View File

@@ -31,4 +31,4 @@ public class Jaxp13XPathTemplateTest extends AbstractXPathTemplateTestCase {
return template;
}
}
}

View File

@@ -39,4 +39,4 @@ public class XPathExpressionFactoryBeanTest {
Assert.assertTrue("Not a singleton", factoryBean.isSingleton());
Assert.assertEquals("Not a XPathExpresison", XPathExpression.class, factoryBean.getObjectType());
}
}
}

View File

@@ -32,9 +32,8 @@ public class XPathExpressionFactoryTest {
try {
XPathExpressionFactory.createXPathExpression("");
Assert.fail("Should have thrown an Exception");
}
catch (IllegalArgumentException ex) {
} catch (IllegalArgumentException ex) {
// expected
}
}
}
}

View File

@@ -16,6 +16,8 @@
package org.springframework.xml.xsd;
import static org.custommonkey.xmlunit.XMLAssert.*;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Transformer;
@@ -26,16 +28,13 @@ import org.custommonkey.xmlunit.XMLUnit;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.w3c.dom.Document;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.xml.DocumentBuilderFactoryUtils;
import org.springframework.xml.sax.SaxUtils;
import org.springframework.xml.transform.TransformerFactoryUtils;
import org.springframework.xml.validation.XmlValidator;
import static org.custommonkey.xmlunit.XMLAssert.*;
import org.w3c.dom.Document;
public abstract class AbstractXsdSchemaTestCase {

View File

@@ -17,7 +17,6 @@
package org.springframework.xml.xsd;
import org.junit.Test;
import org.springframework.core.io.Resource;
public class SimpleXsdSchemaTest extends AbstractXsdSchemaTestCase {
@@ -36,4 +35,4 @@ public class SimpleXsdSchemaTest extends AbstractXsdSchemaTestCase {
schema.toString();
}
}
}

View File

@@ -16,6 +16,8 @@
package org.springframework.xml.xsd.commons;
import static org.custommonkey.xmlunit.XMLAssert.*;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Transformer;
@@ -26,18 +28,15 @@ import org.custommonkey.xmlunit.XMLUnit;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.w3c.dom.Document;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.xml.DocumentBuilderFactoryUtils;
import org.springframework.xml.sax.SaxUtils;
import org.springframework.xml.transform.TransformerFactoryUtils;
import org.springframework.xml.validation.XmlValidator;
import org.springframework.xml.xsd.AbstractXsdSchemaTestCase;
import org.springframework.xml.DocumentBuilderFactoryUtils;
import org.springframework.xml.xsd.XsdSchema;
import static org.custommonkey.xmlunit.XMLAssert.*;
import org.w3c.dom.Document;
public class CommonsXsdSchemaCollectionTest {
@@ -128,8 +127,7 @@ public class CommonsXsdSchemaCollectionTest {
try {
collection.afterPropertiesSet();
Assert.fail("CommonsXsdSchemaException expected");
}
catch (CommonsXsdSchemaException ex) {
} catch (CommonsXsdSchemaException ex) {
// expected
}
}
@@ -151,7 +149,8 @@ public class CommonsXsdSchemaCollectionTest {
transformer.transform(schemas[0].getSource(), domResult);
assertXMLEqual("Invalid XSD generated", expected, (Document) domResult.getNode());
Assert.assertEquals("Invalid target namespace", "http://mycompany.com/hr/schemas/holiday", schemas[1].getTargetNamespace());
Assert.assertEquals("Invalid target namespace", "http://mycompany.com/hr/schemas/holiday",
schemas[1].getTargetNamespace());
Resource holiday = new ClassPathResource("holiday.xsd", getClass());
expected = documentBuilder.parse(SaxUtils.createInputSource(holiday));
domResult = new DOMResult();
@@ -159,4 +158,4 @@ public class CommonsXsdSchemaCollectionTest {
assertXMLEqual("Invalid XSD generated", expected, (Document) domResult.getNode());
}
}
}

View File

@@ -16,23 +16,21 @@
package org.springframework.xml.xsd.commons;
import static org.junit.Assert.*;
import javax.xml.transform.dom.DOMSource;
import org.apache.ws.commons.schema.XmlSchema;
import org.apache.ws.commons.schema.XmlSchemaCollection;
import org.junit.Test;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.xml.sax.SaxUtils;
import org.springframework.xml.xsd.AbstractXsdSchemaTestCase;
import org.springframework.xml.xsd.XsdSchema;
import org.apache.ws.commons.schema.XmlSchema;
import org.apache.ws.commons.schema.XmlSchemaCollection;
import org.junit.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
public class CommonsXsdSchemaTest extends AbstractXsdSchemaTestCase {
@Override
@@ -55,5 +53,4 @@ public class CommonsXsdSchemaTest extends AbstractXsdSchemaTestCase {
elementElement.getAttributeNS("http://www.w3.org/2005/05/xmlmime", "expectedContentTypes"));
}
}
}

View File

@@ -1,6 +1,5 @@
log4j.rootCategory=INFO, stdout
log4j.logger.org.springframework.xml=DEBUG
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n

View File

@@ -4,501 +4,501 @@
xmlns:tns="http://schemas.xmlsoap.org/soap/encoding/"
targetNamespace="http://schemas.xmlsoap.org/soap/encoding/">
<xs:attribute name="root">
<xs:annotation>
<xs:documentation>
'root' can be used to distinguish serialization roots from other
elements that are present in a serialization but are not roots of
a serialized value graph
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base='xs:boolean'>
<xs:pattern value='0|1'/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="root">
<xs:annotation>
<xs:documentation>
'root' can be used to distinguish serialization roots from other
elements that are present in a serialization but are not roots of
a serialized value graph
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base='xs:boolean'>
<xs:pattern value='0|1'/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attributeGroup name="commonAttributes">
<xs:annotation>
<xs:documentation>
Attributes common to all elements that function as accessors or
represent independent (multi-ref) values. The href attribute is
intended to be used in a manner like CONREF. That is, the element
content should be empty iff the href attribute appears
</xs:documentation>
</xs:annotation>
<xs:attribute name="id" type="xs:ID"/>
<xs:attribute name="href" type="xs:anyURI"/>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:attributeGroup>
<xs:attributeGroup name="commonAttributes">
<xs:annotation>
<xs:documentation>
Attributes common to all elements that function as accessors or
represent independent (multi-ref) values. The href attribute is
intended to be used in a manner like CONREF. That is, the element
content should be empty iff the href attribute appears
</xs:documentation>
</xs:annotation>
<xs:attribute name="id" type="xs:ID"/>
<xs:attribute name="href" type="xs:anyURI"/>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:attributeGroup>
<!-- Global Attributes. The following attributes are intended to be usable via qualified attribute names on any complex type referencing them. -->
<!-- Global Attributes. The following attributes are intended to be usable via qualified attribute names on any complex type referencing them. -->
<!-- Array attributes. Needed to give the type and dimensions of an array's contents, and the offset for partially-transmitted arrays. -->
<!-- Array attributes. Needed to give the type and dimensions of an array's contents, and the offset for partially-transmitted arrays. -->
<xs:simpleType name="arrayCoordinate">
<xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:simpleType name="arrayCoordinate">
<xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:attribute name="arrayType" type="xs:string"/>
<xs:attribute name="offset" type="tns:arrayCoordinate"/>
<xs:attribute name="arrayType" type="xs:string"/>
<xs:attribute name="offset" type="tns:arrayCoordinate"/>
<xs:attributeGroup name="arrayAttributes">
<xs:attribute ref="tns:arrayType"/>
<xs:attribute ref="tns:offset"/>
</xs:attributeGroup>
<xs:attributeGroup name="arrayAttributes">
<xs:attribute ref="tns:arrayType"/>
<xs:attribute ref="tns:offset"/>
</xs:attributeGroup>
<xs:attribute name="position" type="tns:arrayCoordinate"/>
<xs:attribute name="position" type="tns:arrayCoordinate"/>
<xs:attributeGroup name="arrayMemberAttributes">
<xs:attribute ref="tns:position"/>
</xs:attributeGroup>
<xs:attributeGroup name="arrayMemberAttributes">
<xs:attribute ref="tns:position"/>
</xs:attributeGroup>
<xs:group name="Array">
<xs:sequence>
<xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
</xs:sequence>
</xs:group>
<xs:group name="Array">
<xs:sequence>
<xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
</xs:sequence>
</xs:group>
<xs:element name="Array" type="tns:Array"/>
<xs:complexType name="Array">
<xs:annotation>
<xs:documentation>
'Array' is a complex type for accessors identified by position
</xs:documentation>
</xs:annotation>
<xs:group ref="tns:Array" minOccurs="0"/>
<xs:attributeGroup ref="tns:arrayAttributes"/>
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:complexType>
<xs:element name="Array" type="tns:Array"/>
<xs:complexType name="Array">
<xs:annotation>
<xs:documentation>
'Array' is a complex type for accessors identified by position
</xs:documentation>
</xs:annotation>
<xs:group ref="tns:Array" minOccurs="0"/>
<xs:attributeGroup ref="tns:arrayAttributes"/>
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:complexType>
<!-- 'Struct' is a complex type for accessors identified by name.
<!-- 'Struct' is a complex type for accessors identified by name.
Constraint: No element may be have the same name as any other,
nor may any element have a maxOccurs > 1. -->
<xs:element name="Struct" type="tns:Struct"/>
<xs:element name="Struct" type="tns:Struct"/>
<xs:group name="Struct">
<xs:sequence>
<xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
</xs:sequence>
</xs:group>
<xs:group name="Struct">
<xs:sequence>
<xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
</xs:sequence>
</xs:group>
<xs:complexType name="Struct">
<xs:group ref="tns:Struct" minOccurs="0"/>
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:complexType>
<xs:complexType name="Struct">
<xs:group ref="tns:Struct" minOccurs="0"/>
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:complexType>
<!-- 'Base64' can be used to serialize binary data using base64 encoding
<!-- 'Base64' can be used to serialize binary data using base64 encoding
as defined in RFC2045 but without the MIME line length limitation. -->
<xs:simpleType name="base64">
<xs:restriction base="xs:base64Binary"/>
</xs:simpleType>
<xs:simpleType name="base64">
<xs:restriction base="xs:base64Binary"/>
</xs:simpleType>
<!-- Element declarations corresponding to each of the simple types in the
<!-- Element declarations corresponding to each of the simple types in the
XML Schemas Specification. -->
<xs:element name="duration" type="tns:duration"/>
<xs:complexType name="duration">
<xs:simpleContent>
<xs:extension base="xs:duration">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="duration" type="tns:duration"/>
<xs:complexType name="duration">
<xs:simpleContent>
<xs:extension base="xs:duration">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="dateTime" type="tns:dateTime"/>
<xs:complexType name="dateTime">
<xs:simpleContent>
<xs:extension base="xs:dateTime">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="dateTime" type="tns:dateTime"/>
<xs:complexType name="dateTime">
<xs:simpleContent>
<xs:extension base="xs:dateTime">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="NOTATION" type="tns:NOTATION"/>
<xs:complexType name="NOTATION">
<xs:simpleContent>
<xs:extension base="xs:QName">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="NOTATION" type="tns:NOTATION"/>
<xs:complexType name="NOTATION">
<xs:simpleContent>
<xs:extension base="xs:QName">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="time" type="tns:time"/>
<xs:complexType name="time">
<xs:simpleContent>
<xs:extension base="xs:time">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="time" type="tns:time"/>
<xs:complexType name="time">
<xs:simpleContent>
<xs:extension base="xs:time">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="date" type="tns:date"/>
<xs:complexType name="date">
<xs:simpleContent>
<xs:extension base="xs:date">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="date" type="tns:date"/>
<xs:complexType name="date">
<xs:simpleContent>
<xs:extension base="xs:date">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="gYearMonth" type="tns:gYearMonth"/>
<xs:complexType name="gYearMonth">
<xs:simpleContent>
<xs:extension base="xs:gYearMonth">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="gYearMonth" type="tns:gYearMonth"/>
<xs:complexType name="gYearMonth">
<xs:simpleContent>
<xs:extension base="xs:gYearMonth">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="gYear" type="tns:gYear"/>
<xs:complexType name="gYear">
<xs:simpleContent>
<xs:extension base="xs:gYear">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="gYear" type="tns:gYear"/>
<xs:complexType name="gYear">
<xs:simpleContent>
<xs:extension base="xs:gYear">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="gMonthDay" type="tns:gMonthDay"/>
<xs:complexType name="gMonthDay">
<xs:simpleContent>
<xs:extension base="xs:gMonthDay">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="gMonthDay" type="tns:gMonthDay"/>
<xs:complexType name="gMonthDay">
<xs:simpleContent>
<xs:extension base="xs:gMonthDay">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="gDay" type="tns:gDay"/>
<xs:complexType name="gDay">
<xs:simpleContent>
<xs:extension base="xs:gDay">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="gDay" type="tns:gDay"/>
<xs:complexType name="gDay">
<xs:simpleContent>
<xs:extension base="xs:gDay">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="gMonth" type="tns:gMonth"/>
<xs:complexType name="gMonth">
<xs:simpleContent>
<xs:extension base="xs:gMonth">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="gMonth" type="tns:gMonth"/>
<xs:complexType name="gMonth">
<xs:simpleContent>
<xs:extension base="xs:gMonth">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="boolean" type="tns:boolean"/>
<xs:complexType name="boolean">
<xs:simpleContent>
<xs:extension base="xs:boolean">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="boolean" type="tns:boolean"/>
<xs:complexType name="boolean">
<xs:simpleContent>
<xs:extension base="xs:boolean">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="base64Binary" type="tns:base64Binary"/>
<xs:complexType name="base64Binary">
<xs:simpleContent>
<xs:extension base="xs:base64Binary">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="base64Binary" type="tns:base64Binary"/>
<xs:complexType name="base64Binary">
<xs:simpleContent>
<xs:extension base="xs:base64Binary">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="hexBinary" type="tns:hexBinary"/>
<xs:complexType name="hexBinary">
<xs:simpleContent>
<xs:extension base="xs:hexBinary">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="hexBinary" type="tns:hexBinary"/>
<xs:complexType name="hexBinary">
<xs:simpleContent>
<xs:extension base="xs:hexBinary">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="float" type="tns:float"/>
<xs:complexType name="float">
<xs:simpleContent>
<xs:extension base="xs:float">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="float" type="tns:float"/>
<xs:complexType name="float">
<xs:simpleContent>
<xs:extension base="xs:float">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="double" type="tns:double"/>
<xs:complexType name="double">
<xs:simpleContent>
<xs:extension base="xs:double">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="double" type="tns:double"/>
<xs:complexType name="double">
<xs:simpleContent>
<xs:extension base="xs:double">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="anyURI" type="tns:anyURI"/>
<xs:complexType name="anyURI">
<xs:simpleContent>
<xs:extension base="xs:anyURI">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="anyURI" type="tns:anyURI"/>
<xs:complexType name="anyURI">
<xs:simpleContent>
<xs:extension base="xs:anyURI">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="QName" type="tns:QName"/>
<xs:complexType name="QName">
<xs:simpleContent>
<xs:extension base="xs:QName">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="QName" type="tns:QName"/>
<xs:complexType name="QName">
<xs:simpleContent>
<xs:extension base="xs:QName">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="string" type="tns:string"/>
<xs:complexType name="string">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="string" type="tns:string"/>
<xs:complexType name="string">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="normalizedString" type="tns:normalizedString"/>
<xs:complexType name="normalizedString">
<xs:simpleContent>
<xs:extension base="xs:normalizedString">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="normalizedString" type="tns:normalizedString"/>
<xs:complexType name="normalizedString">
<xs:simpleContent>
<xs:extension base="xs:normalizedString">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="token" type="tns:token"/>
<xs:complexType name="token">
<xs:simpleContent>
<xs:extension base="xs:token">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="token" type="tns:token"/>
<xs:complexType name="token">
<xs:simpleContent>
<xs:extension base="xs:token">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="language" type="tns:language"/>
<xs:complexType name="language">
<xs:simpleContent>
<xs:extension base="xs:language">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="language" type="tns:language"/>
<xs:complexType name="language">
<xs:simpleContent>
<xs:extension base="xs:language">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="Name" type="tns:Name"/>
<xs:complexType name="Name">
<xs:simpleContent>
<xs:extension base="xs:Name">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="Name" type="tns:Name"/>
<xs:complexType name="Name">
<xs:simpleContent>
<xs:extension base="xs:Name">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="NMTOKEN" type="tns:NMTOKEN"/>
<xs:complexType name="NMTOKEN">
<xs:simpleContent>
<xs:extension base="xs:NMTOKEN">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="NMTOKEN" type="tns:NMTOKEN"/>
<xs:complexType name="NMTOKEN">
<xs:simpleContent>
<xs:extension base="xs:NMTOKEN">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="NCName" type="tns:NCName"/>
<xs:complexType name="NCName">
<xs:simpleContent>
<xs:extension base="xs:NCName">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="NCName" type="tns:NCName"/>
<xs:complexType name="NCName">
<xs:simpleContent>
<xs:extension base="xs:NCName">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="NMTOKENS" type="tns:NMTOKENS"/>
<xs:complexType name="NMTOKENS">
<xs:simpleContent>
<xs:extension base="xs:NMTOKENS">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="NMTOKENS" type="tns:NMTOKENS"/>
<xs:complexType name="NMTOKENS">
<xs:simpleContent>
<xs:extension base="xs:NMTOKENS">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="ID" type="tns:ID"/>
<xs:complexType name="ID">
<xs:simpleContent>
<xs:extension base="xs:ID">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="ID" type="tns:ID"/>
<xs:complexType name="ID">
<xs:simpleContent>
<xs:extension base="xs:ID">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="IDREF" type="tns:IDREF"/>
<xs:complexType name="IDREF">
<xs:simpleContent>
<xs:extension base="xs:IDREF">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="IDREF" type="tns:IDREF"/>
<xs:complexType name="IDREF">
<xs:simpleContent>
<xs:extension base="xs:IDREF">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="ENTITY" type="tns:ENTITY"/>
<xs:complexType name="ENTITY">
<xs:simpleContent>
<xs:extension base="xs:ENTITY">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="ENTITY" type="tns:ENTITY"/>
<xs:complexType name="ENTITY">
<xs:simpleContent>
<xs:extension base="xs:ENTITY">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="IDREFS" type="tns:IDREFS"/>
<xs:complexType name="IDREFS">
<xs:simpleContent>
<xs:extension base="xs:IDREFS">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="IDREFS" type="tns:IDREFS"/>
<xs:complexType name="IDREFS">
<xs:simpleContent>
<xs:extension base="xs:IDREFS">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="ENTITIES" type="tns:ENTITIES"/>
<xs:complexType name="ENTITIES">
<xs:simpleContent>
<xs:extension base="xs:ENTITIES">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="ENTITIES" type="tns:ENTITIES"/>
<xs:complexType name="ENTITIES">
<xs:simpleContent>
<xs:extension base="xs:ENTITIES">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="decimal" type="tns:decimal"/>
<xs:complexType name="decimal">
<xs:simpleContent>
<xs:extension base="xs:decimal">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="decimal" type="tns:decimal"/>
<xs:complexType name="decimal">
<xs:simpleContent>
<xs:extension base="xs:decimal">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="integer" type="tns:integer"/>
<xs:complexType name="integer">
<xs:simpleContent>
<xs:extension base="xs:integer">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="integer" type="tns:integer"/>
<xs:complexType name="integer">
<xs:simpleContent>
<xs:extension base="xs:integer">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="nonPositiveInteger" type="tns:nonPositiveInteger"/>
<xs:complexType name="nonPositiveInteger">
<xs:simpleContent>
<xs:extension base="xs:nonPositiveInteger">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="nonPositiveInteger" type="tns:nonPositiveInteger"/>
<xs:complexType name="nonPositiveInteger">
<xs:simpleContent>
<xs:extension base="xs:nonPositiveInteger">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="negativeInteger" type="tns:negativeInteger"/>
<xs:complexType name="negativeInteger">
<xs:simpleContent>
<xs:extension base="xs:negativeInteger">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="negativeInteger" type="tns:negativeInteger"/>
<xs:complexType name="negativeInteger">
<xs:simpleContent>
<xs:extension base="xs:negativeInteger">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="long" type="tns:long"/>
<xs:complexType name="long">
<xs:simpleContent>
<xs:extension base="xs:long">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="long" type="tns:long"/>
<xs:complexType name="long">
<xs:simpleContent>
<xs:extension base="xs:long">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="int" type="tns:int"/>
<xs:complexType name="int">
<xs:simpleContent>
<xs:extension base="xs:int">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="int" type="tns:int"/>
<xs:complexType name="int">
<xs:simpleContent>
<xs:extension base="xs:int">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="short" type="tns:short"/>
<xs:complexType name="short">
<xs:simpleContent>
<xs:extension base="xs:short">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="short" type="tns:short"/>
<xs:complexType name="short">
<xs:simpleContent>
<xs:extension base="xs:short">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="byte" type="tns:byte"/>
<xs:complexType name="byte">
<xs:simpleContent>
<xs:extension base="xs:byte">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="byte" type="tns:byte"/>
<xs:complexType name="byte">
<xs:simpleContent>
<xs:extension base="xs:byte">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="nonNegativeInteger" type="tns:nonNegativeInteger"/>
<xs:complexType name="nonNegativeInteger">
<xs:simpleContent>
<xs:extension base="xs:nonNegativeInteger">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="nonNegativeInteger" type="tns:nonNegativeInteger"/>
<xs:complexType name="nonNegativeInteger">
<xs:simpleContent>
<xs:extension base="xs:nonNegativeInteger">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="unsignedLong" type="tns:unsignedLong"/>
<xs:complexType name="unsignedLong">
<xs:simpleContent>
<xs:extension base="xs:unsignedLong">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="unsignedLong" type="tns:unsignedLong"/>
<xs:complexType name="unsignedLong">
<xs:simpleContent>
<xs:extension base="xs:unsignedLong">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="unsignedInt" type="tns:unsignedInt"/>
<xs:complexType name="unsignedInt">
<xs:simpleContent>
<xs:extension base="xs:unsignedInt">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="unsignedInt" type="tns:unsignedInt"/>
<xs:complexType name="unsignedInt">
<xs:simpleContent>
<xs:extension base="xs:unsignedInt">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="unsignedShort" type="tns:unsignedShort"/>
<xs:complexType name="unsignedShort">
<xs:simpleContent>
<xs:extension base="xs:unsignedShort">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="unsignedShort" type="tns:unsignedShort"/>
<xs:complexType name="unsignedShort">
<xs:simpleContent>
<xs:extension base="xs:unsignedShort">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="unsignedByte" type="tns:unsignedByte"/>
<xs:complexType name="unsignedByte">
<xs:simpleContent>
<xs:extension base="xs:unsignedByte">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="unsignedByte" type="tns:unsignedByte"/>
<xs:complexType name="unsignedByte">
<xs:simpleContent>
<xs:extension base="xs:unsignedByte">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="positiveInteger" type="tns:positiveInteger"/>
<xs:complexType name="positiveInteger">
<xs:simpleContent>
<xs:extension base="xs:positiveInteger">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="positiveInteger" type="tns:positiveInteger"/>
<xs:complexType name="positiveInteger">
<xs:simpleContent>
<xs:extension base="xs:positiveInteger">
<xs:attributeGroup ref="tns:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="anyType"/>
<xs:element name="anyType"/>
</xs:schema>

View File

@@ -5,87 +5,87 @@
targetNamespace="http://schemas.xmlsoap.org/soap/envelope/">
<!-- Envelope, header and body -->
<xs:element name="Envelope" type="tns:Envelope"/>
<xs:complexType name="Envelope">
<xs:sequence>
<xs:element ref="tns:Header" minOccurs="0"/>
<xs:element ref="tns:Body" minOccurs="1"/>
<xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
</xs:sequence>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>
<!-- Envelope, header and body -->
<xs:element name="Envelope" type="tns:Envelope"/>
<xs:complexType name="Envelope">
<xs:sequence>
<xs:element ref="tns:Header" minOccurs="0"/>
<xs:element ref="tns:Body" minOccurs="1"/>
<xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
</xs:sequence>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>
<xs:element name="Header" type="tns:Header"/>
<xs:complexType name="Header">
<xs:sequence>
<xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
</xs:sequence>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>
<xs:element name="Header" type="tns:Header"/>
<xs:complexType name="Header">
<xs:sequence>
<xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
</xs:sequence>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>
<xs:element name="Body" type="tns:Body"/>
<xs:complexType name="Body">
<xs:sequence>
<xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
</xs:sequence>
<xs:anyAttribute namespace="##any" processContents="lax">
<xs:annotation>
<xs:documentation>
Prose in the spec does not specify that attributes are allowed on the Body element
</xs:documentation>
</xs:annotation>
</xs:anyAttribute>
</xs:complexType>
<xs:element name="Body" type="tns:Body"/>
<xs:complexType name="Body">
<xs:sequence>
<xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
</xs:sequence>
<xs:anyAttribute namespace="##any" processContents="lax">
<xs:annotation>
<xs:documentation>
Prose in the spec does not specify that attributes are allowed on the Body element
</xs:documentation>
</xs:annotation>
</xs:anyAttribute>
</xs:complexType>
<!-- Global Attributes. The following attributes are intended to be usable via qualified attribute names on any complex type referencing them. -->
<xs:attribute name="mustUnderstand">
<xs:simpleType>
<xs:restriction base='xs:boolean'>
<xs:pattern value='0|1'/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="actor" type="xs:anyURI"/>
<!-- Global Attributes. The following attributes are intended to be usable via qualified attribute names on any complex type referencing them. -->
<xs:attribute name="mustUnderstand">
<xs:simpleType>
<xs:restriction base='xs:boolean'>
<xs:pattern value='0|1'/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="actor" type="xs:anyURI"/>
<xs:simpleType name="encodingStyle">
<xs:annotation>
<xs:documentation>
'encodingStyle' indicates any canonicalization conventions followed in the contents of the containing
element. For example, the value 'http://schemas.xmlsoap.org/soap/encoding/' indicates the pattern
described in SOAP specification
</xs:documentation>
</xs:annotation>
<xs:list itemType="xs:anyURI"/>
</xs:simpleType>
<xs:simpleType name="encodingStyle">
<xs:annotation>
<xs:documentation>
'encodingStyle' indicates any canonicalization conventions followed in the contents of the containing
element. For example, the value 'http://schemas.xmlsoap.org/soap/encoding/' indicates the pattern
described in SOAP specification
</xs:documentation>
</xs:annotation>
<xs:list itemType="xs:anyURI"/>
</xs:simpleType>
<xs:attribute name="encodingStyle" type="tns:encodingStyle"/>
<xs:attributeGroup name="encodingStyle">
<xs:attribute ref="tns:encodingStyle"/>
</xs:attributeGroup>
<xs:attribute name="encodingStyle" type="tns:encodingStyle"/>
<xs:attributeGroup name="encodingStyle">
<xs:attribute ref="tns:encodingStyle"/>
</xs:attributeGroup>
<xs:element name="Fault" type="tns:Fault"/>
<xs:complexType name="Fault" final="extension">
<xs:annotation>
<xs:documentation>
Fault reporting structure
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="faultcode" type="xs:QName"/>
<xs:element name="faultstring" type="xs:string"/>
<xs:element name="faultactor" type="xs:anyURI" minOccurs="0"/>
<xs:element name="detail" type="tns:detail" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:element name="Fault" type="tns:Fault"/>
<xs:complexType name="Fault" final="extension">
<xs:annotation>
<xs:documentation>
Fault reporting structure
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="faultcode" type="xs:QName"/>
<xs:element name="faultstring" type="xs:string"/>
<xs:element name="faultactor" type="xs:anyURI" minOccurs="0"/>
<xs:element name="detail" type="tns:detail" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="detail">
<xs:sequence>
<xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
</xs:sequence>
<xs:anyAttribute namespace="##any" processContents="lax"/>
</xs:complexType>
<xs:complexType name="detail">
<xs:sequence>
<xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
</xs:sequence>
<xs:anyAttribute namespace="##any" processContents="lax"/>
</xs:complexType>
</xs:schema>

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<product xmlns="http://www.springframework.org/spring-ws/test/validation" effDate="2006-01-01">
<size>20</size>
<size>20</size>
</product>

View File

@@ -3,12 +3,12 @@
targetNamespace="http://www.springframework.org/spring-ws/test/multipleSchemas1"
elementFormDefault="qualified">
<element name="multipleSchemas1">
<simpleType>
<restriction base="string">
<pattern value="[a-c]+"/>
</restriction>
</simpleType>
</element>
<element name="multipleSchemas1">
<simpleType>
<restriction base="string">
<pattern value="[a-c]+"/>
</restriction>
</simpleType>
</element>
</schema>

View File

@@ -3,12 +3,12 @@
targetNamespace="http://www.springframework.org/spring-ws/test/multipleSchemas2"
elementFormDefault="qualified">
<element name="multipleSchemas2">
<simpleType>
<restriction base="string">
<pattern value="[1-3]+"/>
</restriction>
</simpleType>
</element>
<element name="multipleSchemas2">
<simpleType>
<restriction base="string">
<pattern value="[1-3]+"/>
</restriction>
</simpleType>
</element>
</schema>

View File

@@ -3,20 +3,20 @@
targetNamespace="http://www.springframework.org/spring-ws/test/validation"
xmlns:tns="http://www.springframework.org/spring-ws/test/validation" elementFormDefault="qualified">
<element name="product" type="tns:ProductType"/>
<element name="product" type="tns:ProductType"/>
<complexType name="ProductType">
<sequence>
<element name="number" type="integer"/>
<element name="size" type="tns:SizeType"/>
</sequence>
<attribute name="effDate" type="date"/>
</complexType>
<complexType name="ProductType">
<sequence>
<element name="number" type="integer"/>
<element name="size" type="tns:SizeType"/>
</sequence>
<attribute name="effDate" type="date"/>
</complexType>
<simpleType name="SizeType">
<restriction base="integer">
<minInclusive value="2"/>
<maxInclusive value="18"/>
</restriction>
</simpleType>
<simpleType name="SizeType">
<restriction base="integer">
<minInclusive value="2"/>
<maxInclusive value="18"/>
</restriction>
</simpleType>
</schema>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<product xmlns="http://www.springframework.org/spring-ws/test/validation" effDate="2006-01-01">
<number>42</number>
<size>10</size>
<number>42</number>
<size>10</size>
</product>

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns="namespace1">
<prefix:child xmlns:prefix="namespace2">
<prefix:text>text</prefix:text>
<prefix:number>42.0</prefix:number>
<prefix:boolean>1</prefix:boolean>
</prefix:child>
<prefix:child xmlns:prefix="namespace2">
<prefix:text>text</prefix:text>
<prefix:number>42.0</prefix:number>
<prefix:boolean>1</prefix:boolean>
</prefix:child>
</root>

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<root>
<child>
<text>text</text>
<number>42.0</number>
<boolean>1</boolean>
</child>
<child>
<text>text</text>
<number>42.0</number>
<boolean>1</boolean>
</child>
</root>

View File

@@ -3,10 +3,10 @@
targetNamespace="urn:1"
xmlns:tns="urn:1" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xsd:include schemaLocation="B.xsd"/>
<xsd:complexType name="A">
<xsd:complexContent>
<xsd:extension base="tns:B"/>
</xsd:complexContent>
</xsd:complexType>
<xsd:include schemaLocation="B.xsd"/>
<xsd:complexType name="A">
<xsd:complexContent>
<xsd:extension base="tns:B"/>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>

View File

@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns0="urn:2" xmlns:tns="urn:1"
attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="urn:1">
<xsd:import namespace="urn:2"/>
<xsd:complexType name="A">
<xsd:complexContent>
<xsd:extension base="tns:B"/>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="B">
<xsd:sequence>
<xsd:element name="c" type="tns:C"/>
<xsd:element name="d" type="ns0:D"/>
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="C">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
<xsd:import namespace="urn:2"/>
<xsd:complexType name="A">
<xsd:complexContent>
<xsd:extension base="tns:B"/>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="B">
<xsd:sequence>
<xsd:element name="c" type="tns:C"/>
<xsd:element name="d" type="ns0:D"/>
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="C">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
</xsd:schema>

View File

@@ -3,12 +3,12 @@
targetNamespace="urn:1"
xmlns="urn:1"
xmlns:imported="urn:2" elementFormDefault="qualified">
<xsd:include schemaLocation="C.xsd"/>
<xsd:import schemaLocation="D.xsd" namespace="urn:2"/>
<xsd:complexType name="B">
<xsd:sequence>
<xsd:element type="C" name="c"/>
<xsd:element type="imported:D" name="d"/>
</xsd:sequence>
</xsd:complexType>
<xsd:include schemaLocation="C.xsd"/>
<xsd:import schemaLocation="D.xsd" namespace="urn:2"/>
<xsd:complexType name="B">
<xsd:sequence>
<xsd:element type="C" name="c"/>
<xsd:element type="imported:D" name="d"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xsd:simpleType name="C">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
<xsd:simpleType name="C">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
</xsd:schema>

View File

@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:2" attributeFormDefault="unqualified"
elementFormDefault="qualified" targetNamespace="urn:2">
<xsd:simpleType name="D">
<xsd:restriction base="C"/>
</xsd:simpleType>
<xsd:simpleType name="C">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
<xsd:simpleType name="D">
<xsd:restriction base="C"/>
</xsd:simpleType>
<xsd:simpleType name="C">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
</xsd:schema>

View File

@@ -2,8 +2,8 @@
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:2"
xmlns="urn:2" elementFormDefault="qualified">
<xsd:include schemaLocation="C.xsd"/>
<xsd:simpleType name="D">
<xsd:restriction base="C"/>
</xsd:simpleType>
<xsd:include schemaLocation="C.xsd"/>
<xsd:simpleType name="D">
<xsd:restriction base="C"/>
</xsd:simpleType>
</xsd:schema>

View File

@@ -3,11 +3,11 @@
targetNamespace="urn:1"
xmlns:tns="urn:1" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xsd:include schemaLocation="circular-2.xsd"/>
<xsd:simpleType name="A1">
<xsd:restriction base="tns:B1"/>
</xsd:simpleType>
<xsd:simpleType name="A2">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
<xsd:include schemaLocation="circular-2.xsd"/>
<xsd:simpleType name="A1">
<xsd:restriction base="tns:B1"/>
</xsd:simpleType>
<xsd:simpleType name="A2">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
</xsd:schema>

View File

@@ -3,8 +3,8 @@
targetNamespace="urn:1"
xmlns:tns="urn:1" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xsd:include schemaLocation="circular-3.xsd"/>
<xsd:simpleType name="B1">
<xsd:restriction base="tns:C1"/>
</xsd:simpleType>
<xsd:include schemaLocation="circular-3.xsd"/>
<xsd:simpleType name="B1">
<xsd:restriction base="tns:C1"/>
</xsd:simpleType>
</xsd:schema>

View File

@@ -3,11 +3,11 @@
targetNamespace="urn:1"
xmlns:tns="urn:1" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xsd:include schemaLocation="circular-1.xsd"/>
<xsd:simpleType name="C1">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
<xsd:simpleType name="C2">
<xsd:restriction base="tns:A1"/>
</xsd:simpleType>
<xsd:include schemaLocation="circular-1.xsd"/>
<xsd:simpleType name="C1">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
<xsd:simpleType name="C2">
<xsd:restriction base="tns:A1"/>
</xsd:simpleType>
</xsd:schema>

View File

@@ -1,14 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:hr="http://mycompany.com/hr/schemas"
elementFormDefault="qualified"
targetNamespace="http://mycompany.com/hr/schemas">
<xs:complexType name="EmployeeType">
<xs:sequence>
<xs:element name="Number" type="xs:integer"/>
<xs:element name="FirstName" type="xs:string"/>
<xs:element name="LastName" type="xs:string"/>
</xs:sequence>
</xs:complexType>
elementFormDefault="qualified"
targetNamespace="http://mycompany.com/hr/schemas">
<xs:complexType name="EmployeeType">
<xs:sequence>
<xs:element name="Number" type="xs:integer"/>
<xs:element name="FirstName" type="xs:string"/>
<xs:element name="LastName" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

View File

@@ -1,14 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:hrh="http://mycompany.com/hr/schemas/holiday"
attributeFormDefault="unqualified"
elementFormDefault="qualified"
targetNamespace="http://mycompany.com/hr/schemas/holiday">
<xs:complexType name="HolidayType">
<xs:sequence>
<xs:element name="StartDate" type="xs:date"/>
<xs:element name="EndDate" type="xs:date"/>
</xs:sequence>
</xs:complexType>
attributeFormDefault="unqualified"
elementFormDefault="qualified"
targetNamespace="http://mycompany.com/hr/schemas/holiday">
<xs:complexType name="HolidayType">
<xs:sequence>
<xs:element name="StartDate" type="xs:date"/>
<xs:element name="EndDate" type="xs:date"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

View File

@@ -1,18 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:hr="http://mycompany.com/hr/schemas"
xmlns:hrh="http://mycompany.com/hr/schemas/holiday"
elementFormDefault="qualified"
targetNamespace="http://mycompany.com/hr/schemas">
xmlns:hr="http://mycompany.com/hr/schemas"
xmlns:hrh="http://mycompany.com/hr/schemas/holiday"
elementFormDefault="qualified"
targetNamespace="http://mycompany.com/hr/schemas">
<xs:import namespace="http://mycompany.com/hr/schemas/holiday" schemaLocation="holiday.xsd"/>
<xs:include schemaLocation="employee.xsd"/>
<xs:element name="HolidayRequest">
<xs:complexType>
<xs:all>
<xs:element name="Holiday" type="hrh:HolidayType"/>
<xs:element name="Employee" type="hr:EmployeeType"/>
</xs:all>
</xs:complexType>
</xs:element>
<xs:import namespace="http://mycompany.com/hr/schemas/holiday" schemaLocation="holiday.xsd"/>
<xs:include schemaLocation="employee.xsd"/>
<xs:element name="HolidayRequest">
<xs:complexType>
<xs:all>
<xs:element name="Holiday" type="hrh:HolidayType"/>
<xs:element name="Employee" type="hr:EmployeeType"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@@ -1,25 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:hr="http://mycompany.com/hr/schemas"
xmlns:hrh="http://mycompany.com/hr/schemas/holiday"
attributeFormDefault="unqualified"
elementFormDefault="qualified"
targetNamespace="http://mycompany.com/hr/schemas">
xmlns:hr="http://mycompany.com/hr/schemas"
xmlns:hrh="http://mycompany.com/hr/schemas/holiday"
attributeFormDefault="unqualified"
elementFormDefault="qualified"
targetNamespace="http://mycompany.com/hr/schemas">
<xs:import namespace="http://mycompany.com/hr/schemas/holiday"/>
<xs:element name="HolidayRequest">
<xs:complexType>
<xs:all>
<xs:element name="Holiday" type="hrh:HolidayType"/>
<xs:element name="Employee" type="hr:EmployeeType"/>
</xs:all>
</xs:complexType>
</xs:element>
<xs:complexType name="EmployeeType">
<xs:sequence>
<xs:element name="Number" type="xs:integer"/>
<xs:element name="FirstName" type="xs:string"/>
<xs:element name="LastName" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:import namespace="http://mycompany.com/hr/schemas/holiday"/>
<xs:element name="HolidayRequest">
<xs:complexType>
<xs:all>
<xs:element name="Holiday" type="hrh:HolidayType"/>
<xs:element name="Employee" type="hr:EmployeeType"/>
</xs:all>
</xs:complexType>
</xs:element>
<xs:complexType name="EmployeeType">
<xs:sequence>
<xs:element name="Number" type="xs:integer"/>
<xs:element name="FirstName" type="xs:string"/>
<xs:element name="LastName" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

View File

@@ -4,12 +4,12 @@
xmlns="http://www.springframework.org/spring-ws/imported/schema" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xsd:element name="GetOrderResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="child" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="GetOrderResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="child" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

View File

@@ -4,14 +4,14 @@
xmlns="http://www.springframework.org/spring-ws/importing/schema" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xsd:import namespace="http://www.springframework.org/spring-ws/imported/schema" schemaLocation="imported.xsd"/>
<xsd:import namespace="http://www.springframework.org/spring-ws/imported/schema" schemaLocation="imported.xsd"/>
<xsd:element name="GetOrderRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="child" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="GetOrderRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="child" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

View File

@@ -4,12 +4,12 @@
xmlns="http://www.springframework.org/spring-ws/include/schema" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xsd:element name="GetOrderResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="child" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="GetOrderResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="child" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

View File

@@ -4,15 +4,15 @@
xmlns="http://www.springframework.org/spring-ws/include/schema" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xsd:include schemaLocation="included.xsd"/>
<xsd:include schemaLocation="included.xsd"/>
<xsd:element name="GetOrderRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="child" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="GetOrderRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="child" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

View File

@@ -3,12 +3,12 @@
targetNamespace="urn:1"
xmlns="urn:1"
xmlns:imported="urn:2" elementFormDefault="qualified">
<xsd:include schemaLocation="X.xsd"/>
<!--<xsd:import schemaLocation="D.xsd" namespace="urn:2"/>-->
<xsd:complexType name="B">
<xsd:sequence>
<xsd:element type="C" name="c"/>
<xsd:element type="imported:D" name="d"/>
</xsd:sequence>
</xsd:complexType>
<xsd:include schemaLocation="X.xsd"/>
<!--<xsd:import schemaLocation="D.xsd" namespace="urn:2"/>-->
<xsd:complexType name="B">
<xsd:sequence>
<xsd:element type="C" name="c"/>
<xsd:element type="imported:D" name="d"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>

View File

@@ -4,32 +4,32 @@
xmlns="http://www.springframework.org/spring-ws/single/schema" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xsd:simpleType name="customType">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
<xsd:simpleType name="customType">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
<xsd:element name="GetOrderRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="child" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="GetOrderRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="child" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="GetOrderResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="child" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="GetOrderResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="child" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="GetOrderFault">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="child" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="GetOrderFault">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="child" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

View File

@@ -6,6 +6,6 @@
attributeFormDefault="unqualified"
xmlns:xmime="http://www.w3.org/2005/05/xmlmime">
<xs:element name="BinaryData" type="xs:base64Binary" xmime:expectedContentTypes="application/octet-stream"/>
<xs:element name="BinaryData" type="xs:base64Binary" xmime:expectedContentTypes="application/octet-stream"/>
</xs:schema>

View File

@@ -1,287 +1,321 @@
<?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: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>
<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>
<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="lang">
<xs:annotation>
<xs:documentation>
<div>
<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>
<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>
<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>
</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:annotation>
<xs:documentation>
<div>
<h3>Father (in any context at all)</h3>
<xs:attribute name="space">
<xs:annotation>
<xs:documentation>
<div>
<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>
<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>
<xs:annotation>
<xs:documentation>
<div xml:id="usage" id="usage">
<h2><a name="usage">About this schema document</a></h2>
</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>
<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>
&lt;schema . . .>
. . .
&lt;import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.w3.org/2001/xml.xsd"/>
</pre>
<p>
or
</p>
<pre>
&lt;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>
&lt;type . . .>
. . .
&lt;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:attribute name="base" type="xs:anyURI">
<xs:annotation>
<xs:documentation>
<div>
<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>
<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>
&lt;schema . . .>
. . .
&lt;import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.w3.org/2001/xml.xsd"/>
</pre>
<p>
or
</p>
<pre>
&lt;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>
&lt;type . . .>
. . .
&lt;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>

View File

@@ -4,15 +4,15 @@
xmlns="http://www.springframework.org/spring-ws/xmlNamespace" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/>
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/>
<xsd:element name="GetOrderRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="child" type="xsd:string"/>
</xsd:sequence>
<xsd:attribute ref="xml:lang" use="required"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="GetOrderRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="child" type="xsd:string"/>
</xsd:sequence>
<xsd:attribute ref="xml:lang" use="required"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>