|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.xml.xsom.parser.XSOMParser
public final class XSOMParser
Parses possibly multiple W3C XML Schema files and compose them into one grammar.
Constructor Summary | |
---|---|
XSOMParser()
Creates a new XSOMParser by using a SAX parser from JAXP. |
|
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. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XSOMParser()
public XSOMParser(SAXParserFactory factory)
setNamespaceAware(true)
or you'll see some strange errors.
public XSOMParser(XMLParser parser)
XMLParser
interface, XML Schema
can be read from something other than XML.
parser
- This parser will be called to parse XML Schema documents.Method Detail |
---|
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)
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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |