Top Description Inners Fields Constructors Methods
com.sun.msv.writer

public Class ContentHandlerAdaptor

extends Object
implements DocumentHandler
Class Inheritance
All Implemented Interfaces
org.xml.sax.DocumentHandler
Annotations
@SuppressWarnings:deprecation
Imports
java.util.Enumeration, org.xml.sax.AttributeList, .Attributes, .ContentHandler, .DocumentHandler, .Locator, .SAXException, .SAXParseException, org.xml.sax.helpers.AttributesImpl, .NamespaceSupport

Deprecated

as a consequence of DocumentHandler being deprecated. See corresponding docs for further information.

Adapt SAX2 ContentHandler as a SAX1 DocumentHandler. This class wraps a ContentHandler and makes it act as a DocumentHandler.
Author
David Megginson, [email protected]

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class
ContentHandlerAdaptor.AttributeListAdapter

Adapt a SAX1 AttributeList as a SAX2 Attributes object.

Field Summary

Modifier and TypeField and Description
private final ContentHandlerAdaptor.AttributeListAdapter
private final AttributesImpl
private final ContentHandler
private final String[]
private final boolean
private final NamespaceSupport
private final boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
characters(char[]
An array of characters.
ch
,
int
The starting position in the array.
start
,
int
The number of characters to use.
length
)

Implements org.xml.sax.DocumentHandler.characters.

Adapt a SAX1 characters event.
public void
endDocument()

Implements org.xml.sax.DocumentHandler.endDocument.

Adapt a SAX1 end document event.
public void
endElement(String
The qualified (prefixed) name.
qName
)

Implements org.xml.sax.DocumentHandler.endElement.

Adapt a SAX1 end element event.
public void
ignorableWhitespace(char[]
An array of characters.
ch
,
int
The starting position in the array.
start
,
int
The number of characters to use.
length
)

Implements org.xml.sax.DocumentHandler.ignorableWhitespace.

Adapt a SAX1 ignorable whitespace event.
public void
processingInstruction(String
The processing instruction target.
target
,
String
The remainder of the processing instruction
data
)

Implements org.xml.sax.DocumentHandler.processingInstruction.

Adapt a SAX1 processing instruction event.
private String[]
processName(String qName, boolean isAttribute)

pack-priv void
reportError(String
The error message.
message
)

Report a non-fatal error.

public void
setDocumentLocator(Locator
A document locator.
locator
)

Implements org.xml.sax.DocumentHandler.setDocumentLocator.

Adapt a SAX1 document locator event.
public void
startDocument()

Implements org.xml.sax.DocumentHandler.startDocument.

Adapt a SAX1 start document event.
public void
startElement(String
The qualified (prefixed) name.
qName
,
AttributeList
The XML 1.0 attribute list (with qnames).
qAtts
)

Implements org.xml.sax.DocumentHandler.startElement.

Deprecated as a consequence of AttributeList being deprecated.
Adapt a SAX1 startElement event.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attAdapterback to summary
private final ContentHandlerAdaptor.AttributeListAdapter attAdapter
attsback to summary
private final AttributesImpl atts
contentHandlerback to summary
private final ContentHandler contentHandler
namePartsback to summary
private final String[] nameParts
namespacesback to summary
private final boolean namespaces
nsSupportback to summary
private final NamespaceSupport nsSupport
prefixesback to summary
private final boolean prefixes

Constructor Detail

ContentHandlerAdaptorback to summary
public ContentHandlerAdaptor(ContentHandler handler)

Method Detail

charactersback to summary
public void characters(char[] ch, int start, int length) throws SAXException

Implements org.xml.sax.DocumentHandler.characters.

Adapt a SAX1 characters event.

Parameters
ch:char[]

An array of characters.

start:int

The starting position in the array.

length:int

The number of characters to use.

Exceptions
SAXException:
The client may raise a processing exception.
See Also
org.xml.sax.DocumentHandler#characters
endDocumentback to summary
public void endDocument() throws SAXException

Implements org.xml.sax.DocumentHandler.endDocument.

Adapt a SAX1 end document event.

Exceptions
SAXException:
The client may raise a processing exception.
See Also
org.xml.sax.DocumentHandler#endDocument
endElementback to summary
public void endElement(String qName) throws SAXException

Implements org.xml.sax.DocumentHandler.endElement.

Adapt a SAX1 end element event.

Parameters
qName:String

The qualified (prefixed) name.

Exceptions
SAXException:
The client may raise a processing exception.
See Also
org.xml.sax.DocumentHandler#endElement
ignorableWhitespaceback to summary
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException

Implements org.xml.sax.DocumentHandler.ignorableWhitespace.

Adapt a SAX1 ignorable whitespace event.

