Class ComponentReader
java.lang.Object
org.exolab.castor.xml.schema.reader.ComponentReader
- Direct Known Subclasses:
AnnotationUnmarshaller
,AppInfoUnmarshaller
,AttributeGroupUnmarshaller
,AttributeUnmarshaller
,CharacterUnmarshaller
,ComplexContentRestrictionUnmarshaller
,ComplexContentUnmarshaller
,ComplexTypeUnmarshaller
,DocumentationUnmarshaller
,ElementUnmarshaller
,ExtensionUnmarshaller
,FacetUnmarshaller
,FieldOrSelectorUnmarshaller
,GroupUnmarshaller
,IdentityConstraintUnmarshaller
,ImportUnmarshaller
,IncludeUnmarshaller
,ModelGroupUnmarshaller
,RedefineUnmarshaller
,SchemaUnmarshaller
,SimpleContentRestrictionUnmarshaller
,SimpleContentUnmarshaller
,SimpleTypeListUnmarshaller
,SimpleTypeRestrictionUnmarshaller
,SimpleTypeUnmarshaller
,UnionUnmarshaller
,UnknownUnmarshaller
,WildcardUnmarshaller
The base class for separate component unmarshallers for reading an XML Schema component.
- Version:
- $Revision$ $Date: 2006-04-14 04:14:43 -0600 (Fri, 14 Apr 2006) $
- Author:
- Keith Visco
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ComponentReader
(SchemaContext schemaContext) To hand down a couple of configuration items to allUnmarshaller
classes. -
Method Summary
Modifier and TypeMethodDescriptionvoid
characters
(char[] chars, int start, int length) Signals to recieve charactesprotected Parser
createParser
(String reason) protected URILocation
abstract String
Returns the name of the element that this ComponentReader handlesvoid
endElement
(String name, String namespace) Signals to end of the element with the given name.void
This method is called for a general error.void
This method is called for a general error.void
finish()
Called to signal an end of unmarshalling.abstract Object
Returns the Object created by thisUnmarshaller
Returns the resolver used for resolving id references.To get the Castor XML schema context used.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 charactersvoid
outOfOrder
(String name) This method is called when an out of order element is encounteredprotected 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 referencesvoid
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
Converts the given String to an int
-
Constructor Details
-
ComponentReader
To hand down a couple of configuration items to allUnmarshaller
classes.- Parameters:
schemaContext
- theSchemaContext
to use
-
-
Method Details
-
elementName
Returns the name of the element that this ComponentReader handles- Returns:
- the name of the element that this ComponentReader handles
-
getObject
Returns the Object created by thisUnmarshaller
- Returns:
- the Object created by this
Unmarshaller
-
finish
Called to signal an end of unmarshalling. This method should be overridden to perform any necessary clean up by anUnmarshaller
- Throws:
XMLException
-
getResolver
Returns the resolver used for resolving id references.- Returns:
- the resolver used for resolving id references.
-
getURIResolver
Returns the URIresolver used for resolving hrefs.- Returns:
- the URIresolver used for resolving hrefs.
-
setResolver
Sets the Resolver to be used for resolving id references- Parameters:
resolver
- the Resolver to be used for resolving id references
-
setURIResolver
Sets the URIResolver to be used for resolving hrefs.- Parameters:
uriResolver
- the URIResolver to be used for resolving hrefs.
-
isWhiteSpace
public static boolean isWhiteSpace(char[] chars, int start, int length) Determines if the given sequence of characters consists of whitespace characters- Parameters:
chars
- an array of characters to check for whitespacestart
- the start index into the character arraylength
- the number of characters to check- Returns:
- true if the characters specficied consist only of whitespace characters
-
error
This method is called for a general error.- Parameters:
err
- the error message to report- Throws:
XMLException
-
error
This method is called for a general error.- Parameters:
ex
- the Exception that caused the error.- Throws:
XMLException
-
illegalAttribute
This method is called when an illegal Attribute is encountered.- Parameters:
attName
- the name of the illegal attribute.- Throws:
XMLException
-
illegalElement
This method is called when an illegal Element is encountered.- Parameters:
name
- the name of the illegal element- Throws:
XMLException
-
redefinedElement
This method is called when an element which may only be defined once, is redefined.- Parameters:
name
- the name of the element- Throws:
XMLException
-
redefinedElement
This method is called when an element which may only be defined once, is redefined.- Parameters:
name
- the name of the element- Throws:
XMLException
-
outOfOrder
This method is called when an out of order element is encountered- Throws:
XMLException
-
toInt
Converts the given String to an int- Parameters:
str
- the String to convert to an int- Returns:
- the int derived from the given String
- Throws:
IllegalArgumentException
- when the given String does not represent a valid int
-
getDocumentLocator
-
setDocumentLocator
-
characters
Signals to recieve charactes- Parameters:
chars
- the character array containing the charactersstart
- the starting index into the character arraylength
- the number of characters to recieve- Throws:
XMLException
-
endElement
Signals to end of the element with the given name.- Parameters:
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.- Throws:
XMLException
-
startElement
public void startElement(String name, String namespace, AttributeSet atts, Namespaces nsDecls) throws XMLException Signals the start of an element with the given name.- Parameters:
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.- Throws:
XMLException
-
setSchemaContext
To set the Castor XML schema context to be used.- Parameters:
schemaContext
- the Castor XML schema context to be used
-
getSchemaContext
To get the Castor XML schema context used.- Returns:
- the Castor XML schema context used
-
parseSchema
protected void parseSchema(Parser parser, SchemaUnmarshaller schemaUnmarshaller, URILocation uri, String schemaLocation, String reason) throws SchemaException - Throws:
SchemaException
-
createParser
- Throws:
SchemaException
-
derive
- Throws:
XMLException
-