|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.icl.saxon.aelfred.XmlParser
Parse XML documents and return parse events through call-backs.
Use the SAXDriver
class as your entry point, as the
internal parser interfaces are subject to change.
SAXDriver
Nested Class Summary | |
(package private) static class |
XmlParser.EncodingException
|
Field Summary | |
static int |
ATTRIBUTE_CDATA
Constant: the attribute value is a string value. |
static int |
ATTRIBUTE_DEFAULT_FIXED
Constant: the attribute was declared #FIXED. |
static int |
ATTRIBUTE_DEFAULT_IMPLIED
Constant: the attribute was declared #IMPLIED. |
static int |
ATTRIBUTE_DEFAULT_REQUIRED
Constant: the attribute was declared #REQUIRED. |
static int |
ATTRIBUTE_DEFAULT_SPECIFIED
Constant: the attribute has a literal default value specified. |
static int |
ATTRIBUTE_DEFAULT_UNDECLARED
Constant: the attribute is not declared. |
static int |
ATTRIBUTE_ENTITIES
Constant: the attribute value is a list of entity names. |
static int |
ATTRIBUTE_ENTITY
Constant: the attribute value is the name of an entity. |
static int |
ATTRIBUTE_ENUMERATED
Constant: the attribute value is a token from an enumeration. |
static int |
ATTRIBUTE_ID
Constant: the attribute value is a unique identifier. |
static int |
ATTRIBUTE_IDREF
Constant: the attribute value is a reference to a unique identifier. |
static int |
ATTRIBUTE_IDREFS
Constant: the attribute value is a list of ID references. |
static int |
ATTRIBUTE_NMTOKEN
Constant: the attribute value is a name token. |
static int |
ATTRIBUTE_NMTOKENS
Constant: the attribute value is a list of name tokens. |
static int |
ATTRIBUTE_NOTATION
Constant: the attribute is the name of a notation. |
static int |
ATTRIBUTE_UNDECLARED
Constant: the attribute has not been declared for this element type. |
static int |
CONTENT_ANY
Constant: the element has a content model of ANY. |
static int |
CONTENT_ELEMENTS
Constant: the element has element content. |
static int |
CONTENT_EMPTY
Constant: the element has declared content of EMPTY. |
static int |
CONTENT_MIXED
Constant: the element has mixed content. |
static int |
CONTENT_UNDECLARED
Constant: an element has not been declared. |
static int |
ENTITY_INTERNAL
Constant: the entity is internal. |
static int |
ENTITY_NDATA
Constant: the entity is external, non-parseable data. |
static int |
ENTITY_TEXT
Constant: the entity is external XML data. |
static int |
ENTITY_UNDECLARED
Constant: the entity has not been declared. |
Constructor Summary | |
(package private) |
XmlParser()
Construct a new parser with no associated handler. |
Method Summary | |
Enumeration |
declaredAttributes(String elname)
Get the declared attributes for an element type. |
Enumeration |
declaredElements()
Get the declared elements for an XML document. |
Enumeration |
declaredEntities()
Get declared entities. |
Enumeration |
declaredNotations()
Get declared notations. |
(package private) void |
doParse(String systemId,
String publicId,
Reader reader,
InputStream stream,
String encoding)
Parse an XML document from the character stream, byte stream, or URI that you provide (in that order of preference). |
String |
getAttributeDefaultValue(String name,
String aname)
Retrieve the default value of a declared attribute. |
int |
getAttributeDefaultValueType(String name,
String aname)
Retrieve the default value type of a declared attribute. |
String |
getAttributeEnumeration(String name,
String aname)
Retrieve the allowed values for an enumerated attribute type. |
String |
getAttributeExpandedValue(String name,
String aname)
Retrieve the expanded value of a declared attribute. |
int |
getAttributeType(String name,
String aname)
Retrieve the declared type of an attribute. |
int |
getColumnNumber()
Return the current column number. |
String |
getElementContentModel(String name)
Look up the content model of an element. |
int |
getElementContentType(String name)
Look up the content type of an element. |
String |
getEntityNotationName(String eName)
Get the notation name associated with an NDATA entity. |
String |
getEntityPublicId(String ename)
Return an external entity's public identifier, if any. |
String |
getEntitySystemId(String ename)
Return an external entity's system identifier. |
int |
getEntityType(String ename)
Find the type of an entity. |
String |
getEntityValue(String ename)
Return the value of an internal entity. |
int |
getLineNumber()
Return the current line number. |
String |
getNotationPublicId(String nname)
Look up the public identifier for a notation. |
String |
getNotationSystemId(String nname)
Look up the system identifier for a notation. |
String |
intern(char[] ch,
int start,
int length)
Create an interned string from a character array. |
(package private) void |
setHandler(SAXDriver handler)
Set the handler that will receive parsing events. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int CONTENT_UNDECLARED
getElementContentType(java.lang.String)
,
Constant Field Valuespublic static final int CONTENT_ANY
getElementContentType(java.lang.String)
,
Constant Field Valuespublic static final int CONTENT_EMPTY
getElementContentType(java.lang.String)
,
Constant Field Valuespublic static final int CONTENT_MIXED
getElementContentType(java.lang.String)
,
Constant Field Valuespublic static final int CONTENT_ELEMENTS
getElementContentType(java.lang.String)
,
Constant Field Valuespublic static final int ENTITY_UNDECLARED
getEntityType(java.lang.String)
,
Constant Field Valuespublic static final int ENTITY_INTERNAL
getEntityType(java.lang.String)
,
Constant Field Valuespublic static final int ENTITY_NDATA
getEntityType(java.lang.String)
,
Constant Field Valuespublic static final int ENTITY_TEXT
getEntityType(java.lang.String)
,
Constant Field Valuespublic static final int ATTRIBUTE_UNDECLARED
getAttributeType(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final int ATTRIBUTE_CDATA
getAttributeType(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final int ATTRIBUTE_ID
getAttributeType(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final int ATTRIBUTE_IDREF
getAttributeType(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final int ATTRIBUTE_IDREFS
getAttributeType(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final int ATTRIBUTE_ENTITY
getAttributeType(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final int ATTRIBUTE_ENTITIES
getAttributeType(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final int ATTRIBUTE_NMTOKEN
getAttributeType(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final int ATTRIBUTE_NMTOKENS
getAttributeType(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final int ATTRIBUTE_ENUMERATED
getAttributeType(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final int ATTRIBUTE_NOTATION
getAttributeType(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final int ATTRIBUTE_DEFAULT_UNDECLARED
getAttributeDefaultValueType(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final int ATTRIBUTE_DEFAULT_SPECIFIED
getAttributeDefaultValueType(java.lang.String, java.lang.String)
,
getAttributeDefaultValue(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final int ATTRIBUTE_DEFAULT_IMPLIED
getAttributeDefaultValueType(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final int ATTRIBUTE_DEFAULT_REQUIRED
getAttributeDefaultValueType(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final int ATTRIBUTE_DEFAULT_FIXED
getAttributeDefaultValueType(java.lang.String, java.lang.String)
,
getAttributeDefaultValue(java.lang.String, java.lang.String)
,
Constant Field ValuesConstructor Detail |
XmlParser()
setHandler(com.icl.saxon.aelfred.SAXDriver)
,
#parse
Method Detail |
void setHandler(SAXDriver handler)
handler
- The handler to receive callback events.#parse
void doParse(String systemId, String publicId, Reader reader, InputStream stream, String encoding) throws Exception
You may parse more than one document, but that must be done sequentially. Only one thread at a time may use this parser.
systemId
- The URI of the document; should never be null,
but may be so iff a reader or a stream is provided.publicId
- The public identifier of the document, or null.reader
- A character stream; must be null if stream isn't.stream
- A byte input stream; must be null if reader isn't.encoding
- The suggested encoding, or null if unknown.
Exception
- Basically SAXException or IOExceptionpublic String intern(char[] ch, int start, int length)
==
instead of String.equals ()
.
This is much more efficient than constructing a non-interned string first, and then interning it.
ch
- an array of characters for building the string.start
- the starting position in the array.length
- the number of characters to place in the string.
(String)
,
String.intern()
public Enumeration declaredElements()
The results will be valid only after the DTD (if any) has been parsed.
getElementContentType(java.lang.String)
,
getElementContentModel(java.lang.String)
public int getElementContentType(String name)
name
- The element type name.
getElementContentModel(java.lang.String)
,
CONTENT_UNDECLARED
,
CONTENT_ANY
,
CONTENT_EMPTY
,
CONTENT_MIXED
,
CONTENT_ELEMENTS
public String getElementContentModel(String name)
The result will always be null unless the content type is CONTENT_ELEMENTS or CONTENT_MIXED.
name
- The element type name.
getElementContentType(java.lang.String)
public Enumeration declaredAttributes(String elname)
elname
- The name of the element type.
getAttributeType(java.lang.String, java.lang.String)
,
getAttributeEnumeration(java.lang.String, java.lang.String)
,
getAttributeDefaultValueType(java.lang.String, java.lang.String)
,
getAttributeDefaultValue(java.lang.String, java.lang.String)
,
getAttributeExpandedValue(java.lang.String, java.lang.String)
public int getAttributeType(String name, String aname)
name
- The name of the associated element.aname
- The name of the attribute.
ATTRIBUTE_UNDECLARED
,
ATTRIBUTE_CDATA
,
ATTRIBUTE_ID
,
ATTRIBUTE_IDREF
,
ATTRIBUTE_IDREFS
,
ATTRIBUTE_ENTITY
,
ATTRIBUTE_ENTITIES
,
ATTRIBUTE_NMTOKEN
,
ATTRIBUTE_NMTOKENS
,
ATTRIBUTE_ENUMERATED
,
ATTRIBUTE_NOTATION
public String getAttributeEnumeration(String name, String aname)
name
- The name of the associated element.aname
- The name of the attribute.
ATTRIBUTE_ENUMERATED
,
ATTRIBUTE_NOTATION
public String getAttributeDefaultValue(String name, String aname)
name
- The name of the associated element.aname
- The name of the attribute.
getAttributeExpandedValue(java.lang.String, java.lang.String)
public String getAttributeExpandedValue(String name, String aname) throws Exception
General entities (and char refs) will be expanded (once).
name
- The name of the associated element.aname
- The name of the attribute.
Exception
getAttributeDefaultValue(java.lang.String, java.lang.String)
public int getAttributeDefaultValueType(String name, String aname)
ATTRIBUTE_DEFAULT_SPECIFIED
,
ATTRIBUTE_DEFAULT_IMPLIED
,
ATTRIBUTE_DEFAULT_REQUIRED
,
ATTRIBUTE_DEFAULT_FIXED
public Enumeration declaredEntities()
getEntityType(java.lang.String)
,
getEntityPublicId(java.lang.String)
,
getEntitySystemId(java.lang.String)
,
getEntityValue(java.lang.String)
,
getEntityNotationName(java.lang.String)
public int getEntityType(String ename)
ENTITY_UNDECLARED
,
ENTITY_INTERNAL
,
ENTITY_NDATA
,
ENTITY_TEXT
public String getEntityPublicId(String ename)
ename
- The name of the external entity.
getEntityType(java.lang.String)
public String getEntitySystemId(String ename)
ename
- The name of the external entity.
getEntityType(java.lang.String)
public String getEntityValue(String ename)
ename
- The name of the internal entity.
getEntityType(java.lang.String)
public String getEntityNotationName(String eName)
getEntityType(java.lang.String)
public Enumeration declaredNotations()
getNotationPublicId(java.lang.String)
,
getNotationSystemId(java.lang.String)
public String getNotationPublicId(String nname)
nname
- The name of the notation.
getNotationSystemId(java.lang.String)
public String getNotationSystemId(String nname)
nname
- The name of the notation.
getNotationPublicId(java.lang.String)
public int getLineNumber()
public int getColumnNumber()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |