org.milyn.xml
Class XsdDOMValidator

java.lang.Object
  extended by org.milyn.xml.XsdValidator
      extended by org.milyn.xml.XsdDOMValidator

public class XsdDOMValidator
extends XsdValidator

XSD DOM Validator.

Iterates through the document (DOM) gathering the namespaces. It validates based on the convention that the gathered namespace XSDs are provided on the classpath. It uses the namespace path (URI.getPath()), prepending it with "/META-INF" to perform a classpath resource lookup for the XSD i.e. the XSDs must be provided on the classpath below the "META-INF" package.

Author:
tom.fennelly@gmail.com

Field Summary
 
Fields inherited from class org.milyn.xml.XsdValidator
SCHEMA_FACTORY
 
Constructor Summary
XsdDOMValidator(Document document)
           
 
Method Summary
 URI getDefaultNamespace()
           
static String getDefaultNamespace(Element element)
          Get the default namespace associated with the supplied element.
 List<URI> getNamespaces()
           
 void validate()
          Validate the document against the namespaces referenced in it.
 
Methods inherited from class org.milyn.xml.XsdValidator
setErrorHandler, setSchemaFactory, setSchemaSourceResolver, setXSDSources, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XsdDOMValidator

public XsdDOMValidator(Document document)
                throws SAXException
Throws:
SAXException
Method Detail

getDefaultNamespace

public URI getDefaultNamespace()

getNamespaces

public List<URI> getNamespaces()

validate

public void validate()
              throws SAXException,
                     IOException
Validate the document against the namespaces referenced in it.

Throws:
SAXException - Validation error.
IOException - Error reading the XSD Sources.

getDefaultNamespace

public static String getDefaultNamespace(Element element)
Get the default namespace associated with the supplied element.

Parameters:
element - The element to be checked.
Returns:
The default namespace, or null if none was found.


Copyright © 2018. All rights reserved.