public final class XSOMParser extends Object
Constructor and Description |
---|
XSOMParser()
Deprecated.
Unsafe, use XSOMParser(factory) instead with
security features initialized by setting
XMLConstants.FEATURE_SECURE_PROCESSING feature.
|
XSOMParser(SAXParserFactory factory)
Creates a new XSOMParser that uses the given SAXParserFactory
for creating new SAX parsers.
|
XSOMParser(XMLParser parser)
Creates a new XSOMParser that reads XML Schema from non-standard
inputs.
|
Modifier and Type | Method and Description |
---|---|
AnnotationParserFactory |
getAnnotationParserFactory() |
Set<SchemaDocument> |
getDocuments()
Gets the set of
SchemaDocument that represents
parsed documents so far. |
EntityResolver |
getEntityResolver() |
ErrorHandler |
getErrorHandler() |
ContentHandler |
getParserHandler()
Gets the parser implemented as a ContentHandler.
|
XSSchemaSet |
getResult()
Gets the parsed result.
|
void |
parse(File schema)
Parses a new XML Schema document.
|
void |
parse(InputSource source)
Parses a new XML Schema document.
|
void |
parse(InputStream is)
Parses a new XML Schema document.
|
void |
parse(Reader reader)
Parses a new XML Schema document.
|
void |
parse(String systemId)
Parses a new XML Schema document.
|
void |
parse(URL url)
Parses a new XML Schema document.
|
void |
setAnnotationParser(AnnotationParserFactory factory)
Sets the annotation parser factory.
|
void |
setAnnotationParser(Class annParser)
Sets the annotation parser.
|
void |
setEntityResolver(EntityResolver resolver)
Set an entity resolver that is used to resolve things
like
<xsd:import> and <xsd:include> . |
void |
setErrorHandler(ErrorHandler errorHandler)
Set an error handler that receives all the errors encountered
during the parsing.
|
public XSOMParser()
public XSOMParser(SAXParserFactory factory)
setNamespaceAware(true)
or you'll see some strange errors.public void parse(InputStream is) throws 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
SAXException
public void parse(Reader reader) throws 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
SAXException
public void parse(File schema) throws SAXException, IOException
SAXException
IOException
public void parse(URL url) throws SAXException
SAXException
public void parse(String systemId) throws SAXException
SAXException
public void parse(InputSource source) throws SAXException
Note that if the InputSource
does not have a system ID,
XSOM will fail to resolve them.
SAXException
public 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 SAXException
SAXException
- This exception will never be thrown unless it is thrown
by an error handler.public Set<SchemaDocument> getDocuments()
SchemaDocument
that represents
parsed documents so far.public EntityResolver getEntityResolver()
public void setEntityResolver(EntityResolver resolver)
<xsd:import>
and <xsd:include>
.public ErrorHandler getErrorHandler()
public void setErrorHandler(ErrorHandler errorHandler)
public void setAnnotationParser(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 © 2021 JBoss by Red Hat. All rights reserved.