Parameters
ch:char[]

An array of characters.

start:int

The starting position in the array.

length:int

The number of characters to use.

Exceptions
SAXException:
The client may raise a processing exception.
See Also
org.xml.sax.DocumentHandler#ignorableWhitespace
processingInstructionback to summary
public void processingInstruction(String target, String data) throws SAXException

Implements org.xml.sax.DocumentHandler.processingInstruction.

Adapt a SAX1 processing instruction event.

Parameters
target:String

The processing instruction target.

data:String

The remainder of the processing instruction

Exceptions
SAXException:
The client may raise a processing exception.
See Also
org.xml.sax.DocumentHandler#processingInstruction
processNameback to summary
private String[] processName(String qName, boolean isAttribute) throws SAXException
reportErrorback to summary
pack-priv void reportError(String message) throws SAXException

Report a non-fatal error.

Parameters
message:String

The error message.

Exceptions
SAXException:
The client may throw an exception.
setDocumentLocatorback to summary
public void setDocumentLocator(Locator locator)

Implements org.xml.sax.DocumentHandler.setDocumentLocator.

Adapt a SAX1 document locator event.

Parameters
locator:Locator

A document locator.

See Also
org.xml.sax.ContentHandler#setDocumentLocator
startDocumentback to summary
public void startDocument() throws SAXException

Implements org.xml.sax.DocumentHandler.startDocument.

Adapt a SAX1 start document event.

Exceptions
SAXException:
The client may raise a processing exception.
See Also
org.xml.sax.DocumentHandler#startDocument
startElementback to summary
public void startElement(String qName, AttributeList qAtts) throws SAXException

Implements org.xml.sax.DocumentHandler.startElement.

Deprecated

as a consequence of AttributeList being deprecated. See corresponding docs for further information.

Adapt a SAX1 startElement event.

If necessary, perform Namespace processing.

Parameters
qName:String

The qualified (prefixed) name.

qAtts:AttributeList

The XML 1.0 attribute list (with qnames).

Exceptions
SAXException:

Doc from org.xml.sax.DocumentHandler.startElement.

Any SAX exception, possibly wrapping another exception.

com.sun.msv.writer back to summary

pack-priv final Class ContentHandlerAdaptor.AttributeListAdapter

extends Object
implements Attributes
Class Inheritance
  • java.lang.Object
  • com.sun.msv.writer.ContentHandlerAdaptor.AttributeListAdapter
All Implemented Interfaces
org.xml.sax.Attributes

Adapt a SAX1 AttributeList as a SAX2 Attributes object.

This class is in the Public Domain, and comes with NO WARRANTY of any kind.

This wrapper class is used only when Namespace support is disabled -- it provides pretty much a direct mapping from SAX1 to SAX2, except that names and types are interned whenever requested.

Field Summary

Modifier and TypeField and Description
private AttributeList
qAtts

Deprecated as a consequence of AttributeList being deprecated.

Constructor Summary

AccessConstructor and Description
pack-priv
AttributeListAdapter()

Construct a new adapter.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

The attributes index, or -1 if none was found.
getIndex
(String
The Namespace URI or the empty string.
uri
,
String
The local name.
localName
)

Implements org.xml.sax.Attributes.getIndex.

Look up an attribute index by Namespace name.
public int

Returns:

The attributes index, or -1 if none was found.
getIndex
(String
The qualified name.
qName
)

Implements org.xml.sax.Attributes.getIndex.

Look up an attribute index by qualified (prefixed) name.
public int

Returns:

The number of attributes in the list.
getLength
()

Implements org.xml.sax.Attributes.getLength.

Return the length of the attribute list.
public String

Returns:

Always the empty string.
getLocalName
(int
attribute's index.
i
)

Implements org.xml.sax.Attributes.getLocalName.

Return the local name of the specified attribute.
public String

Returns:

The attribute's qualified name, internalized.
getQName
(int
attribute's index.
i
)

Implements org.xml.sax.Attributes.getQName.

Return the qualified (prefixed) name of the specified attribute.
public String

Returns:

The attribute's type as an internalized string.
getType
(int
attribute's index.
i
)

Implements org.xml.sax.Attributes.getType.

Return the type of the specified attribute.
public String

Returns:

The attribute's type as an internalized string.
getType
(String
The Namespace URI
uri
,
String
The local name.
localName
)

Implements org.xml.sax.Attributes.getType.

Look up the type of an attribute by Namespace name.
public String

Returns:

The attribute's type as an internalized string.
getType
(String
The qualified name.
qName
)

Implements org.xml.sax.Attributes.getType.

Look up the type of an attribute by qualified (prefixed) name.
public String

Returns:

Always the empty string.
getURI
(int
attribute's index.
i
)

