+10
-19
@@ -16,22 +16,17 @@
|
||||
#define MODULE_DESC "XML Module"
|
||||
#define MODULE_VER 1.0
|
||||
|
||||
#define XML_TOTAL_HANDLER (PH7_XML_DOCTYPE + 1)
|
||||
#define XML_ENGINE_MAGIC 0x851EFC52
|
||||
#define IS_INVALID_XML_ENGINE(XML) (XML == 0 || (XML)->nMagic != XML_ENGINE_MAGIC)
|
||||
|
||||
enum ph7_xml_handler_id {
|
||||
PH7_XML_START_TAG = 0, /* Start element */
|
||||
PH7_XML_END_TAG, /* End element */
|
||||
PH7_XML_CDATA, /* Character data */
|
||||
PH7_XML_PI, /* Processing instruction */
|
||||
PH7_XML_DEF, /* Default (unused) */
|
||||
PH7_XML_UNPED, /* Unparsed entity (unused) */
|
||||
PH7_XML_ND, /* Notation declaration (unused) */
|
||||
PH7_XML_EER, /* External entity reference (unused) */
|
||||
PH7_XML_NS_START, /* Start namespace declaration */
|
||||
PH7_XML_NS_END, /* End namespace declaration */
|
||||
PH7_XML_DOCTYPE /* DOCTYPE directive */
|
||||
/* One snapshot of the QName fields of an open element. The stack of these
|
||||
* lets the end handler restore the parent (enclosing) element after its own
|
||||
* callback, and gives text/PI/DOCTYPE callbacks the enclosing element. */
|
||||
typedef struct ph7_xml_elem_snapshot ph7_xml_elem_snapshot;
|
||||
struct ph7_xml_elem_snapshot {
|
||||
ph7_value sLocalName;
|
||||
ph7_value sNsUri;
|
||||
ph7_value sPrefix;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -45,17 +40,13 @@ struct ph7_xml_engine {
|
||||
ph7_vm *pVm; /* VM that owns this instance */
|
||||
ph7_context *pCtx; /* Current call context */
|
||||
SyXMLParser sParser; /* Underlying SAX parser */
|
||||
ph7_value aCB[XML_TOTAL_HANDLER]; /* Convenience callbacks by event id */
|
||||
ph7_value sParserValue; /* Resource value holding this engine */
|
||||
ph7_value sReaderValue; /* XmlReader object, owned only across Parse() */
|
||||
ph7_value sHandler; /* IXmlHandler implementation, when installed */
|
||||
ph7_value sAttrs; /* Snapshot of the current element attributes */
|
||||
ph7_value sLocalName; /* Current element local name */
|
||||
ph7_value sLocalName; /* Current (innermost open) element local name */
|
||||
ph7_value sNsUri; /* Current element namespace URI */
|
||||
ph7_value sPrefix; /* Current element prefix */
|
||||
/* Reserved: the public API forwards QName components separately and never
|
||||
* concatenates URI + separator + local name, so this value is unused. */
|
||||
int ns_sep;
|
||||
SySet sElemStack; /* Stack of open-element QName snapshots */
|
||||
SyBlob sErr; /* Last SAX error message */
|
||||
sxi32 iErrCode; /* Last SAX error code */
|
||||
sxu32 nErrLine; /* Line of the last SAX error */
|
||||
|
||||
Reference in New Issue
Block a user