📄 parser.h
字号:
/**
* Parse XML Prolog.
*/
void parse_xml_prolog (ACEXML_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((ACEXML_SAXException));
/**
* Parse a character reference, i.e., " " or "". The first
* character encountered should be the '#' char.
*
* @param buf points to a character buffer for the result.
* @param len specifies the capacities of the buffer.
*
* @retval 0 on success and -1 otherwise.
*/
int parse_char_reference (ACEXML_Char *buf, size_t len);
/**
* Parse an entity reference, i.e., "&". The first character
* encountered should be the character following '&'.
*
* @return A pointer to the resolved const ACEXML_String if success
* (previously defined), 0 otherwise.
*/
const ACEXML_String *parse_reference (void);
/**
* Parse a CDATA section. The first character should always be the first
* '[' in CDATA definition.
*
* @retval 0 on success.
* @retval -1 if fail.
*/
int parse_cdata (ACEXML_ENV_SINGLE_ARG_DECL);
/**
* Parse a "markupdecl" section, this includes both "markupdecl" and
* "DeclSep" sections in XML specification
*/
int parse_internal_dtd (ACEXML_ENV_SINGLE_ARG_DECL);
/**
* Parse an "ELEMENT" decl. The first character this method
* expects is always the 'L' (the second char) in the word
* "ELEMENT".
*
* @retval 0 on success, -1 otherwise.
*/
int parse_element_decl (ACEXML_ENV_SINGLE_ARG_DECL);
/**
* Parse an "ENTITY" decl. The first character this method expects
* is always the 'N' (the second char) in the word "ENTITY".
*
* @retval 0 on success, -1 otherwise.
*/
int parse_entity_decl (ACEXML_ENV_SINGLE_ARG_DECL);
/**
* Parse an "ATTLIST" decl. Thse first character this method
* expects is always the 'A' (the first char) in the word
* "ATTLIST".
*
* @retval 0 on success, -1 otherwise.
*/
int parse_attlist_decl (ACEXML_ENV_SINGLE_ARG_DECL);
/**
*Parse a "NOTATION" decl. The first character this method
* expects is always the 'N' (the first char) in the word
* "NOTATION".
*
* @retval 0 on success, -1 otherwise.
*/
int parse_notation_decl (ACEXML_ENV_SINGLE_ARG_DECL);
/**
* Parse an ExternalID or a reference to PUBLIC ExternalID.
* Possible cases are in the forms of: <code>
*
* SYSTEM 'quoted string representing system resource'
* PUBLIC 'quoted name of public ID' 'quoted resource'
* PUBLIC 'quoted name we are referring to'
* </code>
*
* The first character this function sees must be either 'S' or 'P'.
* When the function finishes parsing, the input stream points
* at the first non-whitespace character.
*
* @param publicId returns the unquoted publicId read. If none
* is available, it will be reset to 0.
* @param systemId returns the unquoted systemId read. If none
* is available, it will be reset to 0.
*
* @retval 0 on success, -1 otherwise.
*/
int parse_external_id_and_ref (ACEXML_Char *&publicId,
ACEXML_Char *&systemId ACEXML_ENV_ARG_DECL);
/**
* Parse the "children" and "Mixed" non-terminals in contentspec.
*
* The first character this function sees must be the first
* open paren '(' in children.
*
* @retval 0 on success, -1 otherwise.
*/
int parse_children_definition (ACEXML_ENV_SINGLE_ARG_DECL);
/**
* Parse a @c cp non-terminal. @c cp can either be a @c seq or a @c choice.
* This function calls itself recursively.
*
* @param skip_open_paren when non-zero, it indicates that the open paren of
* the @c seq or @c choice has already been removed from the input
* stream.
*
* @retval 0 on success, -1 otherwise.
*/
int parse_child (int skip_open_paren ACEXML_ENV_ARG_DECL);
protected:
/// Get a character.
ACEXML_Char get (void);
/// Peek a character.
ACEXML_Char peek (void);
/**
* Check if more data can be added to a character buffer in obstack.
* If not, the existing data in the buffer will be cleared out by
* freezing the segment and pass it out thru a content_handler_->characters ()
* call. @a counter records the length of the existing data in
* obstack.
*/
int try_grow_cdata (size_t size, size_t &len ACEXML_ENV_ARG_DECL);
// Feature names:
/**
* \addtogroup acexml_parser_features
* @{
*/
/**
* @var simple_parsing_feature_
*
* This constant string defines the name of "simple XML parsing"
* feature. When this feature is enabled, ACEXML parser is allowed
* to parse a simple XML stream without mandated XML prolog
* and no DTD defintion.
*/
static const ACEXML_Char simple_parsing_feature_[];
/**
* @var namespaces_feature_
*
* This constant string defines the SAX XML Namespace feature. When this
* feature is enabled, ACEXML parser allows access by namespace qualified
* names.
*/
static const ACEXML_Char namespaces_feature_[];
/**
* @var namespace_prefixes_feature_
*
* This constant string defines the SAX XML Namespace prefixes feature.
* Normally the list of attributes returned by the parser will not
* contain attributes used as namespace declarations (xmlns*). When this
* feature is enabled, the list of attributes contains the namespace
* declarations also.
*/
static const ACEXML_Char namespace_prefixes_feature_[];
/* @} */
private:
/**
* Dispatch errors to ErrorHandler.
*
*/
void report_error (const ACEXML_Char* message ACEXML_ENV_ARG_DECL);
/**
* Dispatch warnings to ErrorHandler.
*
*/
void report_warning (const ACEXML_Char* message ACEXML_ENV_ARG_DECL);
/**
* Dispatch fatal errors to ErrorHandler.
*
*/
void report_fatal_error (const ACEXML_Char* message ACEXML_ENV_ARG_DECL);
/**
* Dispatch prefix mapping calls to the ContentHandler.
*
* @param prefix Namespace prefix
* @param uri Namespace URI
* @param name Local name
* @param start 1 => startPrefixMapping 0 => endPrefixMapping
*/
void report_prefix_mapping (const ACEXML_Char* prefix,
const ACEXML_Char* uri,
const ACEXML_Char* name,
int start ACEXML_ENV_ARG_DECL);
/**
* Parse a keyword.
*/
int parse_token (const ACEXML_Char* keyword);
/// Keeping track of the handlers. We do not manage the memory for
/// handlers.
ACEXML_DTDHandler *dtd_handler_;
ACEXML_EntityResolver *entity_resolver_;
ACEXML_ContentHandler *content_handler_;
ACEXML_ErrorHandler *error_handler_;
/// @@ Feature and properties management structure here.
/// Current input char stream.
ACEXML_CharStream *instream_;
/// My doctype, if any.
ACEXML_Char *doctype_;
/// External DTD System Literal, if any.
ACEXML_Char *dtd_system_;
/// External DTD Public Literal, if any.
ACEXML_Char *dtd_public_;
ACE_Obstack_T<ACEXML_Char> obstack_;
ACEXML_NamespaceSupport xml_namespace_;
ACEXML_Entity_Manager entities_;
// Locator
ACEXML_LocatorImpl locator_;
// Feature flags &
int simple_parsing_;
int namespaces_;
int namespace_prefixes_;
};
#if defined (__ACEXML_INLINE__)
# include "ACEXML/parser/parser/Parser.i"
#endif /* __ACEXML_INLINE__ */
#include "ace/post.h"
#endif /* _ACEXML_BASIC_PARSER_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -