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
|
protected Parser |
createParser(String reason) |
protected URILocation |
derive(Locator locator,
String schemaLocation) |
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
|
protected void |
parseSchema(Parser parser,
SchemaUnmarshaller schemaUnmarshaller,
URILocation uri,
String schemaLocation,
String reason) |
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)
Unmarshaller classes.schemaContext - the SchemaContext to usepublic abstract String elementName()
public abstract Object getObject()
UnmarshallerUnmarshallerpublic void finish()
throws XMLException
UnmarshallerXMLExceptionpublic 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 reportXMLExceptionpublic void error(Exception ex) throws XMLException
ex - the Exception that caused the error.XMLExceptionpublic void illegalAttribute(String attName) throws XMLException
attName - the name of the illegal attribute.XMLExceptionpublic void illegalElement(String name) throws XMLException
name - the name of the illegal elementXMLExceptionpublic void redefinedElement(String name) throws XMLException
name - the name of the elementXMLExceptionpublic void redefinedElement(String name, String xtraInfo) throws XMLException
name - the name of the elementXMLExceptionpublic void outOfOrder(String name) throws XMLException
XMLExceptionpublic 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 recieveXMLExceptionpublic 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.XMLExceptionpublic 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.XMLExceptionpublic void setSchemaContext(SchemaContext schemaContext)
schemaContext - the Castor XML schema context to be usedpublic SchemaContext getSchemaContext()
protected void parseSchema(Parser parser, SchemaUnmarshaller schemaUnmarshaller, URILocation uri, String schemaLocation, String reason) throws SchemaException
SchemaExceptionprotected Parser createParser(String reason) throws SchemaException
SchemaExceptionprotected URILocation derive(Locator locator, String schemaLocation) throws XMLException
XMLExceptionCopyright © 2016. All rights reserved.