Implements org.xml.sax.Attributes.getURI.

Return the Namespace URI of the specified attribute.
public String

Returns:

The attribute's value.
getValue
(int
attribute's index.
i
)

Implements org.xml.sax.Attributes.getValue.

Return the value of the specified attribute.
public String

Returns:

The attribute's value.
getValue
(String
The Namespace URI
uri
,
String
The local name.
localName
)

Implements org.xml.sax.Attributes.getValue.

Look up the value of an attribute by Namespace name.
public String

Returns:

The attribute's value.
getValue
(String
The qualified name.
qName
)

Implements org.xml.sax.Attributes.getValue.

Look up the value of an attribute by qualified (prefixed) name.
pack-priv void
setAttributeList(AttributeList
SAX1 attribute list (with qnames).
qAtts
)

Deprecated as a consequence of AttributeList being deprecated.
Set the embedded AttributeList.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

qAttsback to summary
private AttributeList qAtts

Deprecated

as a consequence of AttributeList being deprecated. See corresponding docs for further information.

Constructor Detail

AttributeListAdapterback to summary
pack-priv AttributeListAdapter()

Construct a new adapter.

Method Detail

getIndexback to summary
public int getIndex(String uri, String localName)

Implements org.xml.sax.Attributes.getIndex.

Look up an attribute index by Namespace name.

Parameters
uri:String

The Namespace URI or the empty string.

localName:String

The local name.

Returns:int

The attributes index, or -1 if none was found.

See Also
org.xml.sax.Attributes#getIndex(java.lang.String, java.lang.String)
getIndexback to summary
public int getIndex(String qName)

Implements org.xml.sax.Attributes.getIndex.

Look up an attribute index by qualified (prefixed) name.

Parameters
qName:String

The qualified name.

Returns:int

The attributes index, or -1 if none was found.

See Also
org.xml.sax.Attributes#getIndex(java.lang.String)
getLengthback to summary
public int getLength()

Implements org.xml.sax.Attributes.getLength.

Return the length of the attribute list.

Returns:int

The number of attributes in the list.

See Also
org.xml.sax.Attributes#getLength
getLocalNameback to summary
public String getLocalName(int i)

Implements org.xml.sax.Attributes.getLocalName.

Return the local name of the specified attribute.

Parameters
i:int

attribute's index.

Returns:String

Always the empty string.

See Also
org.xml.sax.Attributes#getLocalName
getQNameback to summary
public String getQName(int i)

Implements org.xml.sax.Attributes.getQName.

Return the qualified (prefixed) name of the specified attribute.

Parameters
i:int

attribute's index.

Returns:String

The attribute's qualified name, internalized.

getTypeback to summary
public String getType(int i)

Implements org.xml.sax.Attributes.getType.

Return the type of the specified attribute.

Parameters
i:int

attribute's index.

Returns:String

The attribute's type as an internalized string.

getTypeback to summary
public String getType(String uri, String localName)

Implements org.xml.sax.Attributes.getType.

Look up the type of an attribute by Namespace name.

Parameters
uri:String

The Namespace URI

localName:String

The local name.

Returns:String

The attribute's type as an internalized string.

getTypeback to summary
public String getType(String qName)

Implements org.xml.sax.Attributes.getType.

Look up the type of an attribute by qualified (prefixed) name.

Parameters
qName:String

The qualified name.

Returns:String

The attribute's type as an internalized string.

getURIback to summary
public String getURI(int i)

Implements org.xml.sax.Attributes.getURI.

Return the Namespace URI of the specified attribute.

Parameters
i:int

attribute's index.

Returns:String

Always the empty string.

See Also
org.xml.sax.Attributes#getURI
getValueback to summary
public String getValue(int i)

Implements org.xml.sax.Attributes.getValue.

Return the value of the specified attribute.

Parameters
i:int

attribute's index.

Returns:String

The attribute's value.

getValueback to summary
public String getValue(String uri, String localName)

Implements org.xml.sax.Attributes.getValue.

Look up the value of an attribute by Namespace name.

Parameters
uri:String

The Namespace URI

localName:String

The local name.

Returns:String

The attribute's value.

getValueback to summary
public String getValue(String qName)

Implements org.xml.sax.Attributes.getValue.

Look up the value of an attribute by qualified (prefixed) name.

Parameters
qName:String

The qualified name.

Returns:String

The attribute's value.

setAttributeListback to summary
pack-priv void setAttributeList(AttributeList qAtts)

Deprecated

as a consequence of AttributeList being deprecated. See corresponding docs for further information.

Set the embedded AttributeList.

This method must be invoked before any of the others can be used.

Parameters
qAtts:AttributeList

SAX1 attribute list (with qnames).