X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=sherlock%2Fxml%2Fxml.h;h=e94588836bf733470c2d008725d08b06fa140252;hb=dbe3b315edac25079fcbfe4df20e80b534f2a7a1;hp=08a4d6f681a00c3337fc73cbfff3abd64c0ca3e3;hpb=b12f3033ac773b6b22d558bd8f4c7b3de53f2867;p=libucw.git diff --git a/sherlock/xml/xml.h b/sherlock/xml/xml.h index 08a4d6f6..e9458883 100644 --- a/sherlock/xml/xml.h +++ b/sherlock/xml/xml.h @@ -10,10 +10,10 @@ #ifndef _SHERLOCK_XML_XML_H #define _SHERLOCK_XML_XML_H -#include "lib/clists.h" -#include "lib/slists.h" -#include "lib/mempool.h" -#include "lib/fastbuf.h" +#include "ucw/clists.h" +#include "ucw/slists.h" +#include "ucw/mempool.h" +#include "ucw/fastbuf.h" struct xml_context; struct xml_dtd_entity; @@ -81,12 +81,14 @@ enum xml_flags { XML_VALIDATING = 0x00000100, /* Validate everything (not fully implemented!) */ XML_PARSE_DTD = 0x00000200, /* Enable parsing of DTD */ XML_NO_CHARS = 0x00000400, /* The current element must not contain character data (filled automaticaly if using DTD) */ + XML_ALLOC_DEFAULT_ATTRS = 0x00000800, /* Allocate default attribute values so they can be found by XML_ATTR_FOR_EACH */ /* Internals, do not change! */ XML_EMPTY_ELEM_TAG = 0x00010000, /* The current element match EmptyElemTag */ XML_VERSION_1_1 = 0x00020000, /* XML version is 1.1, otherwise 1.0 */ XML_HAS_EXTERNAL_SUBSET = 0x00040000, /* The document contains a reference to external DTD subset */ XML_HAS_INTERNAL_SUBSET = 0x00080000, /* The document contains an internal subset */ + XML_HAS_DTD = XML_HAS_EXTERNAL_SUBSET | XML_HAS_INTERNAL_SUBSET, XML_SRC_EOF = 0x00100000, /* EOF reached */ XML_SRC_EXPECTED_DECL = 0x00200000, /* Just before optional or required XMLDecl/TextDecl */ XML_SRC_DOCUMENT = 0x00400000, /* The document entity */ @@ -244,6 +246,9 @@ uns xml_row(struct xml_context *ctx); /* Finds a given attribute value in a XML_NODE_ELEM node */ struct xml_attr *xml_attr_find(struct xml_context *ctx, struct xml_node *node, char *name); +/* Similar to xml_attr_find, but it deals also with default values */ +char *xml_attr_value(struct xml_context *ctx, struct xml_node *node, char *name); + /* The default value of h_find_entity(), knows <, >, &, ' and " */ struct xml_dtd_entity *xml_def_find_entity(struct xml_context *ctx, char *name); @@ -253,6 +258,12 @@ void xml_def_resolve_entity(struct xml_context *ctx, struct xml_dtd_entity *ent) /* Remove leading/trailing spaces and replaces sequences of spaces to a single space character (non-CDATA attribute normalization) */ uns xml_normalize_white(struct xml_context *ctx, char *value); +/* Merge character contents of a given element to a single string (not recursive) */ +char *xml_merge_chars(struct xml_context *ctx, struct xml_node *node, struct mempool *pool); + +/* Merge character contents of a given subtree to a single string */ +char *xml_merge_dom_chars(struct xml_context *ctx, struct xml_node *node, struct mempool *pool); + /* Public part of error handling */ void xml_warn(struct xml_context *ctx, const char *format, ...); void xml_error(struct xml_context *ctx, const char *format, ...);