public final class XSOMParser
extends java.lang.Object
| Constructor | Description |
|---|---|
XSOMParser() |
Deprecated.
Unsafe, use XSOMParser(factory) instead with
security features initialized by setting
XMLConstants.FEATURE_SECURE_PROCESSING feature.
|
XSOMParser(XMLParser parser) |
Creates a new XSOMParser that reads XML Schema from non-standard
inputs.
|
XSOMParser(javax.xml.parsers.SAXParserFactory factory) |
Creates a new XSOMParser that uses the given SAXParserFactory
for creating new SAX parsers.
|
| Modifier and Type | Method | Description |
|---|---|---|
AnnotationParserFactory |
getAnnotationParserFactory() |
|
java.util.Set<SchemaDocument> |
getDocuments() |
Gets the set of
SchemaDocument that represents
parsed documents so far. |
org.xml.sax.EntityResolver |
getEntityResolver() |
|
org.xml.sax.ErrorHandler |
getErrorHandler() |
|
org.xml.sax.ContentHandler |
getParserHandler() |
Gets the parser implemented as a ContentHandler.
|
XSSchemaSet |
getResult() |
Gets the parsed result.
|
void |
parse(java.io.File schema) |
Parses a new XML Schema document.
|
void |
parse(java.io.InputStream is) |
Parses a new XML Schema document.
|
void |
parse(java.io.Reader reader) |
Parses a new XML Schema document.
|
void |
parse(java.lang.String systemId) |
Parses a new XML Schema document.
|
void |
parse(java.net.URL url) |
Parses a new XML Schema document.
|
void |
parse(org.xml.sax.InputSource source) |
Parses a new XML Schema document.
|
void |
setAnnotationParser(AnnotationParserFactory factory) |
Sets the annotation parser factory.
|
void |
setAnnotationParser(java.lang.Class annParser) |
Sets the annotation parser.
|
void |
setEntityResolver(org.xml.sax.EntityResolver resolver) |
Set an entity resolver that is used to resolve things
like
<xsd:import> and <xsd:include>. |
void |
setErrorHandler(org.xml.sax.ErrorHandler errorHandler) |
Set an error handler that receives all the errors encountered
during the parsing.
|
public XSOMParser()
public XSOMParser(javax.xml.parsers.SAXParserFactory factory)
setNamespaceAware(true)
or you'll see some strange errors.public void parse(java.io.InputStream is)
throws org.xml.sax.SAXException
When using this method, XSOM does not know the system ID of
this document, therefore, when this stream contains relative
references to other schemas, XSOM will fail to resolve them.
To specify an system ID with a stream, use InputSource
org.xml.sax.SAXExceptionpublic void parse(java.io.Reader reader)
throws org.xml.sax.SAXException
When using this method, XSOM does not know the system ID of
this document, therefore, when this reader contains relative
references to other schemas, XSOM will fail to resolve them.
To specify an system ID with a reader, use InputSource
org.xml.sax.SAXExceptionpublic void parse(java.io.File schema)
throws org.xml.sax.SAXException,
java.io.IOException
org.xml.sax.SAXExceptionjava.io.IOExceptionpublic void parse(java.net.URL url)
throws org.xml.sax.SAXException
org.xml.sax.SAXExceptionpublic void parse(java.lang.String systemId)
throws org.xml.sax.SAXException
org.xml.sax.SAXExceptionpublic void parse(org.xml.sax.InputSource source)
throws org.xml.sax.SAXException
Note that if the InputSource does not have a system ID,
XSOM will fail to resolve them.
org.xml.sax.SAXExceptionpublic org.xml.sax.ContentHandler getParserHandler()
If you don't send a complete event sequence from a startDocument event to an endDocument event, the state of XSOMParser can become unstable. This sometimes happen when you encounter an error while generating SAX events. Don't call the getResult method in that case.
This way of reading XML Schema can be useful when XML Schema is not available as a stand-alone XML document. For example, one can feed XML Schema inside a WSDL document.
public XSSchemaSet getResult() throws org.xml.sax.SAXException
org.xml.sax.SAXException - This exception will never be thrown unless it is thrown
by an error handler.public java.util.Set<SchemaDocument> getDocuments()
SchemaDocument that represents
parsed documents so far.public org.xml.sax.EntityResolver getEntityResolver()
public void setEntityResolver(org.xml.sax.EntityResolver resolver)
<xsd:import> and <xsd:include>.public org.xml.sax.ErrorHandler getErrorHandler()
public void setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
public void setAnnotationParser(java.lang.Class annParser)
For each annotation, new instance of this class will be
created and used to parse <xs:annotation>.
public void setAnnotationParser(AnnotationParserFactory factory)
The specified factory will be used to create AnnotationParsers.
public AnnotationParserFactory getAnnotationParserFactory()
Copyright © 2017 Oracle Corporation. All rights reserved.