| java.lang.Object org.geotools.xml.Parser
Parser | public class Parser (Code) | | Main interface to the geotools xml parser.
Schema Resolution
See
org.geotools.xml.Configuration javadocs for instructions on how
to customize schema resolution. This is often desirable in the case that
the instance document being parsed contains invalid uri's in schema imports
and includes.
author: Justin Deoliveira, The Open Planning Project |
Inner Class :public static interface Properties | |
Method Summary | |
public NamespaceSupport | getNamespaces() Returns the namespace mappings maintained by the parser.
Clients may register additional namespace mappings. | public XSDSchema[] | getSchemas() Returns the schema objects referenced by the instance document being
parsed. | public List | getValidationErrors() Returns a list of any validation errors that occured while parsing. | public Object | parse() Signals the parser to parse the entire instance document. | public Object | parse(InputStream input) Parses an instance documented defined by an input stream.
The object returned from the parse is the object which has been bound to the root
element of the document. | public Object | parse(Reader reader) Parses an instance documented defined by a reader.
The object returned from the parse is the object which has been bound to the root
element of the document. | public Object | parse(InputSource source) Parses an instance documented defined by a sax input source.
The object returned from the parse is the object which has been bound to the root
element of the document. | protected SAXParser | parser() | public void | setStrict(boolean strict) Sets the strict parsing flag. | public void | setValidating(boolean validating) Sets the flag controlling wether the parser should validate or not. |
Parser | public Parser(Configuration configuration)(Code) | | Creats a new instance of the parser.
Parameters: configuration - The parser configuration, bindings and context, must never be null . |
getNamespaces | public NamespaceSupport getNamespaces()(Code) | | Returns the namespace mappings maintained by the parser.
Clients may register additional namespace mappings. This is useful when
an application whishes to provide some "default" namespace mappings.
Clients should register namespace mappings in the current "context", ie
do not call
NamespaceSupport.pushContext . Example:
Parser parser = new Parser( ... );
parser.getNamespaces().declarePrefix( "foo", "http://www.foo.com" );
...
The namespace support containing prefix to uri mappings. since: 2.4 |
getSchemas | public XSDSchema[] getSchemas()(Code) | | Returns the schema objects referenced by the instance document being
parsed. This method can only be called after a successful parse has
begun.
The schema objects used to parse the document, or null if parsinghas not commenced. |
getValidationErrors | public List getValidationErrors()(Code) | | Returns a list of any validation errors that occured while parsing.
A list of errors, or an empty list if none. |
setStrict | public void setStrict(boolean strict)(Code) | | Sets the strict parsing flag.
When set to true , this will cause the parser to operate in
a strict mode, which means that xml being parsed must be exactly correct
with respect to the schema it references.
Some examples of cases in which the parser will throw an exception while
operating in strict mode:
- no 'schemaLocation' specified, or specified incorrectly
- element found which is not declared in the schema
Parameters: strict - The strict flag. |
setValidating | public void setValidating(boolean validating)(Code) | | Sets the flag controlling wether the parser should validate or not.
Parameters: validating - Validation flag, true to validate, otherwise false |
|
|