public abstract class ComponentReader extends Object
Modifier | Constructor and Description |
---|---|
protected |
ComponentReader(SchemaContext schemaContext)
To hand down a couple of configuration items to all Unmarshaller classes.
|
Modifier and Type | Method and Description |
---|---|
void |
characters(char[] chars,
int start,
int length)
Signals to recieve charactes
|
abstract String |
elementName()
Returns the name of the element that this ComponentReader
handles
|
void |
endElement(String name,
String namespace)
Signals to end of the element with the given name.
|
void |
error(Exception ex)
This method is called for a general error.
|
void |
error(String err)
This method is called for a general error.
|
void |
finish()
Called to signal an end of unmarshalling.
|
Locator |
getDocumentLocator() |
abstract Object |
getObject()
Returns the Object created by this Unmarshaller
|
Resolver |
getResolver()
Returns the resolver used for resolving id references.
|
SchemaContext |
getSchemaContext()
To get the Castor XML schema context used.
|
URIResolver |
getURIResolver()
Returns the URIresolver used for resolving hrefs.
|
void |
illegalAttribute(String attName)
This method is called when an illegal Attribute is encountered.
|
void |
illegalElement(String name)
This method is called when an illegal Element is encountered.
|
static boolean |
isWhiteSpace(char[] chars,
int start,
int length)
Determines if the given sequence of characters consists
of whitespace characters
|
void |
outOfOrder(String name)
This method is called when an out of order element is encountered
|
void |
redefinedElement(String name)
This method is called when an element which may only
be defined once, is redefined.
|
void |
redefinedElement(String name,
String xtraInfo)
This method is called when an element which may only
be defined once, is redefined.
|
void |
setDocumentLocator(Locator documentLocator) |
void |
setResolver(Resolver resolver)
Sets the Resolver to be used for resolving id references
|
void |
setSchemaContext(SchemaContext schemaContext)
To set the Castor XML schema context to be used.
|
void |
setURIResolver(URIResolver uriResolver)
Sets the URIResolver to be used for resolving hrefs.
|
void |
startElement(String name,
String namespace,
AttributeSet atts,
Namespaces nsDecls)
Signals the start of an element with the given name.
|
static int |
toInt(String str)
Converts the given String to an int
|
protected ComponentReader(SchemaContext schemaContext)
schemaContext
- the SchemaContext
to usepublic abstract String elementName()
public abstract Object getObject()
public void finish() throws XMLException
XMLException
public Resolver getResolver()
public URIResolver getURIResolver()
public void setResolver(Resolver resolver)
resolver
- the Resolver to be used for resolving
id referencespublic void setURIResolver(URIResolver uriResolver)
uriResolver
- the URIResolver to be used for resolving hrefs.public static boolean isWhiteSpace(char[] chars, int start, int length)
chars
- an array of characters to check for whitespacestart
- the start index into the character arraylength
- the number of characters to checkpublic void error(String err) throws XMLException
err
- the error message to reportXMLException
public void error(Exception ex) throws XMLException
ex
- the Exception that caused the error.XMLException
public void illegalAttribute(String attName) throws XMLException
attName
- the name of the illegal attribute.XMLException
public void illegalElement(String name) throws XMLException
name
- the name of the illegal elementXMLException
public void redefinedElement(String name) throws XMLException
name
- the name of the elementXMLException
public void redefinedElement(String name, String xtraInfo) throws XMLException
name
- the name of the elementXMLException
public void outOfOrder(String name) throws XMLException
XMLException
public static int toInt(String str) throws IllegalArgumentException
str
- the String to convert to an intIllegalArgumentException
- when the given
String does not represent a valid intpublic Locator getDocumentLocator()
public void setDocumentLocator(Locator documentLocator)
public void characters(char[] chars, int start, int length) throws XMLException
chars
- the character array containing the charactersstart
- the starting index into the character arraylength
- the number of characters to recieveXMLException
public void endElement(String name, String namespace) throws XMLException
name
- the NCName of the element. It is an error
if the name is a QName (ie. contains a prefix).namespace
- the namespace of the element.XMLException
public void startElement(String name, String namespace, AttributeSet atts, Namespaces nsDecls) throws XMLException
name
- the NCName of the element. It is an error
if the name is a QName (ie. contains a prefix).namespace
- the namespace of the element. This may be null.
Note: A null namespace is not the same as the default namespace unless
the default namespace is also null.atts
- the AttributeSet containing the attributes associated
with the element.nsDecls
- the namespace declarations being declared for this
element. This may be null.XMLException
public void setSchemaContext(SchemaContext schemaContext)
schemaContext
- the Castor XML schema context to be usedpublic SchemaContext getSchemaContext()
Copyright © 2014. All rights reserved.