(libxml) LIBXML_WRITER_ENABLED removed

This commit is contained in:
twinaphex 2012-11-17 23:09:25 +01:00
parent c0ae8bc079
commit a70a5b541c
12 changed files with 12 additions and 7050 deletions

View File

@ -50,8 +50,7 @@ LOCAL_LIBXML_SRC_FILES = $(LIBXML_PATH)/c14n.c \
$(LIBXML_PATH)/xmlregexp.c \
$(LIBXML_PATH)/xmlsave.c \
$(LIBXML_PATH)/xmlstring.c \
$(LIBXML_PATH)/xmlunicode.c \
$(LIBXML_PATH)/xmlwriter.c
$(LIBXML_PATH)/xmlunicode.c
LOCAL_SRC_FILES = $(RARCH_PATH)/console/griffin/griffin.c $(LOCAL_LIBXML_SRC_FILES)

View File

@ -1037,746 +1037,6 @@ xmlSAX2EndDocument(void *ctx)
}
}
#if defined(LIBXML_WRITER_ENABLED)
/**
* xmlSAX2AttributeInternal:
* @ctx: the user data (XML parser context)
* @fullname: The attribute name, including namespace prefix
* @value: The attribute value
* @prefix: the prefix on the element node
*
* Handle an attribute that has been read by the parser.
* The default handling is to convert the attribute into an
* DOM subtree and past it in a new xmlAttr element added to
* the element.
*/
static void
xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname,
const xmlChar *value, const xmlChar *prefix ATTRIBUTE_UNUSED)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlAttrPtr ret;
xmlChar *name;
xmlChar *ns;
xmlChar *nval;
xmlNsPtr namespace;
if (ctxt->html) {
name = xmlStrdup(fullname);
ns = NULL;
namespace = NULL;
} else {
/*
* Split the full name into a namespace prefix and the tag name
*/
name = xmlSplitQName(ctxt, fullname, &ns);
if ((name != NULL) && (name[0] == 0)) {
if (xmlStrEqual(ns, BAD_CAST "xmlns")) {
xmlNsErrMsg(ctxt, XML_ERR_NS_DECL_ERROR,
"invalid namespace declaration '%s'\n",
fullname, NULL);
} else {
xmlNsWarnMsg(ctxt, XML_WAR_NS_COLUMN,
"Avoid attribute ending with ':' like '%s'\n",
fullname, NULL);
}
if (ns != NULL)
xmlFree(ns);
ns = NULL;
xmlFree(name);
name = xmlStrdup(fullname);
}
}
if (name == NULL) {
xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElement");
if (ns != NULL)
xmlFree(ns);
return;
}
{
#ifdef LIBXML_VALID_ENABLED
/*
* Do the last stage of the attribute normalization
* Needed for HTML too:
* http://www.w3.org/TR/html4/types.html#h-6.2
*/
ctxt->vctxt.valid = 1;
nval = xmlValidCtxtNormalizeAttributeValue(&ctxt->vctxt,
ctxt->myDoc, ctxt->node,
fullname, value);
if (ctxt->vctxt.valid != 1) {
ctxt->valid = 0;
}
if (nval != NULL)
value = nval;
#else
nval = NULL;
#endif /* LIBXML_VALID_ENABLED */
}
/*
* Check whether it's a namespace definition
*/
if ((!ctxt->html) && (ns == NULL) &&
(name[0] == 'x') && (name[1] == 'm') && (name[2] == 'l') &&
(name[3] == 'n') && (name[4] == 's') && (name[5] == 0)) {
xmlNsPtr nsret;
xmlChar *val;
if (!ctxt->replaceEntities) {
ctxt->depth++;
val = xmlStringDecodeEntities(ctxt, value, XML_SUBSTITUTE_REF,
0,0,0);
ctxt->depth--;
} else {
val = (xmlChar *) value;
}
if (val[0] != 0) {
xmlURIPtr uri;
uri = xmlParseURI((const char *)val);
if (uri == NULL) {
if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
ctxt->sax->warning(ctxt->userData,
"xmlns: %s not a valid URI\n", val);
} else {
if (uri->scheme == NULL) {
if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
ctxt->sax->warning(ctxt->userData,
"xmlns: URI %s is not absolute\n", val);
}
xmlFreeURI(uri);
}
}
/* a default namespace definition */
nsret = xmlNewNs(ctxt->node, val, NULL);
#ifdef LIBXML_VALID_ENABLED
/*
* Validate also for namespace decls, they are attributes from
* an XML-1.0 perspective
*/
if (nsret != NULL && ctxt->validate && ctxt->wellFormed &&
ctxt->myDoc && ctxt->myDoc->intSubset)
ctxt->valid &= xmlValidateOneNamespace(&ctxt->vctxt, ctxt->myDoc,
ctxt->node, prefix, nsret, val);
#endif /* LIBXML_VALID_ENABLED */
if (name != NULL)
xmlFree(name);
if (nval != NULL)
xmlFree(nval);
if (val != value)
xmlFree(val);
return;
}
if ((!ctxt->html) &&
(ns != NULL) && (ns[0] == 'x') && (ns[1] == 'm') && (ns[2] == 'l') &&
(ns[3] == 'n') && (ns[4] == 's') && (ns[5] == 0)) {
xmlNsPtr nsret;
xmlChar *val;
if (!ctxt->replaceEntities) {
ctxt->depth++;
val = xmlStringDecodeEntities(ctxt, value, XML_SUBSTITUTE_REF,
0,0,0);
ctxt->depth--;
if (val == NULL) {
xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElement");
xmlFree(ns);
if (name != NULL)
xmlFree(name);
return;
}
} else {
val = (xmlChar *) value;
}
if (val[0] == 0) {
xmlNsErrMsg(ctxt, XML_NS_ERR_EMPTY,
"Empty namespace name for prefix %s\n", name, NULL);
}
if ((ctxt->pedantic != 0) && (val[0] != 0)) {
xmlURIPtr uri;
uri = xmlParseURI((const char *)val);
if (uri == NULL) {
xmlNsWarnMsg(ctxt, XML_WAR_NS_URI,
"xmlns:%s: %s not a valid URI\n", name, value);
} else {
if (uri->scheme == NULL) {
xmlNsWarnMsg(ctxt, XML_WAR_NS_URI_RELATIVE,
"xmlns:%s: URI %s is not absolute\n", name, value);
}
xmlFreeURI(uri);
}
}
/* a standard namespace definition */
nsret = xmlNewNs(ctxt->node, val, name);
xmlFree(ns);
#ifdef LIBXML_VALID_ENABLED
/*
* Validate also for namespace decls, they are attributes from
* an XML-1.0 perspective
*/
if (nsret != NULL && ctxt->validate && ctxt->wellFormed &&
ctxt->myDoc && ctxt->myDoc->intSubset)
ctxt->valid &= xmlValidateOneNamespace(&ctxt->vctxt, ctxt->myDoc,
ctxt->node, prefix, nsret, value);
#endif /* LIBXML_VALID_ENABLED */
if (name != NULL)
xmlFree(name);
if (nval != NULL)
xmlFree(nval);
if (val != value)
xmlFree(val);
return;
}
if (ns != NULL) {
namespace = xmlSearchNs(ctxt->myDoc, ctxt->node, ns);
if (namespace == NULL) {
xmlNsErrMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE,
"Namespace prefix %s of attribute %s is not defined\n",
ns, name);
} else {
xmlAttrPtr prop;
prop = ctxt->node->properties;
while (prop != NULL) {
if (prop->ns != NULL) {
if ((xmlStrEqual(name, prop->name)) &&
((namespace == prop->ns) ||
(xmlStrEqual(namespace->href, prop->ns->href)))) {
xmlNsErrMsg(ctxt, XML_ERR_ATTRIBUTE_REDEFINED,
"Attribute %s in %s redefined\n",
name, namespace->href);
ctxt->wellFormed = 0;
if (ctxt->recovery == 0) ctxt->disableSAX = 1;
goto error;
}
}
prop = prop->next;
}
}
} else {
namespace = NULL;
}
/* !!!!!! <a toto:arg="" xmlns:toto="http://toto.com"> */
ret = xmlNewNsPropEatName(ctxt->node, namespace, name, NULL);
if (ret != NULL) {
if ((ctxt->replaceEntities == 0) && (!ctxt->html)) {
xmlNodePtr tmp;
ret->children = xmlStringGetNodeList(ctxt->myDoc, value);
tmp = ret->children;
while (tmp != NULL) {
tmp->parent = (xmlNodePtr) ret;
if (tmp->next == NULL)
ret->last = tmp;
tmp = tmp->next;
}
} else if (value != NULL) {
ret->children = xmlNewDocText(ctxt->myDoc, value);
ret->last = ret->children;
if (ret->children != NULL)
ret->children->parent = (xmlNodePtr) ret;
}
}
#ifdef LIBXML_VALID_ENABLED
if ((!ctxt->html) && ctxt->validate && ctxt->wellFormed &&
ctxt->myDoc && ctxt->myDoc->intSubset) {
/*
* If we don't substitute entities, the validation should be
* done on a value with replaced entities anyway.
*/
if (!ctxt->replaceEntities) {
xmlChar *val;
ctxt->depth++;
val = xmlStringDecodeEntities(ctxt, value, XML_SUBSTITUTE_REF,
0,0,0);
ctxt->depth--;
if (val == NULL)
ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt,
ctxt->myDoc, ctxt->node, ret, value);
else {
xmlChar *nvalnorm;
/*
* Do the last stage of the attribute normalization
* It need to be done twice ... it's an extra burden related
* to the ability to keep xmlSAX2References in attributes
*/
nvalnorm = xmlValidNormalizeAttributeValue(ctxt->myDoc,
ctxt->node, fullname, val);
if (nvalnorm != NULL) {
xmlFree(val);
val = nvalnorm;
}
ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt,
ctxt->myDoc, ctxt->node, ret, val);
xmlFree(val);
}
} else {
ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt, ctxt->myDoc,
ctxt->node, ret, value);
}
} else
#endif /* LIBXML_VALID_ENABLED */
if (((ctxt->loadsubset & XML_SKIP_IDS) == 0) &&
(((ctxt->replaceEntities == 0) && (ctxt->external != 2)) ||
((ctxt->replaceEntities != 0) && (ctxt->inSubset == 0)))) {
/*
* when validating, the ID registration is done at the attribute
* validation level. Otherwise we have to do specific handling here.
*/
if (xmlStrEqual(fullname, BAD_CAST "xml:id")) {
/*
* Add the xml:id value
*
* Open issue: normalization of the value.
*/
if (xmlValidateNCName(value, 1) != 0) {
xmlErrValid(ctxt, XML_DTD_XMLID_VALUE,
"xml:id : attribute value %s is not an NCName\n",
(const char *) value, NULL);
}
xmlAddID(&ctxt->vctxt, ctxt->myDoc, value, ret);
} else if (xmlIsID(ctxt->myDoc, ctxt->node, ret))
xmlAddID(&ctxt->vctxt, ctxt->myDoc, value, ret);
else if (xmlIsRef(ctxt->myDoc, ctxt->node, ret))
xmlAddRef(&ctxt->vctxt, ctxt->myDoc, value, ret);
}
error:
if (nval != NULL)
xmlFree(nval);
if (ns != NULL)
xmlFree(ns);
}
/*
* xmlCheckDefaultedAttributes:
*
* Check defaulted attributes from the DTD
*/
static void
xmlCheckDefaultedAttributes(xmlParserCtxtPtr ctxt, const xmlChar *name,
const xmlChar *prefix, const xmlChar **atts) {
xmlElementPtr elemDecl;
const xmlChar *att;
int internal = 1;
int i;
elemDecl = xmlGetDtdQElementDesc(ctxt->myDoc->intSubset, name, prefix);
if (elemDecl == NULL) {
elemDecl = xmlGetDtdQElementDesc(ctxt->myDoc->extSubset, name, prefix);
internal = 0;
}
process_external_subset:
if (elemDecl != NULL) {
xmlAttributePtr attr = elemDecl->attributes;
/*
* Check against defaulted attributes from the external subset
* if the document is stamped as standalone
*/
if ((ctxt->myDoc->standalone == 1) &&
(ctxt->myDoc->extSubset != NULL) &&
(ctxt->validate)) {
while (attr != NULL) {
if ((attr->defaultValue != NULL) &&
(xmlGetDtdQAttrDesc(ctxt->myDoc->extSubset,
attr->elem, attr->name,
attr->prefix) == attr) &&
(xmlGetDtdQAttrDesc(ctxt->myDoc->intSubset,
attr->elem, attr->name,
attr->prefix) == NULL)) {
xmlChar *fulln;
if (attr->prefix != NULL) {
fulln = xmlStrdup(attr->prefix);
fulln = xmlStrcat(fulln, BAD_CAST ":");
fulln = xmlStrcat(fulln, attr->name);
} else {
fulln = xmlStrdup(attr->name);
}
if (fulln == NULL) {
xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElement");
break;
}
/*
* Check that the attribute is not declared in the
* serialization
*/
att = NULL;
if (atts != NULL) {
i = 0;
att = atts[i];
while (att != NULL) {
if (xmlStrEqual(att, fulln))
break;
i += 2;
att = atts[i];
}
}
if (att == NULL) {
xmlErrValid(ctxt, XML_DTD_STANDALONE_DEFAULTED,
"standalone: attribute %s on %s defaulted from external subset\n",
(const char *)fulln,
(const char *)attr->elem);
}
xmlFree(fulln);
}
attr = attr->nexth;
}
}
/*
* Actually insert defaulted values when needed
*/
attr = elemDecl->attributes;
while (attr != NULL) {
/*
* Make sure that attributes redefinition occuring in the
* internal subset are not overriden by definitions in the
* external subset.
*/
if (attr->defaultValue != NULL) {
/*
* the element should be instantiated in the tree if:
* - this is a namespace prefix
* - the user required for completion in the tree
* like XSLT
* - there isn't already an attribute definition
* in the internal subset overriding it.
*/
if (((attr->prefix != NULL) &&
(xmlStrEqual(attr->prefix, BAD_CAST "xmlns"))) ||
((attr->prefix == NULL) &&
(xmlStrEqual(attr->name, BAD_CAST "xmlns"))) ||
(ctxt->loadsubset & XML_COMPLETE_ATTRS)) {
xmlAttributePtr tst;
tst = xmlGetDtdQAttrDesc(ctxt->myDoc->intSubset,
attr->elem, attr->name,
attr->prefix);
if ((tst == attr) || (tst == NULL)) {
xmlChar fn[50];
xmlChar *fulln;
fulln = xmlBuildQName(attr->name, attr->prefix, fn, 50);
if (fulln == NULL) {
xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElement");
return;
}
/*
* Check that the attribute is not declared in the
* serialization
*/
att = NULL;
if (atts != NULL) {
i = 0;
att = atts[i];
while (att != NULL) {
if (xmlStrEqual(att, fulln))
break;
i += 2;
att = atts[i];
}
}
if (att == NULL) {
xmlSAX2AttributeInternal(ctxt, fulln,
attr->defaultValue, prefix);
}
if ((fulln != fn) && (fulln != attr->name))
xmlFree(fulln);
}
}
}
attr = attr->nexth;
}
if (internal == 1) {
elemDecl = xmlGetDtdQElementDesc(ctxt->myDoc->extSubset,
name, prefix);
internal = 0;
goto process_external_subset;
}
}
}
/**
* xmlSAX2StartElement:
* @ctx: the user data (XML parser context)
* @fullname: The element name, including namespace prefix
* @atts: An array of name/value attributes pairs, NULL terminated
*
* called when an opening tag has been processed.
*/
void
xmlSAX2StartElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlNodePtr ret;
xmlNodePtr parent;
xmlNsPtr ns;
xmlChar *name;
xmlChar *prefix;
const xmlChar *att;
const xmlChar *value;
int i;
if ((ctx == NULL) || (fullname == NULL) || (ctxt->myDoc == NULL)) return;
parent = ctxt->node;
#ifdef DEBUG_SAX
xmlGenericError(xmlGenericErrorContext,
"SAX.xmlSAX2StartElement(%s)\n", fullname);
#endif
/*
* First check on validity:
*/
if (ctxt->validate && (ctxt->myDoc->extSubset == NULL) &&
((ctxt->myDoc->intSubset == NULL) ||
((ctxt->myDoc->intSubset->notations == NULL) &&
(ctxt->myDoc->intSubset->elements == NULL) &&
(ctxt->myDoc->intSubset->attributes == NULL) &&
(ctxt->myDoc->intSubset->entities == NULL)))) {
xmlErrValid(ctxt, XML_ERR_NO_DTD,
"Validation failed: no DTD found !", NULL, NULL);
ctxt->validate = 0;
}
/*
* Split the full name into a namespace prefix and the tag name
*/
name = xmlSplitQName(ctxt, fullname, &prefix);
/*
* Note : the namespace resolution is deferred until the end of the
* attributes parsing, since local namespace can be defined as
* an attribute at this level.
*/
ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL, name, NULL);
if (ret == NULL) {
if (prefix != NULL)
xmlFree(prefix);
xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElement");
return;
}
if (ctxt->myDoc->children == NULL) {
#ifdef DEBUG_SAX_TREE
xmlGenericError(xmlGenericErrorContext, "Setting %s as root\n", name);
#endif
xmlAddChild((xmlNodePtr) ctxt->myDoc, (xmlNodePtr) ret);
} else if (parent == NULL) {
parent = ctxt->myDoc->children;
}
ctxt->nodemem = -1;
if (ctxt->linenumbers) {
if (ctxt->input != NULL) {
if (ctxt->input->line < 65535)
ret->line = (short) ctxt->input->line;
else
ret->line = 65535;
}
}
/*
* We are parsing a new node.
*/
#ifdef DEBUG_SAX_TREE
xmlGenericError(xmlGenericErrorContext, "pushing(%s)\n", name);
#endif
nodePush(ctxt, ret);
/*
* Link the child element
*/
if (parent != NULL) {
if (parent->type == XML_ELEMENT_NODE) {
#ifdef DEBUG_SAX_TREE
xmlGenericError(xmlGenericErrorContext,
"adding child %s to %s\n", name, parent->name);
#endif
xmlAddChild(parent, ret);
} else {
#ifdef DEBUG_SAX_TREE
xmlGenericError(xmlGenericErrorContext,
"adding sibling %s to ", name);
xmlDebugDumpOneNode(stderr, parent, 0);
#endif
xmlAddSibling(parent, ret);
}
}
/*
* Insert all the defaulted attributes from the DTD especially namespaces
*/
if ((!ctxt->html) &&
((ctxt->myDoc->intSubset != NULL) ||
(ctxt->myDoc->extSubset != NULL))) {
xmlCheckDefaultedAttributes(ctxt, name, prefix, atts);
}
/*
* process all the attributes whose name start with "xmlns"
*/
if (atts != NULL) {
i = 0;
att = atts[i++];
value = atts[i++];
if (!ctxt->html) {
while ((att != NULL) && (value != NULL)) {
if ((att[0] == 'x') && (att[1] == 'm') && (att[2] == 'l') &&
(att[3] == 'n') && (att[4] == 's'))
xmlSAX2AttributeInternal(ctxt, att, value, prefix);
att = atts[i++];
value = atts[i++];
}
}
}
/*
* Search the namespace, note that since the attributes have been
* processed, the local namespaces are available.
*/
ns = xmlSearchNs(ctxt->myDoc, ret, prefix);
if ((ns == NULL) && (parent != NULL))
ns = xmlSearchNs(ctxt->myDoc, parent, prefix);
if ((prefix != NULL) && (ns == NULL)) {
ns = xmlNewNs(ret, NULL, prefix);
xmlNsWarnMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE,
"Namespace prefix %s is not defined\n",
prefix, NULL);
}
/*
* set the namespace node, making sure that if the default namspace
* is unbound on a parent we simply kee it NULL
*/
if ((ns != NULL) && (ns->href != NULL) &&
((ns->href[0] != 0) || (ns->prefix != NULL)))
xmlSetNs(ret, ns);
/*
* process all the other attributes
*/
if (atts != NULL) {
i = 0;
att = atts[i++];
value = atts[i++];
if (ctxt->html) {
while (att != NULL) {
xmlSAX2AttributeInternal(ctxt, att, value, NULL);
att = atts[i++];
value = atts[i++];
}
} else {
while ((att != NULL) && (value != NULL)) {
if ((att[0] != 'x') || (att[1] != 'm') || (att[2] != 'l') ||
(att[3] != 'n') || (att[4] != 's'))
xmlSAX2AttributeInternal(ctxt, att, value, NULL);
/*
* Next ones
*/
att = atts[i++];
value = atts[i++];
}
}
}
#ifdef LIBXML_VALID_ENABLED
/*
* If it's the Document root, finish the DTD validation and
* check the document root element for validity
*/
if ((ctxt->validate) && (ctxt->vctxt.finishDtd == XML_CTXT_FINISH_DTD_0)) {
int chk;
chk = xmlValidateDtdFinal(&ctxt->vctxt, ctxt->myDoc);
if (chk <= 0)
ctxt->valid = 0;
if (chk < 0)
ctxt->wellFormed = 0;
ctxt->valid &= xmlValidateRoot(&ctxt->vctxt, ctxt->myDoc);
ctxt->vctxt.finishDtd = XML_CTXT_FINISH_DTD_1;
}
#endif /* LIBXML_VALID_ENABLED */
if (prefix != NULL)
xmlFree(prefix);
}
/**
* xmlSAX2EndElement:
* @ctx: the user data (XML parser context)
* @name: The element name
*
* called when the end of an element has been detected.
*/
void
xmlSAX2EndElement(void *ctx, const xmlChar *name ATTRIBUTE_UNUSED)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlParserNodeInfo node_info;
xmlNodePtr cur;
if (ctx == NULL) return;
cur = ctxt->node;
#ifdef DEBUG_SAX
if (name == NULL)
xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2EndElement(NULL)\n");
else
xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2EndElement(%s)\n", name);
#endif
/* Capture end position and add node */
if (cur != NULL && ctxt->record_info) {
node_info.end_pos = ctxt->input->cur - ctxt->input->base;
node_info.end_line = ctxt->input->line;
node_info.node = cur;
xmlParserAddNodeInfo(ctxt, &node_info);
}
ctxt->nodemem = -1;
#ifdef LIBXML_VALID_ENABLED
if (ctxt->validate && ctxt->wellFormed &&
ctxt->myDoc && ctxt->myDoc->intSubset)
ctxt->valid &= xmlValidateOneElement(&ctxt->vctxt, ctxt->myDoc,
cur);
#endif /* LIBXML_VALID_ENABLED */
/*
* end of parsing of this node.
*/
#ifdef DEBUG_SAX_TREE
xmlGenericError(xmlGenericErrorContext, "popping(%s)\n", cur->name);
#endif
nodePop(ctxt);
}
#endif /* LIBXML_HTML_ENABLE */
/*
* xmlSAX2TextNode:
* @ctxt: the parser context

File diff suppressed because it is too large Load Diff

View File

@ -98,15 +98,6 @@ XMLPUBFUN void XMLCALL
xmlSAX2StartDocument (void *ctx);
XMLPUBFUN void XMLCALL
xmlSAX2EndDocument (void *ctx);
#if defined(LIBXML_WRITER_ENABLED)
XMLPUBFUN void XMLCALL
xmlSAX2StartElement (void *ctx,
const xmlChar *fullname,
const xmlChar **atts);
XMLPUBFUN void XMLCALL
xmlSAX2EndElement (void *ctx,
const xmlChar *name);
#endif /* */
XMLPUBFUN void XMLCALL
xmlSAX2StartElementNs (void *ctx,
const xmlChar *localname,

View File

@ -613,7 +613,7 @@ struct _xmlDOMWrapCtxt {
/*
* Some helper functions
*/
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
#if defined(LIBXML_TREE_ENABLED)
XMLPUBFUN int XMLCALL
xmlValidateNCName (const xmlChar *value,
int space);
@ -873,11 +873,11 @@ XMLPUBFUN int XMLCALL
/*
* Changing the structure.
*/
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
#if defined(LIBXML_TREE_ENABLED)
XMLPUBFUN xmlNodePtr XMLCALL
xmlDocSetRootElement (xmlDocPtr doc,
xmlNodePtr root);
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */
#endif /* defined(LIBXML_TREE_ENABLED) */
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN void XMLCALL
xmlNodeSetName (xmlNodePtr cur,
@ -889,11 +889,11 @@ XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr XMLCALL
xmlAddChildList (xmlNodePtr parent,
xmlNodePtr cur);
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
#if defined(LIBXML_TREE_ENABLED)
XMLPUBFUN xmlNodePtr XMLCALL
xmlReplaceNode (xmlNodePtr old,
xmlNodePtr cur);
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */
#endif /* defined(LIBXML_TREE_ENABLED) */
#if defined(LIBXML_TREE_ENABLED)
XMLPUBFUN xmlNodePtr XMLCALL
xmlAddPrevSibling (xmlNodePtr cur,

View File

@ -124,14 +124,6 @@ XMLPUBFUN int XMLCALL
XMLPUBFUN int XMLCALL
xmlTextReaderRead (xmlTextReaderPtr reader);
#ifdef LIBXML_WRITER_ENABLED
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderReadInnerXml (xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderReadOuterXml (xmlTextReaderPtr reader);
#endif
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderReadString (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL

View File

@ -133,15 +133,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#define LIBXML_READER_ENABLED
#endif
/**
* LIBXML_WRITER_ENABLED:
*
* Whether the xmlWriter saving interface is configured in
*/
#if 1
#define LIBXML_WRITER_ENABLED
#endif
/**
* LIBXML_VALID_ENABLED:
*
@ -256,15 +247,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#define LIBXML_MODULE_EXTENSION ""
#endif
/**
* LIBXML_ZLIB_ENABLED:
*
* Whether the Zlib support is compiled in
*/
#if 0
#define LIBXML_ZLIB_ENABLED
#endif
/**
* LIBXML_LZMA_ENABLED:
*

View File

@ -13,473 +13,5 @@
#include <libxml/xmlversion.h>
#ifdef LIBXML_WRITER_ENABLED
#include <stdarg.h>
#include <libxml/xmlIO.h>
#include <libxml/list.h>
#include <libxml/xmlstring.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _xmlTextWriter xmlTextWriter;
typedef xmlTextWriter *xmlTextWriterPtr;
/*
* Constructors & Destructor
*/
XMLPUBFUN xmlTextWriterPtr XMLCALL
xmlNewTextWriter(xmlOutputBufferPtr out);
XMLPUBFUN xmlTextWriterPtr XMLCALL
xmlNewTextWriterFilename(const char *uri, int compression);
XMLPUBFUN xmlTextWriterPtr XMLCALL
xmlNewTextWriterMemory(xmlBufferPtr buf, int compression);
XMLPUBFUN xmlTextWriterPtr XMLCALL
xmlNewTextWriterPushParser(xmlParserCtxtPtr ctxt, int compression);
XMLPUBFUN xmlTextWriterPtr XMLCALL
xmlNewTextWriterDoc(xmlDocPtr * doc, int compression);
XMLPUBFUN xmlTextWriterPtr XMLCALL
xmlNewTextWriterTree(xmlDocPtr doc, xmlNodePtr node,
int compression);
XMLPUBFUN void XMLCALL xmlFreeTextWriter(xmlTextWriterPtr writer);
/*
* Functions
*/
/*
* Document
*/
XMLPUBFUN int XMLCALL
xmlTextWriterStartDocument(xmlTextWriterPtr writer,
const char *version,
const char *encoding,
const char *standalone);
XMLPUBFUN int XMLCALL xmlTextWriterEndDocument(xmlTextWriterPtr
writer);
/*
* Comments
*/
XMLPUBFUN int XMLCALL xmlTextWriterStartComment(xmlTextWriterPtr
writer);
XMLPUBFUN int XMLCALL xmlTextWriterEndComment(xmlTextWriterPtr writer);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatComment(xmlTextWriterPtr writer,
const char *format, ...)
LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatComment(xmlTextWriterPtr writer,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(2,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteComment(xmlTextWriterPtr
writer,
const xmlChar *
content);
/*
* Elements
*/
XMLPUBFUN int XMLCALL
xmlTextWriterStartElement(xmlTextWriterPtr writer,
const xmlChar * name);
XMLPUBFUN int XMLCALL xmlTextWriterStartElementNS(xmlTextWriterPtr
writer,
const xmlChar *
prefix,
const xmlChar * name,
const xmlChar *
namespaceURI);
XMLPUBFUN int XMLCALL xmlTextWriterEndElement(xmlTextWriterPtr writer);
XMLPUBFUN int XMLCALL xmlTextWriterFullEndElement(xmlTextWriterPtr
writer);
/*
* Elements conveniency functions
*/
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatElement(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format, ...)
LIBXML_ATTR_FORMAT(3,4);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatElement(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(3,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteElement(xmlTextWriterPtr
writer,
const xmlChar * name,
const xmlChar *
content);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatElementNS(xmlTextWriterPtr writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI,
const char *format, ...)
LIBXML_ATTR_FORMAT(5,6);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatElementNS(xmlTextWriterPtr writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(5,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteElementNS(xmlTextWriterPtr
writer,
const xmlChar *
prefix,
const xmlChar * name,
const xmlChar *
namespaceURI,
const xmlChar *
content);
/*
* Text
*/
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatRaw(xmlTextWriterPtr writer,
const char *format, ...)
LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatRaw(xmlTextWriterPtr writer,
const char *format, va_list argptr)
LIBXML_ATTR_FORMAT(2,0);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteRawLen(xmlTextWriterPtr writer,
const xmlChar * content, int len);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteRaw(xmlTextWriterPtr writer,
const xmlChar * content);
XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatString(xmlTextWriterPtr
writer,
const char
*format, ...)
LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatString(xmlTextWriterPtr
writer,
const char
*format,
va_list argptr)
LIBXML_ATTR_FORMAT(2,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteString(xmlTextWriterPtr writer,
const xmlChar *
content);
XMLPUBFUN int XMLCALL xmlTextWriterWriteBase64(xmlTextWriterPtr writer,
const char *data,
int start, int len);
XMLPUBFUN int XMLCALL xmlTextWriterWriteBinHex(xmlTextWriterPtr writer,
const char *data,
int start, int len);
/*
* Attributes
*/
XMLPUBFUN int XMLCALL
xmlTextWriterStartAttribute(xmlTextWriterPtr writer,
const xmlChar * name);
XMLPUBFUN int XMLCALL xmlTextWriterStartAttributeNS(xmlTextWriterPtr
writer,
const xmlChar *
prefix,
const xmlChar *
name,
const xmlChar *
namespaceURI);
XMLPUBFUN int XMLCALL xmlTextWriterEndAttribute(xmlTextWriterPtr
writer);
/*
* Attributes conveniency functions
*/
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatAttribute(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format, ...)
LIBXML_ATTR_FORMAT(3,4);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatAttribute(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(3,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteAttribute(xmlTextWriterPtr
writer,
const xmlChar * name,
const xmlChar *
content);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatAttributeNS(xmlTextWriterPtr writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI,
const char *format, ...)
LIBXML_ATTR_FORMAT(5,6);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatAttributeNS(xmlTextWriterPtr writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(5,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteAttributeNS(xmlTextWriterPtr
writer,
const xmlChar *
prefix,
const xmlChar *
name,
const xmlChar *
namespaceURI,
const xmlChar *
content);
/*
* PI's
*/
XMLPUBFUN int XMLCALL
xmlTextWriterStartPI(xmlTextWriterPtr writer,
const xmlChar * target);
XMLPUBFUN int XMLCALL xmlTextWriterEndPI(xmlTextWriterPtr writer);
/*
* PI conveniency functions
*/
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatPI(xmlTextWriterPtr writer,
const xmlChar * target,
const char *format, ...)
LIBXML_ATTR_FORMAT(3,4);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatPI(xmlTextWriterPtr writer,
const xmlChar * target,
const char *format, va_list argptr)
LIBXML_ATTR_FORMAT(3,0);
XMLPUBFUN int XMLCALL
xmlTextWriterWritePI(xmlTextWriterPtr writer,
const xmlChar * target,
const xmlChar * content);
/**
* xmlTextWriterWriteProcessingInstruction:
*
* This macro maps to xmlTextWriterWritePI
*/
#define xmlTextWriterWriteProcessingInstruction xmlTextWriterWritePI
/*
* CDATA
*/
XMLPUBFUN int XMLCALL xmlTextWriterStartCDATA(xmlTextWriterPtr writer);
XMLPUBFUN int XMLCALL xmlTextWriterEndCDATA(xmlTextWriterPtr writer);
/*
* CDATA conveniency functions
*/
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatCDATA(xmlTextWriterPtr writer,
const char *format, ...)
LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatCDATA(xmlTextWriterPtr writer,
const char *format, va_list argptr)
LIBXML_ATTR_FORMAT(2,0);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteCDATA(xmlTextWriterPtr writer,
const xmlChar * content);
/*
* DTD
*/
XMLPUBFUN int XMLCALL
xmlTextWriterStartDTD(xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid);
XMLPUBFUN int XMLCALL xmlTextWriterEndDTD(xmlTextWriterPtr writer);
/*
* DTD conveniency functions
*/
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatDTD(xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid,
const char *format, ...)
LIBXML_ATTR_FORMAT(5,6);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatDTD(xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid,
const char *format, va_list argptr)
LIBXML_ATTR_FORMAT(5,0);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteDTD(xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid,
const xmlChar * subset);
/**
* xmlTextWriterWriteDocType:
*
* this macro maps to xmlTextWriterWriteDTD
*/
#define xmlTextWriterWriteDocType xmlTextWriterWriteDTD
/*
* DTD element definition
*/
XMLPUBFUN int XMLCALL
xmlTextWriterStartDTDElement(xmlTextWriterPtr writer,
const xmlChar * name);
XMLPUBFUN int XMLCALL xmlTextWriterEndDTDElement(xmlTextWriterPtr
writer);
/*
* DTD element definition conveniency functions
*/
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatDTDElement(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format, ...)
LIBXML_ATTR_FORMAT(3,4);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatDTDElement(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(3,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDElement(xmlTextWriterPtr
writer,
const xmlChar *
name,
const xmlChar *
content);
/*
* DTD attribute list definition
*/
XMLPUBFUN int XMLCALL
xmlTextWriterStartDTDAttlist(xmlTextWriterPtr writer,
const xmlChar * name);
XMLPUBFUN int XMLCALL xmlTextWriterEndDTDAttlist(xmlTextWriterPtr
writer);
/*
* DTD attribute list definition conveniency functions
*/
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatDTDAttlist(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format, ...)
LIBXML_ATTR_FORMAT(3,4);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatDTDAttlist(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(3,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDAttlist(xmlTextWriterPtr
writer,
const xmlChar *
name,
const xmlChar *
content);
/*
* DTD entity definition
*/
XMLPUBFUN int XMLCALL
xmlTextWriterStartDTDEntity(xmlTextWriterPtr writer,
int pe, const xmlChar * name);
XMLPUBFUN int XMLCALL xmlTextWriterEndDTDEntity(xmlTextWriterPtr
writer);
/*
* DTD entity definition conveniency functions
*/
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatDTDInternalEntity(xmlTextWriterPtr writer,
int pe,
const xmlChar * name,
const char *format, ...)
LIBXML_ATTR_FORMAT(4,5);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatDTDInternalEntity(xmlTextWriterPtr writer,
int pe,
const xmlChar * name,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(4,0);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteDTDInternalEntity(xmlTextWriterPtr writer,
int pe,
const xmlChar * name,
const xmlChar * content);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteDTDExternalEntity(xmlTextWriterPtr writer,
int pe,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid,
const xmlChar * ndataid);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteDTDExternalEntityContents(xmlTextWriterPtr
writer,
const xmlChar * pubid,
const xmlChar * sysid,
const xmlChar *
ndataid);
XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDEntity(xmlTextWriterPtr
writer, int pe,
const xmlChar * name,
const xmlChar *
pubid,
const xmlChar *
sysid,
const xmlChar *
ndataid,
const xmlChar *
content);
/*
* DTD notation definition
*/
XMLPUBFUN int XMLCALL
xmlTextWriterWriteDTDNotation(xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid);
/*
* Indentation
*/
XMLPUBFUN int XMLCALL
xmlTextWriterSetIndent(xmlTextWriterPtr writer, int indent);
XMLPUBFUN int XMLCALL
xmlTextWriterSetIndentString(xmlTextWriterPtr writer,
const xmlChar * str);
/*
* misc
*/
XMLPUBFUN int XMLCALL xmlTextWriterFlush(xmlTextWriterPtr writer);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_WRITER_ENABLED */
#endif /* __XML_XMLWRITER_H__ */

View File

@ -793,11 +793,7 @@ xmlHasFeature(xmlFeature feature)
case XML_WITH_PATTERN:
return(0);
case XML_WITH_WRITER:
#ifdef LIBXML_WRITER_ENABLED
return(1);
#else
return(0);
#endif
case XML_WITH_SAX1:
return(0);
case XML_WITH_FTP:
@ -889,11 +885,7 @@ xmlHasFeature(xmlFeature feature)
return(0);
#endif
case XML_WITH_ZLIB:
#ifdef LIBXML_ZLIB_ENABLED
return(1);
#else
return(0);
#endif
case XML_WITH_LZMA:
#ifdef LIBXML_LZMA_ENABLED
return(1);

View File

@ -343,7 +343,7 @@ xmlSplitQName3(const xmlChar *name, int *len) {
#define CUR_SCHAR(s, l) xmlStringCurrentChar(NULL, s, &l)
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
#if defined(LIBXML_TREE_ENABLED)
/**
* xmlValidateNCName:
* @value: the value to check
@ -3781,7 +3781,7 @@ xmlUnlinkNode(xmlNodePtr cur) {
cur->next = cur->prev = NULL;
}
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
#if defined(LIBXML_TREE_ENABLED)
/**
* xmlReplaceNode:
* @old: the old node
@ -4781,7 +4781,7 @@ xmlDocGetRootElement(xmlDocPtr doc) {
return(ret);
}
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
#if defined(LIBXML_TREE_ENABLED)
/**
* xmlDocSetRootElement:
* @doc: the document

View File

@ -1497,97 +1497,6 @@ xmlTextReaderNext(xmlTextReaderPtr reader) {
return(xmlTextReaderRead(reader));
}
#ifdef LIBXML_WRITER_ENABLED
/**
* xmlTextReaderReadInnerXml:
* @reader: the xmlTextReaderPtr used
*
* Reads the contents of the current node, including child nodes and markup.
*
* Returns a string containing the XML content, or NULL if the current node
* is neither an element nor attribute, or has no child nodes. The
* string must be deallocated by the caller.
*/
xmlChar *
xmlTextReaderReadInnerXml(xmlTextReaderPtr reader ATTRIBUTE_UNUSED)
{
xmlChar *resbuf;
xmlNodePtr node, cur_node;
xmlBufferPtr buff, buff2;
xmlDocPtr doc;
if (xmlTextReaderExpand(reader) == NULL) {
return NULL;
}
doc = reader->doc;
buff = xmlBufferCreate();
for (cur_node = reader->node->children; cur_node != NULL;
cur_node = cur_node->next) {
node = xmlDocCopyNode(cur_node, doc, 1);
buff2 = xmlBufferCreate();
if (xmlNodeDump(buff2, doc, node, 0, 0) == -1) {
xmlFreeNode(node);
xmlBufferFree(buff2);
xmlBufferFree(buff);
return NULL;
}
xmlBufferCat(buff, buff2->content);
xmlFreeNode(node);
xmlBufferFree(buff2);
}
resbuf = buff->content;
buff->content = NULL;
xmlBufferFree(buff);
return resbuf;
}
#endif
#ifdef LIBXML_WRITER_ENABLED
/**
* xmlTextReaderReadOuterXml:
* @reader: the xmlTextReaderPtr used
*
* Reads the contents of the current node, including child nodes and markup.
*
* Returns a string containing the node and any XML content, or NULL if the
* current node cannot be serialized. The string must be deallocated
* by the caller.
*/
xmlChar *
xmlTextReaderReadOuterXml(xmlTextReaderPtr reader ATTRIBUTE_UNUSED)
{
xmlChar *resbuf;
xmlNodePtr node;
xmlBufferPtr buff;
xmlDocPtr doc;
node = reader->node;
doc = reader->doc;
if (xmlTextReaderExpand(reader) == NULL) {
return NULL;
}
if (node->type == XML_DTD_NODE) {
node = (xmlNodePtr) xmlCopyDtd((xmlDtdPtr) node);
} else {
node = xmlDocCopyNode(node, doc, 1);
}
buff = xmlBufferCreate();
if (xmlNodeDump(buff, doc, node, 0, 0) == -1) {
xmlFreeNode(node);
xmlBufferFree(buff);
return NULL;
}
resbuf = buff->content;
buff->content = NULL;
xmlFreeNode(node);
xmlBufferFree(buff);
return resbuf;
}
#endif
/**
* xmlTextReaderReadString:
* @reader: the xmlTextReaderPtr used

File diff suppressed because it is too large Load Diff