|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectmegamek.common.XMLStreamParser
public class XMLStreamParser
This class parses an XML input stream. If the stream is well formed, no
Exception will be thrown. If the stream adheres to the format
described by the file, "xml-spec.txt", then this class can return entities.
If unexpected entities are encountered while parsing a well-formed stream, a
warning message will be available.
| Field Summary | |
|---|---|
static java.lang.String |
ADVS
|
static java.lang.String |
AEROCRIT
|
static java.lang.String |
ARMOR
|
static java.lang.String |
ARTILLERY
|
static java.lang.String |
AUTOEJECT
|
static java.lang.String |
AVIONICS
|
static java.lang.String |
CAT_PORTRAIT
|
static java.lang.String |
CHASSIS
The names of the attributes recognized by this parser. |
static java.lang.String |
CIC
|
static java.lang.String |
COMMANDB
|
static java.lang.String |
COMMANDER
|
static java.lang.String |
DEAD
Special values recognized by this parser. |
static java.lang.String |
DESTROYED
|
static java.lang.String |
DIRECTION
|
static java.lang.String |
EJECTED
|
static java.lang.String |
EMPTY
|
static java.lang.String |
ENGINE
|
static java.lang.String |
ENTITY
|
static java.lang.String |
EXT_ID
|
static java.lang.String |
FCS
|
static java.lang.String |
FILE_PORTRAIT
|
static java.lang.String |
FLUFF
|
static java.lang.String |
FRONT
|
static java.lang.String |
FUEL
|
static java.lang.String |
GEAR
|
static java.lang.String |
GUNNERY
|
static java.lang.String |
GUNNERYB
|
static java.lang.String |
GUNNERYL
|
static java.lang.String |
GUNNERYM
|
static java.lang.String |
HEAT
|
static java.lang.String |
HITS
|
static java.lang.String |
IMPLANTS
|
static java.lang.String |
INDEX
|
static java.lang.String |
INITB
|
static java.lang.String |
INTEGRITY
|
static java.lang.String |
INTERNAL
|
static java.lang.String |
IS_DESTROYED
|
static java.lang.String |
IS_HIT
|
static java.lang.String |
IS_REAR
|
static java.lang.String |
IS_REPAIRABLE
|
static java.lang.String |
KF
|
static java.lang.String |
LEFT
|
static java.lang.String |
LEFT_THRUST
|
static java.lang.String |
LIFE_SUPPORT
|
static java.lang.String |
LOCATION
|
static java.lang.String |
MODEL
|
static java.lang.String |
MOVEMENT
|
static java.lang.String |
MUNITION
|
static java.lang.String |
NA
|
static java.lang.String |
NAME
|
static java.lang.String |
NICK
|
static java.lang.String |
PILOT
|
static java.lang.String |
PILOTING
|
static java.lang.String |
POINTS
|
static java.lang.String |
QUIRKS
|
static java.lang.String |
REAR
|
static java.lang.String |
RIGHT_THRUST
|
static java.lang.String |
SAIL
|
static java.lang.String |
SENSORS
|
static java.lang.String |
SHOTS
|
static java.lang.String |
SI
|
static java.lang.String |
SINK
|
static java.lang.String |
SLOT
|
static java.lang.String |
SPEED
|
static java.lang.String |
SYSTEM
|
static java.lang.String |
TEMPLATE
|
static java.lang.String |
TOUGH
|
static java.lang.String |
TURRETLOCK
|
static java.lang.String |
TYPE
|
static java.lang.String |
UNIT
The names of the various elements recognized by this parser. |
| Constructor Summary | |
|---|---|
XMLStreamParser()
No Entitys or warning message are available if the
default constructor is used. |
|
XMLStreamParser(java.io.InputStream input)
Construct an object and parse the XML stream. |
|
| Method Summary | |
|---|---|
java.io.InputStream |
getDocumentStream()
This method is always called exactly once, before all other callbacks. |
java.util.Vector<Entity> |
getEntities()
Get any Entitys parsed from the last input stream. |
java.util.Vector<Pilot> |
getPilots()
|
java.lang.String |
getWarningMessage()
Get the warning message from the last parse. |
boolean |
hasWarningMessage()
Determine if unexpected XML entities were encountered during parsing. |
void |
parse(java.io.InputStream input)
Parse the indicated XML stream. |
void |
recordAttlistDeclaration(java.lang.String element,
java.lang.String attr,
boolean notation,
java.lang.String type,
java.lang.String defmod,
java.lang.String def)
This method is called when an attribute definition is parsed from an attlist tag in a DTD. |
void |
recordCharData(java.lang.String charData)
This method is called to return character data to the application. |
void |
recordComment(java.lang.String comment)
This method is called to return comments to the application. |
void |
recordDocEnd()
This method is called to indicate that the document stream has been successfully closed. |
void |
recordDocStart()
This method is called to indicate that the document stream has been opened successfully. |
void |
recordDoctypeDeclaration(java.lang.String name,
java.lang.String pubID,
java.lang.String sysID)
This method is called after all the DTD related information is has been passed back. |
void |
recordElementDeclaration(java.lang.String name,
java.lang.String content)
This method is called when an element declaration is met in a DTD. |
void |
recordElementEnd(java.lang.String name)
This method is called to indicate the closure of an element (tag). |
void |
recordElementStart(java.lang.String name,
java.util.Hashtable attr)
This method is called to indicate the start of an element (tag). |
void |
recordEntityDeclaration(java.lang.String name,
java.lang.String value,
java.lang.String pubID,
java.lang.String sysID,
java.lang.String notation)
This method is called whenever an general entity declaration is parsed from a DTD. |
void |
recordNotationDeclaration(java.lang.String name,
java.lang.String pubID,
java.lang.String sysID)
This method is called whenever a notation is parsed from a DTD. |
void |
recordPI(java.lang.String name,
java.lang.String pValue)
This method is called to passback program instructions to the application. |
java.io.InputStream |
resolveDTDEntity(java.lang.String name,
java.lang.String pubID,
java.lang.String sysID)
This method is called to obtain an external DTD. |
java.io.InputStream |
resolveExternalEntity(java.lang.String name,
java.lang.String pubID,
java.lang.String sysID)
This method is called when an external entity must be resolved for insertion into the document its DTD. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String UNIT
public static final java.lang.String TEMPLATE
public static final java.lang.String ENTITY
public static final java.lang.String FLUFF
public static final java.lang.String PILOT
public static final java.lang.String LOCATION
public static final java.lang.String ARMOR
public static final java.lang.String SLOT
public static final java.lang.String MOVEMENT
public static final java.lang.String TURRETLOCK
public static final java.lang.String SI
public static final java.lang.String HEAT
public static final java.lang.String FUEL
public static final java.lang.String KF
public static final java.lang.String SAIL
public static final java.lang.String AEROCRIT
public static final java.lang.String CHASSIS
public static final java.lang.String MODEL
public static final java.lang.String NAME
public static final java.lang.String EXT_ID
public static final java.lang.String NICK
public static final java.lang.String CAT_PORTRAIT
public static final java.lang.String FILE_PORTRAIT
public static final java.lang.String GUNNERY
public static final java.lang.String GUNNERYL
public static final java.lang.String GUNNERYM
public static final java.lang.String GUNNERYB
public static final java.lang.String PILOTING
public static final java.lang.String ARTILLERY
public static final java.lang.String TOUGH
public static final java.lang.String INITB
public static final java.lang.String COMMANDB
public static final java.lang.String HITS
public static final java.lang.String ADVS
public static final java.lang.String IMPLANTS
public static final java.lang.String QUIRKS
public static final java.lang.String COMMANDER
public static final java.lang.String AUTOEJECT
public static final java.lang.String EJECTED
public static final java.lang.String INDEX
public static final java.lang.String IS_DESTROYED
public static final java.lang.String IS_REPAIRABLE
public static final java.lang.String POINTS
public static final java.lang.String TYPE
public static final java.lang.String IS_REAR
public static final java.lang.String SHOTS
public static final java.lang.String IS_HIT
public static final java.lang.String MUNITION
public static final java.lang.String SPEED
public static final java.lang.String DIRECTION
public static final java.lang.String INTEGRITY
public static final java.lang.String SINK
public static final java.lang.String LEFT
public static final java.lang.String AVIONICS
public static final java.lang.String SENSORS
public static final java.lang.String ENGINE
public static final java.lang.String FCS
public static final java.lang.String CIC
public static final java.lang.String LEFT_THRUST
public static final java.lang.String RIGHT_THRUST
public static final java.lang.String LIFE_SUPPORT
public static final java.lang.String GEAR
public static final java.lang.String DEAD
public static final java.lang.String NA
public static final java.lang.String DESTROYED
public static final java.lang.String FRONT
public static final java.lang.String REAR
public static final java.lang.String INTERNAL
public static final java.lang.String EMPTY
public static final java.lang.String SYSTEM
| Constructor Detail |
|---|
public XMLStreamParser()
Entitys or warning message are available if the
default constructor is used.
public XMLStreamParser(java.io.InputStream input)
throws gd.xml.ParseException
Entitys from a previously parsed stream will be
discarded.
input - - the InputStream to be parsed.
gd.xml.ParseException - is thrown if a fatal warning occurs during
parsing. Typically, this only occurs when the XML is not
well-formed.| Method Detail |
|---|
public void parse(java.io.InputStream input)
throws gd.xml.ParseException
Entitys from a previously parsed stream will be
discarded.
input - - the InputStream to be parsed.
gd.xml.ParseException - is thrown if a fatal error occurs during
parsing. Typically, this only occurs when the XML is not
well-formed.public boolean hasWarningMessage()
true if a non-fatal warning occured.public java.lang.String getWarningMessage()
String warning message from the last parse. If
there is no warning message, then an null value is
returned.public java.util.Vector<Entity> getEntities()
Entitys parsed from the last input stream.
Entities may have been parsed out of the stream, even if errors were
encountered.
Vector containing Entitys parsed
from the stream. This Vector may be empty, but it
will never be null.public java.util.Vector<Pilot> getPilots()
public void recordNotationDeclaration(java.lang.String name,
java.lang.String pubID,
java.lang.String sysID)
throws gd.xml.ParseException
gd.xml.XMLResponder
recordNotationDeclaration in interface gd.xml.XMLRespondername - the name of the notationpubID - the public ID of the notation if it was specified or null otherwisesysID - the system ID (typically filename) of the notation (or null if unspecified)
gd.xml.ParseException
public void recordEntityDeclaration(java.lang.String name,
java.lang.String value,
java.lang.String pubID,
java.lang.String sysID,
java.lang.String notation)
throws gd.xml.ParseException
gd.xml.XMLResponder
recordEntityDeclaration in interface gd.xml.XMLRespondername - the name assigned to this entityvalue - the replacement text of this entitypubID - the public ID of the entities replacement text (or null if unspecified)sysID - the system ID of the entities replacement text (or null if unspecified)notation - specifies the notation associated with this entity (null if entity to be parsed as XML)
gd.xml.ParseException
public void recordElementDeclaration(java.lang.String name,
java.lang.String content)
throws gd.xml.ParseException
gd.xml.XMLResponder
recordElementDeclaration in interface gd.xml.XMLRespondername - the tag name given to this elementcontent - a regexp-like expression which specifies which elements and character data may appear within this element
gd.xml.ParseException
public void recordAttlistDeclaration(java.lang.String element,
java.lang.String attr,
boolean notation,
java.lang.String type,
java.lang.String defmod,
java.lang.String def)
throws gd.xml.ParseException
gd.xml.XMLResponder
recordAttlistDeclaration in interface gd.xml.XMLResponderelement - the element to which this attribute appliesattr - the name of the attribute being described by this declarationnotation - the notation (if any) which applies to this attributetype - the type of value defined by this attributedefmod - describes the nature of this attributes default value (one of 'FIXED', 'REQUIRED', 'IMPLIED' - as per XML spec - or 'DEFAULT' indicating a 'basic' default value)def - the default value of this attribute (may be null, indicating no default specified)
gd.xml.ParseException
public void recordDoctypeDeclaration(java.lang.String name,
java.lang.String pubID,
java.lang.String sysID)
throws gd.xml.ParseException
gd.xml.XMLResponder
recordDoctypeDeclaration in interface gd.xml.XMLRespondername - the name of the document typepubID - the public ID of the document type (may be null)sysID - the system ID of the document type (null if no external DTD is specified)
gd.xml.ParseExceptionpublic void recordDocStart()
gd.xml.XMLResponder
recordDocStart in interface gd.xml.XMLResponderpublic void recordDocEnd()
gd.xml.XMLResponder
recordDocEnd in interface gd.xml.XMLResponder
public void recordElementStart(java.lang.String name,
java.util.Hashtable attr)
throws gd.xml.ParseException
gd.xml.XMLResponder
recordElementStart in interface gd.xml.XMLRespondername - the name of the element (tag name)attr - a hashtable containing the explicitly supplied attributes (as strings)
gd.xml.ParseException
public void recordElementEnd(java.lang.String name)
throws gd.xml.ParseException
gd.xml.XMLResponder
recordElementEnd in interface gd.xml.XMLRespondername - the name of the element (tag) being closed
gd.xml.ParseException
public void recordPI(java.lang.String name,
java.lang.String pValue)
gd.xml.XMLResponder
recordPI in interface gd.xml.XMLRespondername - the name of the program instructionpValue - the data associated with this program instructionpublic void recordCharData(java.lang.String charData)
gd.xml.XMLResponder
recordCharData in interface gd.xml.XMLRespondercharData - character data from the document.public void recordComment(java.lang.String comment)
gd.xml.XMLResponder
recordComment in interface gd.xml.XMLResponder
public java.io.InputStream getDocumentStream()
throws gd.xml.ParseException
gd.xml.XMLResponder
getDocumentStream in interface gd.xml.XMLRespondergd.xml.ParseException
public java.io.InputStream resolveExternalEntity(java.lang.String name,
java.lang.String pubID,
java.lang.String sysID)
throws gd.xml.ParseException
gd.xml.XMLResponder
resolveExternalEntity in interface gd.xml.XMLRespondername - the name of the entity to be retrieved.pubID - the public ID of the entity (may be null)sysID - the system ID of the entity
gd.xml.ParseException
public java.io.InputStream resolveDTDEntity(java.lang.String name,
java.lang.String pubID,
java.lang.String sysID)
throws gd.xml.ParseException
gd.xml.XMLResponder
resolveDTDEntity in interface gd.xml.XMLRespondername - the name of the DTDpubID - its public ID (may be null)sysID - its system ID
gd.xml.ParseException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||