ReactOS  0.4.14-dev-98-gb0d4763
valid.c File Reference
#include "libxml.h"
#include <string.h>
#include <stdlib.h>
#include <libxml/xmlmemory.h>
#include <libxml/hash.h>
#include <libxml/uri.h>
#include <libxml/valid.h>
#include <libxml/parser.h>
#include <libxml/parserInternals.h>
#include <libxml/xmlerror.h>
#include <libxml/list.h>
#include <libxml/globals.h>
#include "elfgcchack.h"
Include dependency graph for valid.c:

Go to the source code of this file.

Classes

struct  xmlRemoveMemo_t
 
struct  xmlValidateMemo_t
 

Macros

#define IN_LIBXML
 
#define TODO
 

Functions

static void xmlVErrMemory (xmlValidCtxtPtr ctxt, const char *extra)
 
static void LIBXML_ATTR_FORMAT (3, 0)
 
: the subelement name or NULL

xmlNewElementContent:

@type: the type of element content decl

Allocate an element content structure. Deprecated in favor of xmlNewDocElementContent

Returns NULL if not, otherwise the new element content structure

xmlElementContentPtr xmlNewDocElementContent (xmlDocPtr doc, const xmlChar *name, xmlElementContentType type)
 
xmlElementContentPtr xmlNewElementContent (const xmlChar *name, xmlElementContentType type)
 
xmlElementContentPtr xmlCopyDocElementContent (xmlDocPtr doc, xmlElementContentPtr cur)
 
xmlElementContentPtr xmlCopyElementContent (xmlElementContentPtr cur)
 
void xmlFreeDocElementContent (xmlDocPtr doc, xmlElementContentPtr cur)
 
void xmlFreeElementContent (xmlElementContentPtr cur)
 
void xmlSnprintfElementContent (char *buf, int size, xmlElementContentPtr content, int englob)
 
static void xmlFreeElement (xmlElementPtr elem)
 
: the enumeration name or NULL

xmlCreateEnumeration:

create and initialize an enumeration attribute node.

Returns the xmlEnumerationPtr just created or NULL in case of error.

xmlEnumerationPtr xmlCreateEnumeration (const xmlChar *name)
 
void xmlFreeEnumeration (xmlEnumerationPtr cur)
 
static void xmlFreeAttribute (xmlAttributePtr attr)
 
: the attribute name

xmlGetDtdQAttrDesc: @dtd: a pointer to the DtD to search @elem: the element name

@prefix: the attribute namespace prefix

Search the DTD for the description of this qualified attribute on this element.

returns the xmlAttributePtr if found or NULL

xmlAttributePtr xmlAddAttributeDecl (xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name, const xmlChar *ns, xmlAttributeType type, xmlAttributeDefault def, const xmlChar *defaultValue, xmlEnumerationPtr tree)
 
static void xmlFreeAttributeTableEntry (void *attr, const xmlChar *name ATTRIBUTE_UNUSED)
 
void xmlFreeAttributeTable (xmlAttributeTablePtr table)
 
static void xmlFreeNotation (xmlNotationPtr nota)
 
xmlAttributePtr xmlGetDtdAttrDesc (xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name)
 
xmlAttributePtr xmlGetDtdQAttrDesc (xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name, const xmlChar *prefix)
 
: the notation name

xmlGetDtdNotationDesc: @dtd: a pointer to the DtD to search

Search the DTD for the description of this notation

returns the xmlNotationPtr if found or NULL

xmlNotationPtr xmlGetDtdNotationDesc (xmlDtdPtr dtd, const xmlChar *name)
 

: the entity name

xmlAddNotationDecl: @dtd: pointer to the DTD @ctxt: the validation context

@PublicID: the public identifier or NULL @SystemID: the system identifier or NULL

Register a new notation declaration

Returns NULL if not, otherwise the entity

#define DICT_FREE(str)
 
typedef struct xmlRemoveMemo_t xmlRemoveMemo
 
typedef xmlRemoveMemoxmlRemoveMemoPtr
 
typedef struct xmlValidateMemo_t xmlValidateMemo
 
typedef xmlValidateMemoxmlValidateMemoPtr
 
xmlElementPtr xmlAddElementDecl (xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *name, xmlElementTypeVal type, xmlElementContentPtr content)
 
static void xmlFreeElementTableEntry (void *elem, const xmlChar *name ATTRIBUTE_UNUSED)
 
void xmlFreeElementTable (xmlElementTablePtr table)
 
xmlNotationPtr xmlAddNotationDecl (xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *name, const xmlChar *PublicID, const xmlChar *SystemID)
 
static void xmlFreeNotationTableEntry (void *nota, const xmlChar *name ATTRIBUTE_UNUSED)
 
void xmlFreeNotationTable (xmlNotationTablePtr table)
 
static void xmlFreeID (xmlIDPtr id)
 
xmlIDPtr xmlAddID (xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value, xmlAttrPtr attr)
 
static void xmlFreeIDTableEntry (void *id, const xmlChar *name ATTRIBUTE_UNUSED)
 
void xmlFreeIDTable (xmlIDTablePtr table)
 
int xmlIsID (xmlDocPtr doc, xmlNodePtr elem, xmlAttrPtr attr)
 
int xmlRemoveID (xmlDocPtr doc, xmlAttrPtr attr)
 
xmlAttrPtr xmlGetID (xmlDocPtr doc, const xmlChar *ID)
 
static void xmlFreeRef (xmlLinkPtr lk)
 
static void xmlFreeRefTableEntry (void *payload, const xmlChar *name ATTRIBUTE_UNUSED)
 
static int xmlWalkRemoveRef (const void *data, void *user)
 
static int xmlDummyCompare (const void *data0 ATTRIBUTE_UNUSED, const void *data1 ATTRIBUTE_UNUSED)
 
xmlRefPtr xmlAddRef (xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value, xmlAttrPtr attr)
 
void xmlFreeRefTable (xmlRefTablePtr table)
 
int xmlIsRef (xmlDocPtr doc, xmlNodePtr elem, xmlAttrPtr attr)
 
int xmlRemoveRef (xmlDocPtr doc, xmlAttrPtr attr)
 
xmlListPtr xmlGetRefs (xmlDocPtr doc, const xmlChar *ID)
 

: the element name

xmlIsMixedElement: @doc: the document

Search in the DtDs whether an element accept Mixed content (or ANY) basically if it is supposed to accept text childs

returns 0 if no, 1 if yes, and -1 if no element description is available

#define bottom_valid
 
static xmlElementPtr xmlGetDtdElementDesc2 (xmlDtdPtr dtd, const xmlChar *name, int create)
 
xmlElementPtr xmlGetDtdElementDesc (xmlDtdPtr dtd, const xmlChar *name)
 
xmlElementPtr xmlGetDtdQElementDesc (xmlDtdPtr dtd, const xmlChar *name, const xmlChar *prefix)
 
int xmlIsMixedElement (xmlDocPtr doc, const xmlChar *name)
 

Macro Definition Documentation

◆ bottom_valid

#define bottom_valid

Definition at line 7095 of file valid.c.

◆ DICT_FREE

#define DICT_FREE (   str)
Value:
if ((str) && ((!dict) || \
(xmlDictOwns(dict, (const xmlChar *)(str)) == 0))) \
xmlFree((char *)(str));
const WCHAR * str
unsigned char xmlChar
Definition: xmlstring.h:28
XMLPUBFUN int XMLCALL xmlDictOwns(xmlDictPtr dict, const xmlChar *str)
Definition: dict.c:1211

DICT_FREE: @str: a string

Free a string if it is not owned by the "dict" dictionary in the current scope

Definition at line 2562 of file valid.c.

◆ IN_LIBXML

#define IN_LIBXML

Definition at line 10 of file valid.c.

◆ TODO

#define TODO
Value:
"Unimplemented block at %s:%d\n", \
__FILE__, __LINE__);
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362

Definition at line 34 of file valid.c.

Typedef Documentation

◆ xmlRemoveMemo

◆ xmlRemoveMemoPtr

Definition at line 2843 of file valid.c.

◆ xmlValidateMemo

◆ xmlValidateMemoPtr

Definition at line 2851 of file valid.c.

Function Documentation

◆ LIBXML_ATTR_FORMAT()

static void LIBXML_ATTR_FORMAT ( ,
 
)
static

xmlErrValid: @ctxt: an XML validation parser context @error: the error number @extra: extra informations

Handle a validation error

Definition at line 96 of file valid.c.

99 {
100  xmlGenericErrorFunc channel = NULL;
101  xmlParserCtxtPtr pctxt = NULL;
102  void *data = NULL;
103 
104  if (ctxt != NULL) {
105  channel = ctxt->error;
106  data = ctxt->userData;
107  /* Use the special values to detect if it is part of a parsing
108  context */
109  if ((ctxt->finishDtd == XML_CTXT_FINISH_DTD_0) ||
110  (ctxt->finishDtd == XML_CTXT_FINISH_DTD_1)) {
111  long delta = (char *) ctxt - (char *) ctxt->userData;
112  if ((delta > 0) && (delta < 250))
113  pctxt = ctxt->userData;
114  }
115  }
116  if (extra)
117  __xmlRaiseError(NULL, channel, data,
118  pctxt, NULL, XML_FROM_VALID, error,
119  XML_ERR_ERROR, NULL, 0, extra, NULL, NULL, 0, 0,
120  msg, extra);
121  else
122  __xmlRaiseError(NULL, channel, data,
123  pctxt, NULL, XML_FROM_VALID, error,
124  XML_ERR_ERROR, NULL, 0, NULL, NULL, NULL, 0, 0,
125  "%s", msg);
126 }
#define error(str)
Definition: mkdosfs.c:1605
smooth NULL
Definition: ftsmooth.c:416
Definition: id3.c:18
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define msg(x)
Definition: auth_time.c:54
void(XMLCDECL * xmlGenericErrorFunc)(void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
Definition: xmlerror.h:845
void * userData
Definition: parser.h:186

◆ xmlAddAttributeDecl()

xmlAttributePtr xmlAddAttributeDecl ( xmlValidCtxtPtr  ctxt,
xmlDtdPtr  dtd,
const xmlChar elem,
const xmlChar name,
const xmlChar ns,
xmlAttributeType  type,
xmlAttributeDefault  def,
const xmlChar defaultValue,
xmlEnumerationPtr  tree 
)

Definition at line 1938 of file valid.c.

1942  {
1945  xmlElementPtr elemDef;
1946  xmlDictPtr dict = NULL;
1947 
1948  if (dtd == NULL) {
1950  return(NULL);
1951  }
1952  if (name == NULL) {
1954  return(NULL);
1955  }
1956  if (elem == NULL) {
1958  return(NULL);
1959  }
1960  if (dtd->doc != NULL)
1961  dict = dtd->doc->dict;
1962 
1963 #ifdef LIBXML_VALID_ENABLED
1964  /*
1965  * Check the type and possibly the default value.
1966  */
1967  switch (type) {
1968  case XML_ATTRIBUTE_CDATA:
1969  break;
1970  case XML_ATTRIBUTE_ID:
1971  break;
1972  case XML_ATTRIBUTE_IDREF:
1973  break;
1974  case XML_ATTRIBUTE_IDREFS:
1975  break;
1976  case XML_ATTRIBUTE_ENTITY:
1977  break;
1979  break;
1980  case XML_ATTRIBUTE_NMTOKEN:
1981  break;
1983  break;
1985  break;
1987  break;
1988  default:
1989  xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR,
1990  "Internal: ATTRIBUTE struct corrupted invalid type\n",
1991  NULL);
1993  return(NULL);
1994  }
1995  if ((defaultValue != NULL) &&
1996  (!xmlValidateAttributeValueInternal(dtd->doc, type, defaultValue))) {
1997  xmlErrValidNode(ctxt, (xmlNodePtr) dtd, XML_DTD_ATTRIBUTE_DEFAULT,
1998  "Attribute %s of %s: invalid default value\n",
1999  elem, name, defaultValue);
2000  defaultValue = NULL;
2001  if (ctxt != NULL)
2002  ctxt->valid = 0;
2003  }
2004 #endif /* LIBXML_VALID_ENABLED */
2005 
2006  /*
2007  * Check first that an attribute defined in the external subset wasn't
2008  * already defined in the internal subset
2009  */
2010  if ((dtd->doc != NULL) && (dtd->doc->extSubset == dtd) &&
2011  (dtd->doc->intSubset != NULL) &&
2012  (dtd->doc->intSubset->attributes != NULL)) {
2013  ret = xmlHashLookup3(dtd->doc->intSubset->attributes, name, ns, elem);
2014  if (ret != NULL) {
2016  return(NULL);
2017  }
2018  }
2019 
2020  /*
2021  * Create the Attribute table if needed.
2022  */
2024  if (table == NULL) {
2025  table = xmlHashCreateDict(0, dict);
2026  dtd->attributes = (void *) table;
2027  }
2028  if (table == NULL) {
2029  xmlVErrMemory(ctxt,
2030  "xmlAddAttributeDecl: Table creation failed!\n");
2032  return(NULL);
2033  }
2034 
2035 
2037  if (ret == NULL) {
2038  xmlVErrMemory(ctxt, "malloc failed");
2040  return(NULL);
2041  }
2042  memset(ret, 0, sizeof(xmlAttribute));
2043  ret->type = XML_ATTRIBUTE_DECL;
2044 
2045  /*
2046  * fill the structure.
2047  */
2048  ret->atype = type;
2049  /*
2050  * doc must be set before possible error causes call
2051  * to xmlFreeAttribute (because it's used to check on
2052  * dict use)
2053  */
2054  ret->doc = dtd->doc;
2055  if (dict) {
2056  ret->name = xmlDictLookup(dict, name, -1);
2057  ret->prefix = xmlDictLookup(dict, ns, -1);
2058  ret->elem = xmlDictLookup(dict, elem, -1);
2059  } else {
2060  ret->name = xmlStrdup(name);
2061  ret->prefix = xmlStrdup(ns);
2062  ret->elem = xmlStrdup(elem);
2063  }
2064  ret->def = def;
2065  ret->tree = tree;
2066  if (defaultValue != NULL) {
2067  if (dict)
2068  ret->defaultValue = xmlDictLookup(dict, defaultValue, -1);
2069  else
2070  ret->defaultValue = xmlStrdup(defaultValue);
2071  }
2072 
2073  /*
2074  * Validity Check:
2075  * Search the DTD for previous declarations of the ATTLIST
2076  */
2077  if (xmlHashAddEntry3(table, ret->name, ret->prefix, ret->elem, ret) < 0) {
2078 #ifdef LIBXML_VALID_ENABLED
2079  /*
2080  * The attribute is already defined in this DTD.
2081  */
2082  xmlErrValidWarning(ctxt, (xmlNodePtr) dtd, XML_DTD_ATTRIBUTE_REDEFINED,
2083  "Attribute %s of element %s: already defined\n",
2084  name, elem, NULL);
2085 #endif /* LIBXML_VALID_ENABLED */
2087  return(NULL);
2088  }
2089 
2090  /*
2091  * Validity Check:
2092  * Multiple ID per element
2093  */
2094  elemDef = xmlGetDtdElementDesc2(dtd, elem, 1);
2095  if (elemDef != NULL) {
2096 
2097 #ifdef LIBXML_VALID_ENABLED
2098  if ((type == XML_ATTRIBUTE_ID) &&
2099  (xmlScanIDAttributeDecl(NULL, elemDef, 1) != 0)) {
2100  xmlErrValidNode(ctxt, (xmlNodePtr) dtd, XML_DTD_MULTIPLE_ID,
2101  "Element %s has too may ID attributes defined : %s\n",
2102  elem, name, NULL);
2103  if (ctxt != NULL)
2104  ctxt->valid = 0;
2105  }
2106 #endif /* LIBXML_VALID_ENABLED */
2107 
2108  /*
2109  * Insert namespace default def first they need to be
2110  * processed first.
2111  */
2112  if ((xmlStrEqual(ret->name, BAD_CAST "xmlns")) ||
2113  ((ret->prefix != NULL &&
2114  (xmlStrEqual(ret->prefix, BAD_CAST "xmlns"))))) {
2115  ret->nexth = elemDef->attributes;
2116  elemDef->attributes = ret;
2117  } else {
2118  xmlAttributePtr tmp = elemDef->attributes;
2119 
2120  while ((tmp != NULL) &&
2121  ((xmlStrEqual(tmp->name, BAD_CAST "xmlns")) ||
2122  ((ret->prefix != NULL &&
2123  (xmlStrEqual(ret->prefix, BAD_CAST "xmlns")))))) {
2124  if (tmp->nexth == NULL)
2125  break;
2126  tmp = tmp->nexth;
2127  }
2128  if (tmp != NULL) {
2129  ret->nexth = tmp->nexth;
2130  tmp->nexth = ret;
2131  } else {
2132  ret->nexth = elemDef->attributes;
2133  elemDef->attributes = ret;
2134  }
2135  }
2136  }
2137 
2138  /*
2139  * Link it to the DTD
2140  */
2141  ret->parent = dtd;
2142  if (dtd->last == NULL) {
2143  dtd->children = dtd->last = (xmlNodePtr) ret;
2144  } else {
2145  dtd->last->next = (xmlNodePtr) ret;
2146  ret->prev = dtd->last;
2147  dtd->last = (xmlNodePtr) ret;
2148  }
2149  return(ret);
2150 }
XMLPUBFUN int XMLCALL xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, void *userdata)
Definition: hash.c:529
struct _xmlDoc * doc
Definition: tree.h:415
struct _tree tree
void xmlFreeEnumeration(xmlEnumerationPtr cur)
Definition: valid.c:1788
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
static void xmlVErrMemory(xmlValidCtxtPtr ctxt, const char *extra)
Definition: valid.c:58
const xmlChar * name
Definition: tree.h:256
void * attributes
Definition: tree.h:420
static size_t elem
Definition: string.c:68
smooth NULL
Definition: ftsmooth.c:416
xmlAttributeTable * xmlAttributeTablePtr
Definition: valid.h:134
xmlNode * xmlNodePtr
Definition: tree.h:488
#define BAD_CAST
Definition: xmlstring.h:35
XMLPUBFUN void *XMLCALL xmlHashLookup3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3)
Definition: hash.c:767
xmlAttributePtr attributes
Definition: tree.h:359
if(!(yy_init))
Definition: macro.lex.yy.c:714
struct _xmlNode * last
Definition: tree.h:411
XMLPUBFUN const xmlChar *XMLCALL xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len)
Definition: dict.c:858
Definition: tree.h:489
int ret
Definition: mxnamespace.c:44
static void xmlFreeAttribute(xmlAttributePtr attr)
Definition: valid.c:1885
xmlAttribute * xmlAttributePtr
Definition: tree.h:252
struct _xmlNode * children
Definition: tree.h:410
static xmlElementPtr xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *name, int create)
Definition: valid.c:3206
__XML_EXTERNC typedef xmlDict * xmlDictPtr
Definition: dict.h:24
struct _xmlAttribute * nexth
Definition: tree.h:264
XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreateDict(int size, xmlDictPtr dict)
Definition: hash.c:208
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
Definition: name.c:36
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:157
int valid
Definition: valid.h:95
#define memset(x, y, z)
Definition: compat.h:39
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:66

Referenced by xmlSAX2AttributeDecl().

◆ xmlAddElementDecl()

xmlElementPtr xmlAddElementDecl ( xmlValidCtxtPtr  ctxt,
xmlDtdPtr  dtd,
const xmlChar name,
xmlElementTypeVal  type,
xmlElementContentPtr  content 
)

Definition at line 1387 of file valid.c.

1390  {
1393  xmlAttributePtr oldAttributes = NULL;
1394  xmlChar *ns, *uqname;
1395 
1396  if (dtd == NULL) {
1397  return(NULL);
1398  }
1399  if (name == NULL) {
1400  return(NULL);
1401  }
1402 
1403  switch (type) {
1405  if (content != NULL) {
1406  xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR,
1407  "xmlAddElementDecl: content != NULL for EMPTY\n",
1408  NULL);
1409  return(NULL);
1410  }
1411  break;
1412  case XML_ELEMENT_TYPE_ANY:
1413  if (content != NULL) {
1414  xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR,
1415  "xmlAddElementDecl: content != NULL for ANY\n",
1416  NULL);
1417  return(NULL);
1418  }
1419  break;
1421  if (content == NULL) {
1422  xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR,
1423  "xmlAddElementDecl: content == NULL for MIXED\n",
1424  NULL);
1425  return(NULL);
1426  }
1427  break;
1429  if (content == NULL) {
1430  xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR,
1431  "xmlAddElementDecl: content == NULL for ELEMENT\n",
1432  NULL);
1433  return(NULL);
1434  }
1435  break;
1436  default:
1437  xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR,
1438  "Internal: ELEMENT decl corrupted invalid type\n",
1439  NULL);
1440  return(NULL);
1441  }
1442 
1443  /*
1444  * check if name is a QName
1445  */
1446  uqname = xmlSplitQName2(name, &ns);
1447  if (uqname != NULL)
1448  name = uqname;
1449 
1450  /*
1451  * Create the Element table if needed.
1452  */
1454  if (table == NULL) {
1455  xmlDictPtr dict = NULL;
1456 
1457  if (dtd->doc != NULL)
1458  dict = dtd->doc->dict;
1459  table = xmlHashCreateDict(0, dict);
1460  dtd->elements = (void *) table;
1461  }
1462  if (table == NULL) {
1463  xmlVErrMemory(ctxt,
1464  "xmlAddElementDecl: Table creation failed!\n");
1465  if (uqname != NULL)
1466  xmlFree(uqname);
1467  if (ns != NULL)
1468  xmlFree(ns);
1469  return(NULL);
1470  }
1471 
1472  /*
1473  * lookup old attributes inserted on an undefined element in the
1474  * internal subset.
1475  */
1476  if ((dtd->doc != NULL) && (dtd->doc->intSubset != NULL)) {
1477  ret = xmlHashLookup2(dtd->doc->intSubset->elements, name, ns);
1478  if ((ret != NULL) && (ret->etype == XML_ELEMENT_TYPE_UNDEFINED)) {
1479  oldAttributes = ret->attributes;
1480  ret->attributes = NULL;
1481  xmlHashRemoveEntry2(dtd->doc->intSubset->elements, name, ns, NULL);
1483  }
1484  }
1485 
1486  /*
1487  * The element may already be present if one of its attribute
1488  * was registered first
1489  */
1491  if (ret != NULL) {
1492  if (ret->etype != XML_ELEMENT_TYPE_UNDEFINED) {
1493 #ifdef LIBXML_VALID_ENABLED
1494  /*
1495  * The element is already defined in this DTD.
1496  */
1497  xmlErrValidNode(ctxt, (xmlNodePtr) dtd, XML_DTD_ELEM_REDEFINED,
1498  "Redefinition of element %s\n",
1499  name, NULL, NULL);
1500 #endif /* LIBXML_VALID_ENABLED */
1501  if (uqname != NULL)
1502  xmlFree(uqname);
1503  if (ns != NULL)
1504  xmlFree(ns);
1505  return(NULL);
1506  }
1507  if (ns != NULL) {
1508  xmlFree(ns);
1509  ns = NULL;
1510  }
1511  } else {
1512  ret = (xmlElementPtr) xmlMalloc(sizeof(xmlElement));
1513  if (ret == NULL) {
1514  xmlVErrMemory(ctxt, "malloc failed");
1515  if (uqname != NULL)
1516  xmlFree(uqname);
1517  if (ns != NULL)
1518  xmlFree(ns);
1519  return(NULL);
1520  }
1521  memset(ret, 0, sizeof(xmlElement));
1522  ret->type = XML_ELEMENT_DECL;
1523 
1524  /*
1525  * fill the structure.
1526  */
1527  ret->name = xmlStrdup(name);
1528  if (ret->name == NULL) {
1529  xmlVErrMemory(ctxt, "malloc failed");
1530  if (uqname != NULL)
1531  xmlFree(uqname);
1532  if (ns != NULL)
1533  xmlFree(ns);
1534  xmlFree(ret);
1535  return(NULL);
1536  }
1537  ret->prefix = ns;
1538 
1539  /*
1540  * Validity Check:
1541  * Insertion must not fail
1542  */
1543  if (xmlHashAddEntry2(table, name, ns, ret)) {
1544 #ifdef LIBXML_VALID_ENABLED
1545  /*
1546  * The element is already defined in this DTD.
1547  */
1548  xmlErrValidNode(ctxt, (xmlNodePtr) dtd, XML_DTD_ELEM_REDEFINED,
1549  "Redefinition of element %s\n",
1550  name, NULL, NULL);
1551 #endif /* LIBXML_VALID_ENABLED */
1553  if (uqname != NULL)
1554  xmlFree(uqname);
1555  return(NULL);
1556  }
1557  /*
1558  * For new element, may have attributes from earlier
1559  * definition in internal subset
1560  */
1561  ret->attributes = oldAttributes;
1562  }
1563 
1564  /*
1565  * Finish to fill the structure.
1566  */
1567  ret->etype = type;
1568  /*
1569  * Avoid a stupid copy when called by the parser
1570  * and flag it by setting a special parent value
1571  * so the parser doesn't unallocate it.
1572  */
1573  if ((ctxt != NULL) &&
1574  ((ctxt->finishDtd == XML_CTXT_FINISH_DTD_0) ||
1575  (ctxt->finishDtd == XML_CTXT_FINISH_DTD_1))) {
1576  ret->content = content;
1577  if (content != NULL)
1578  content->parent = (xmlElementContentPtr) 1;
1579  } else {
1580  ret->content = xmlCopyDocElementContent(dtd->doc, content);
1581  }
1582 
1583  /*
1584  * Link it to the DTD
1585  */
1586  ret->parent = dtd;
1587  ret->doc = dtd->doc;
1588  if (dtd->last == NULL) {
1589  dtd->children = dtd->last = (xmlNodePtr) ret;
1590  } else {
1591  dtd->last->next = (xmlNodePtr) ret;
1592  ret->prev = dtd->last;
1593  dtd->last = (xmlNodePtr) ret;
1594  }
1595  if (uqname != NULL)
1596  xmlFree(uqname);
1597  return(ret);
1598 }
static void xmlFreeElement(xmlElementPtr elem)
Definition: valid.c:1358
unsigned int finishDtd
Definition: valid.h:93
struct _xmlDoc * doc
Definition: tree.h:415
XMLPUBFUN int XMLCALL xmlHashAddEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, void *userdata)
Definition: hash.c:404
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
static void xmlVErrMemory(xmlValidCtxtPtr ctxt, const char *extra)
Definition: valid.c:58
xmlElementTable * xmlElementTablePtr
Definition: valid.h:126
XMLPUBFUN void *XMLCALL xmlHashLookup2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2)
Definition: hash.c:474
content
Definition: atl_ax.c:994
smooth NULL
Definition: ftsmooth.c:416
xmlNode * xmlNodePtr
Definition: tree.h:488
if(!(yy_init))
Definition: macro.lex.yy.c:714
xmlElement * xmlElementPtr
Definition: tree.h:345
void * elements
Definition: tree.h:419
XMLPUBFUN int XMLCALL xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, xmlHashDeallocator f)
Definition: hash.c:1069
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
struct _xmlNode * last
Definition: tree.h:411
Definition: tree.h:489
int ret
Definition: mxnamespace.c:44
unsigned char xmlChar
Definition: xmlstring.h:28
struct _xmlNode * children
Definition: tree.h:410
__XML_EXTERNC typedef xmlDict * xmlDictPtr
Definition: dict.h:24
XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreateDict(int size, xmlDictPtr dict)
Definition: hash.c:208
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
Definition: name.c:36
xmlElementContentPtr xmlCopyDocElementContent(xmlDocPtr doc, xmlElementContentPtr cur)
Definition: valid.c:1008
#define memset(x, y, z)
Definition: compat.h:39
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:66
xmlElementContent * xmlElementContentPtr
Definition: tree.h:305
XMLPUBFUN xmlChar *XMLCALL xmlSplitQName2(const xmlChar *name, xmlChar **prefix)

Referenced by xmlSAX2ElementDecl().

◆ xmlAddID()

xmlIDPtr xmlAddID ( xmlValidCtxtPtr  ctxt,
xmlDocPtr  doc,
const xmlChar value,
xmlAttrPtr  attr 
)

xmlAddID: @ctxt: the validation context @doc: pointer to the document @value: the value name @attr: the attribute holding the ID

Register a new id declaration

Returns NULL if not, otherwise the new xmlIDPtr

Definition at line 2602 of file valid.c.

2603  {
2604  xmlIDPtr ret;
2606 
2607  if (doc == NULL) {
2608  return(NULL);
2609  }
2610  if (value == NULL) {
2611  return(NULL);
2612  }
2613  if (attr == NULL) {
2614  return(NULL);
2615  }
2616 
2617  /*
2618  * Create the ID table if needed.
2619  */
2620  table = (xmlIDTablePtr) doc->ids;
2621  if (table == NULL) {
2622  doc->ids = table = xmlHashCreateDict(0, doc->dict);
2623  }
2624  if (table == NULL) {
2625  xmlVErrMemory(ctxt,
2626  "xmlAddID: Table creation failed!\n");
2627  return(NULL);
2628  }
2629 
2630  ret = (xmlIDPtr) xmlMalloc(sizeof(xmlID));
2631  if (ret == NULL) {
2632  xmlVErrMemory(ctxt, "malloc failed");
2633  return(NULL);
2634  }
2635 
2636  /*
2637  * fill the structure.
2638  */
2639  ret->value = xmlStrdup(value);
2640  ret->doc = doc;
2641  if ((ctxt != NULL) && (ctxt->vstateNr != 0)) {
2642  /*
2643  * Operating in streaming mode, attr is gonna disapear
2644  */
2645  if (doc->dict != NULL)
2646  ret->name = xmlDictLookup(doc->dict, attr->name, -1);
2647  else
2648  ret->name = xmlStrdup(attr->name);
2649  ret->attr = NULL;
2650  } else {
2651  ret->attr = attr;
2652  ret->name = NULL;
2653  }
2654  ret->lineno = xmlGetLineNo(attr->parent);
2655 
2656  if (xmlHashAddEntry(table, value, ret) < 0) {
2657 #ifdef LIBXML_VALID_ENABLED
2658  /*
2659  * The id is already defined in this DTD.
2660  */
2661  if (ctxt != NULL) {
2662  xmlErrValidNode(ctxt, attr->parent, XML_DTD_ID_REDEFINED,
2663  "ID %s already defined\n", value, NULL, NULL);
2664  }
2665 #endif /* LIBXML_VALID_ENABLED */
2666  xmlFreeID(ret);
2667  return(NULL);
2668  }
2669  if (attr != NULL)
2670  attr->atype = XML_ATTRIBUTE_ID;
2671  return(ret);
2672 }
static void xmlFreeID(xmlIDPtr id)
Definition: valid.c:2574
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
XMLPUBFUN int XMLCALL xmlHashAddEntry(xmlHashTablePtr table, const xmlChar *name, void *userdata)
Definition: hash.c:387
static void xmlVErrMemory(xmlValidCtxtPtr ctxt, const char *extra)
Definition: valid.c:58
smooth NULL
Definition: ftsmooth.c:416
void * ids
Definition: tree.h:575
XMLPUBFUN long XMLCALL xmlGetLineNo(const xmlNode *node)
if(!(yy_init))
Definition: macro.lex.yy.c:714
xmlID * xmlIDPtr
Definition: tree.h:456
XMLPUBFUN const xmlChar *XMLCALL xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len)
Definition: dict.c:858
Definition: cookie.c:170
int ret
__u8 attr
Definition: mkdosfs.c:359
xmlIDTable * xmlIDTablePtr
Definition: valid.h:142
XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreateDict(int size, xmlDictPtr dict)
Definition: hash.c:208
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
WCHAR * name
Definition: cookie.c:172
struct _xmlDict * dict
Definition: tree.h:580
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:66
Definition: tree.h:457
int vstateNr
Definition: valid.h:99

Referenced by xmlSAX2AttributeNs(), xsltAttribute(), and xsltAttrListTemplateProcess().

◆ xmlAddNotationDecl()

xmlNotationPtr xmlAddNotationDecl ( xmlValidCtxtPtr  ctxt,
xmlDtdPtr  dtd,
const xmlChar name,
const xmlChar PublicID,
const xmlChar SystemID 
)

Definition at line 2365 of file valid.c.

2367  {
2370 
2371  if (dtd == NULL) {
2372  return(NULL);
2373  }
2374  if (name == NULL) {
2375  return(NULL);
2376  }
2377  if ((PublicID == NULL) && (SystemID == NULL)) {
2378  return(NULL);
2379  }
2380 
2381  /*
2382  * Create the Notation table if needed.
2383  */
2385  if (table == NULL) {
2386  xmlDictPtr dict = NULL;
2387  if (dtd->doc != NULL)
2388  dict = dtd->doc->dict;
2389 
2390  dtd->notations = table = xmlHashCreateDict(0, dict);
2391  }
2392  if (table == NULL) {
2393  xmlVErrMemory(ctxt,
2394  "xmlAddNotationDecl: Table creation failed!\n");
2395  return(NULL);
2396  }
2397 
2398  ret = (xmlNotationPtr) xmlMalloc(sizeof(xmlNotation));
2399  if (ret == NULL) {
2400  xmlVErrMemory(ctxt, "malloc failed");
2401  return(NULL);
2402  }
2403  memset(ret, 0, sizeof(xmlNotation));
2404 
2405  /*
2406  * fill the structure.
2407  */
2408  ret->name = xmlStrdup(name);
2409  if (SystemID != NULL)
2410  ret->SystemID = xmlStrdup(SystemID);
2411  if (PublicID != NULL)
2412  ret->PublicID = xmlStrdup(PublicID);
2413 
2414  /*
2415  * Validity Check:
2416  * Check the DTD for previous declarations of the ATTLIST
2417  */
2418  if (xmlHashAddEntry(table, name, ret)) {
2419 #ifdef LIBXML_VALID_ENABLED
2420  xmlErrValid(NULL, XML_DTD_NOTATION_REDEFINED,
2421  "xmlAddNotationDecl: %s already defined\n",
2422  (const char *) name);
2423 #endif /* LIBXML_VALID_ENABLED */
2425  return(NULL);
2426  }
2427  return(ret);
2428 }
struct _xmlDoc * doc
Definition: tree.h:415
void * notations
Definition: tree.h:418
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
XMLPUBFUN int XMLCALL xmlHashAddEntry(xmlHashTablePtr table, const xmlChar *name, void *userdata)
Definition: hash.c:387
static void xmlVErrMemory(xmlValidCtxtPtr ctxt, const char *extra)
Definition: valid.c:58
static void xmlFreeNotation(xmlNotationPtr nota)
Definition: valid.c:2340
smooth NULL
Definition: ftsmooth.c:416
if(!(yy_init))
Definition: macro.lex.yy.c:714
int ret
xmlNotationTable * xmlNotationTablePtr
Definition: valid.h:118
__XML_EXTERNC typedef xmlDict * xmlDictPtr
Definition: dict.h:24
XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreateDict(int size, xmlDictPtr dict)
Definition: hash.c:208
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
Definition: name.c:36
xmlNotation * xmlNotationPtr
Definition: tree.h:193
#define memset(x, y, z)
Definition: compat.h:39
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:66

Referenced by xmlSAX2NotationDecl().

◆ xmlAddRef()

xmlRefPtr xmlAddRef ( xmlValidCtxtPtr  ctxt,
xmlDocPtr  doc,
const xmlChar value,
xmlAttrPtr  attr 
)

xmlAddRef: @ctxt: the validation context @doc: pointer to the document @value: the value name @attr: the attribute holding the Ref

Register a new ref declaration

Returns NULL if not, otherwise the new xmlRefPtr

Definition at line 2930 of file valid.c.

2931  {
2932  xmlRefPtr ret;
2934  xmlListPtr ref_list;
2935 
2936  if (doc == NULL) {
2937  return(NULL);
2938  }
2939  if (value == NULL) {
2940  return(NULL);
2941  }
2942  if (attr == NULL) {
2943  return(NULL);
2944  }
2945 
2946  /*
2947  * Create the Ref table if needed.
2948  */
2949  table = (xmlRefTablePtr) doc->refs;
2950  if (table == NULL) {
2951  doc->refs = table = xmlHashCreateDict(0, doc->dict);
2952  }
2953  if (table == NULL) {
2954  xmlVErrMemory(ctxt,
2955  "xmlAddRef: Table creation failed!\n");
2956  return(NULL);
2957  }
2958 
2959  ret = (xmlRefPtr) xmlMalloc(sizeof(xmlRef));
2960  if (ret == NULL) {
2961  xmlVErrMemory(ctxt, "malloc failed");
2962  return(NULL);
2963  }
2964 
2965  /*
2966  * fill the structure.
2967  */
2968  ret->value = xmlStrdup(value);
2969  if ((ctxt != NULL) && (ctxt->vstateNr != 0)) {
2970  /*
2971  * Operating in streaming mode, attr is gonna disapear
2972  */
2973  ret->name = xmlStrdup(attr->name);
2974  ret->attr = NULL;
2975  } else {
2976  ret->name = NULL;
2977  ret->attr = attr;
2978  }
2979  ret->lineno = xmlGetLineNo(attr->parent);
2980 
2981  /* To add a reference :-
2982  * References are maintained as a list of references,
2983  * Lookup the entry, if no entry create new nodelist
2984  * Add the owning node to the NodeList
2985  * Return the ref
2986  */
2987 
2988  if (NULL == (ref_list = xmlHashLookup(table, value))) {
2989  if (NULL == (ref_list = xmlListCreate(xmlFreeRef, xmlDummyCompare))) {
2990  xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR,
2991  "xmlAddRef: Reference list creation failed!\n",
2992  NULL);
2993  goto failed;
2994  }
2995  if (xmlHashAddEntry(table, value, ref_list) < 0) {
2996  xmlListDelete(ref_list);
2997  xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR,
2998  "xmlAddRef: Reference list insertion failed!\n",
2999  NULL);
3000  goto failed;
3001  }
3002  }
3003  if (xmlListAppend(ref_list, ret) != 0) {
3004  xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR,
3005  "xmlAddRef: Reference list insertion failed!\n",
3006  NULL);
3007  goto failed;
3008  }
3009  return(ret);
3010 failed:
3011  if (ret != NULL) {
3012  if (ret->value != NULL)
3013  xmlFree((char *)ret->value);
3014  if (ret->name != NULL)
3015  xmlFree((char *)ret->name);
3016  xmlFree(ret);
3017  }
3018  return(NULL);
3019 }
XMLPUBFUN xmlListPtr XMLCALL xmlListCreate(xmlListDeallocator deallocator, xmlListDataCompare compare)
Definition: list.c:188
xmlRef * xmlRefPtr
Definition: tree.h:473
XMLPUBFUN int XMLCALL xmlListAppend(xmlListPtr l, void *data)
Definition: list.c:305
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
XMLPUBFUN int XMLCALL xmlHashAddEntry(xmlHashTablePtr table, const xmlChar *name, void *userdata)
Definition: hash.c:387
static void xmlVErrMemory(xmlValidCtxtPtr ctxt, const char *extra)
Definition: valid.c:58
void * refs
Definition: tree.h:576
Definition: tree.h:474
smooth NULL
Definition: ftsmooth.c:416
XMLPUBFUN long XMLCALL xmlGetLineNo(const xmlNode *node)
if(!(yy_init))
Definition: macro.lex.yy.c:714
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
Definition: cookie.c:170
int ret
__u8 attr
Definition: mkdosfs.c:359
static int xmlDummyCompare(const void *data0 ATTRIBUTE_UNUSED, const void *data1 ATTRIBUTE_UNUSED)
Definition: valid.c:2912
Definition: list.c:38
XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreateDict(int size, xmlDictPtr dict)
Definition: hash.c:208
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
xmlRefTable * xmlRefTablePtr
Definition: valid.h:150
WCHAR * name
Definition: cookie.c:172
XMLPUBFUN void *XMLCALL xmlHashLookup(xmlHashTablePtr table, const xmlChar *name)
Definition: hash.c:459
XMLPUBFUN void XMLCALL xmlListDelete(xmlListPtr l)
Definition: list.c:333
static void xmlFreeRef(xmlLinkPtr lk)
Definition: valid.c:2860
struct _xmlDict * dict
Definition: tree.h:580
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:66
int vstateNr
Definition: valid.h:99

Referenced by xmlSAX2AttributeNs().

◆ xmlCopyDocElementContent()

xmlElementContentPtr xmlCopyDocElementContent ( xmlDocPtr  doc,
xmlElementContentPtr  cur 
)

xmlCopyDocElementContent: @doc: the document owning the element declaration @cur: An element content pointer.

Build a copy of an element content description.

Returns the new xmlElementContentPtr or NULL in case of error.

Definition at line 1008 of file valid.c.

1008  {
1009  xmlElementContentPtr ret = NULL, prev = NULL, tmp;
1010  xmlDictPtr dict = NULL;
1011 
1012  if (cur == NULL) return(NULL);
1013 
1014  if (doc != NULL)
1015  dict = doc->dict;
1016 
1018  if (ret == NULL) {
1019  xmlVErrMemory(NULL, "malloc failed");
1020  return(NULL);
1021  }
1022  memset(ret, 0, sizeof(xmlElementContent));
1023  ret->type = cur->type;
1024  ret->ocur = cur->ocur;
1025  if (cur->name != NULL) {
1026  if (dict)
1027  ret->name = xmlDictLookup(dict, cur->name, -1);
1028  else
1029  ret->name = xmlStrdup(cur->name);
1030  }
1031 
1032  if (cur->prefix != NULL) {
1033  if (dict)
1034  ret->prefix = xmlDictLookup(dict, cur->prefix, -1);
1035  else
1036  ret->prefix = xmlStrdup(cur->prefix);
1037  }
1038  if (cur->c1 != NULL)
1039  ret->c1 = xmlCopyDocElementContent(doc, cur->c1);
1040  if (ret->c1 != NULL)
1041  ret->c1->parent = ret;
1042  if (cur->c2 != NULL) {
1043  prev = ret;
1044  cur = cur->c2;
1045  while (cur != NULL) {
1047  if (tmp == NULL) {
1048  xmlVErrMemory(NULL, "malloc failed");
1049  return(ret);
1050  }
1051  memset(tmp, 0, sizeof(xmlElementContent));
1052  tmp->type = cur->type;
1053  tmp->ocur = cur->ocur;
1054  prev->c2 = tmp;
1055  if (cur->name != NULL) {
1056  if (dict)
1057  tmp->name = xmlDictLookup(dict, cur->name, -1);
1058  else
1059  tmp->name = xmlStrdup(cur->name);
1060  }
1061 
1062  if (cur->prefix != NULL) {
1063  if (dict)
1064  tmp->prefix = xmlDictLookup(dict, cur->prefix, -1);
1065  else
1066  tmp->prefix = xmlStrdup(cur->prefix);
1067  }
1068  if (cur->c1 != NULL)
1069  tmp->c1 = xmlCopyDocElementContent(doc,cur->c1);
1070  if (tmp->c1 != NULL)
1071  tmp->c1->parent = ret;
1072  prev = tmp;
1073  cur = cur->c2;
1074  }
1075  }
1076  return(ret);
1077 }
struct _xmlElementContent * c2
Definition: tree.h:311
struct _xmlElementContent * c1
Definition: tree.h:310
xmlElementContentOccur ocur
Definition: tree.h:308
static void xmlVErrMemory(xmlValidCtxtPtr ctxt, const char *extra)
Definition: valid.c:58
smooth NULL
Definition: ftsmooth.c:416
const xmlChar * prefix
Definition: tree.h:313
XMLPUBFUN const xmlChar *XMLCALL xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len)
Definition: dict.c:858
const xmlChar * name
Definition: tree.h:309
int ret
__XML_EXTERNC typedef xmlDict * xmlDictPtr
Definition: dict.h:24
xmlElementContentType type
Definition: tree.h:307
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
xmlElementContentPtr xmlCopyDocElementContent(xmlDocPtr doc, xmlElementContentPtr cur)
Definition: valid.c:1008
#define memset(x, y, z)
Definition: compat.h:39
struct _xmlDict * dict
Definition: tree.h:580
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:66
xmlElementContent * xmlElementContentPtr
Definition: tree.h:305

Referenced by xmlAddElementDecl(), and xmlCopyElementContent().

◆ xmlCopyElementContent()

xmlElementContentPtr xmlCopyElementContent ( xmlElementContentPtr  cur)

xmlCopyElementContent: @cur: An element content pointer.

Build a copy of an element content description. Deprecated, use xmlCopyDocElementContent instead

Returns the new xmlElementContentPtr or NULL in case of error.

Definition at line 1089 of file valid.c.

1089  {
1090  return(xmlCopyDocElementContent(NULL, cur));
1091 }
smooth NULL
Definition: ftsmooth.c:416
xmlElementContentPtr xmlCopyDocElementContent(xmlDocPtr doc, xmlElementContentPtr cur)
Definition: valid.c:1008

◆ xmlCreateEnumeration()

xmlEnumerationPtr xmlCreateEnumeration ( const xmlChar name)

Definition at line 1766 of file valid.c.

1766  {
1768 
1770  if (ret == NULL) {
1771  xmlVErrMemory(NULL, "malloc failed");
1772  return(NULL);
1773  }
1774  memset(ret, 0, sizeof(xmlEnumeration));
1775 
1776  if (name != NULL)
1777  ret->name = xmlStrdup(name);
1778  return(ret);
1779 }
static void xmlVErrMemory(xmlValidCtxtPtr ctxt, const char *extra)
Definition: valid.c:58
xmlEnumeration * xmlEnumerationPtr
Definition: tree.h:239
smooth NULL
Definition: ftsmooth.c:416
int ret
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
Definition: name.c:36
#define memset(x, y, z)
Definition: compat.h:39
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:66

Referenced by xmlParseEnumerationType(), and xmlParseNotationType().

◆ xmlDummyCompare()

static int xmlDummyCompare ( const void *data0  ATTRIBUTE_UNUSED,
const void *data1  ATTRIBUTE_UNUSED 
)
static

xmlDummyCompare @data0: Value supplied by the user @data1: Value supplied by the user

Do nothing, return 0. Used to create unordered lists.

Definition at line 2912 of file valid.c.

2914 {
2915  return (0);
2916 }

Referenced by xmlAddRef().

◆ xmlFreeAttribute()

static void xmlFreeAttribute ( xmlAttributePtr  attr)
static

xmlFreeAttribute: @elem: An attribute

Deallocate the memory used by an attribute definition

Definition at line 1885 of file valid.c.

1885  {
1886  xmlDictPtr dict;
1887 
1888  if (attr == NULL) return;
1889  if (attr->doc != NULL)
1890  dict = attr->doc->dict;
1891  else
1892  dict = NULL;
1894  if (attr->tree != NULL)
1895  xmlFreeEnumeration(attr->tree);
1896  if (dict) {
1897  if ((attr->elem != NULL) && (!xmlDictOwns(dict, attr->elem)))
1898  xmlFree((xmlChar *) attr->elem);
1899  if ((attr->name != NULL) && (!xmlDictOwns(dict, attr->name)))
1900  xmlFree((xmlChar *) attr->name);
1901  if ((attr->prefix != NULL) && (!xmlDictOwns(dict, attr->prefix)))
1902  xmlFree((xmlChar *) attr->prefix);
1903  if ((attr->defaultValue != NULL) &&
1904  (!xmlDictOwns(dict, attr->defaultValue)))
1905  xmlFree((xmlChar *) attr->defaultValue);
1906  } else {
1907  if (attr->elem != NULL)
1908  xmlFree((xmlChar *) attr->elem);
1909  if (attr->name != NULL)
1910  xmlFree((xmlChar *) attr->name);
1911  if (attr->defaultValue != NULL)
1912  xmlFree((xmlChar *) attr->defaultValue);
1913  if (attr->prefix != NULL)
1914  xmlFree((xmlChar *) attr->prefix);
1915  }
1916  xmlFree(attr);
1917 }
void xmlFreeEnumeration(xmlEnumerationPtr cur)
Definition: valid.c:1788
smooth NULL
Definition: ftsmooth.c:416
XMLPUBFUN void XMLCALL xmlUnlinkNode(xmlNodePtr cur)
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
Definition: cookie.c:170
Definition: tree.h:489
unsigned char xmlChar
Definition: xmlstring.h:28
__XML_EXTERNC typedef xmlDict * xmlDictPtr
Definition: dict.h:24
XMLPUBFUN int XMLCALL xmlDictOwns(xmlDictPtr dict, const xmlChar *str)
Definition: dict.c:1211
WCHAR * name
Definition: cookie.c:172

Referenced by xmlAddAttributeDecl(), and xmlFreeAttributeTableEntry().

◆ xmlFreeAttributeTable()

void xmlFreeAttributeTable ( xmlAttributeTablePtr  table)

xmlFreeAttributeTable: @table: An attribute table

Deallocate the memory used by an entities hash table.

Definition at line 2164 of file valid.c.

2164  {
2166 }
XMLPUBFUN void XMLCALL xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f)
Definition: hash.c:320
static void xmlFreeAttributeTableEntry(void *attr, const xmlChar *name ATTRIBUTE_UNUSED)
Definition: valid.c:2153

◆ xmlFreeAttributeTableEntry()

static void xmlFreeAttributeTableEntry ( void attr,
const xmlChar *name  ATTRIBUTE_UNUSED 
)
static

Definition at line 2153 of file valid.c.

2153  {
2155 }
Definition: cookie.c:170
static void xmlFreeAttribute(xmlAttributePtr attr)
Definition: valid.c:1885

Referenced by xmlFreeAttributeTable().

◆ xmlFreeDocElementContent()

void xmlFreeDocElementContent ( xmlDocPtr  doc,
xmlElementContentPtr  cur 
)

xmlFreeDocElementContent: @doc: the document owning the element declaration @cur: the element content tree to free

Free an element content structure. The whole subtree is removed.

Definition at line 1101 of file valid.c.

1101  {
1103  xmlDictPtr dict = NULL;
1104 
1105  if (doc != NULL)
1106  dict = doc->dict;
1107 
1108  while (cur != NULL) {
1109  next = cur->c2;
1110  switch (cur->type) {
1115  break;
1116  default:
1117  xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR,
1118  "Internal: ELEMENT content corrupted invalid type\n",
1119  NULL);
1120  return;
1121  }
1122  if (cur->c1 != NULL) xmlFreeDocElementContent(doc, cur->c1);
1123  if (dict) {
1124  if ((cur->name != NULL) && (!xmlDictOwns(dict, cur->name)))
1125  xmlFree((xmlChar *) cur->name);
1126  if ((cur->prefix != NULL) && (!xmlDictOwns(dict, cur->prefix)))
1127  xmlFree((xmlChar *) cur->prefix);
1128  } else {
1129  if (cur->name != NULL) xmlFree((xmlChar *) cur->name);
1130  if (cur->prefix != NULL) xmlFree((xmlChar *) cur->prefix);
1131  }
1132  xmlFree(cur);
1133  cur = next;
1134  }
1135 }
struct _xmlElementContent * c2
Definition: tree.h:311
struct _xmlElementContent * c1
Definition: tree.h:310
void xmlFreeDocElementContent(xmlDocPtr doc, xmlElementContentPtr cur)
Definition: valid.c:1101
smooth NULL
Definition: ftsmooth.c:416
const xmlChar * prefix
Definition: tree.h:313
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
const xmlChar * name
Definition: tree.h:309
unsigned char xmlChar
Definition: xmlstring.h:28
static unsigned __int64 next
Definition: rand_nt.c:6
__XML_EXTERNC typedef xmlDict * xmlDictPtr
Definition: dict.h:24
xmlElementContentType type
Definition: tree.h:307
XMLPUBFUN int XMLCALL xmlDictOwns(xmlDictPtr dict, const xmlChar *str)
Definition: dict.c:1211
struct _xmlDict * dict
Definition: tree.h:580

Referenced by xmlFreeElement(), xmlFreeElementContent(), xmlParseElementChildrenContentDeclPriv(), xmlParseElementDecl(), and xmlParseElementMixedContentDecl().

◆ xmlFreeElement()

static void xmlFreeElement ( xmlElementPtr  elem)
static

xmlFreeElement: @elem: An element

Deallocate the memory used by an element definition

Definition at line 1358 of file valid.c.

1358  {
1359  if (elem == NULL) return;
1361  xmlFreeDocElementContent(elem->doc, elem->content);
1362  if (elem->name != NULL)
1363  xmlFree((xmlChar *) elem->name);
1364  if (elem->prefix != NULL)
1365  xmlFree((xmlChar *) elem->prefix);
1366 #ifdef LIBXML_REGEXP_ENABLED
1367  if (elem->contModel != NULL)
1368  xmlRegFreeRegexp(elem->contModel);
1369 #endif
1370  xmlFree(elem);
1371 }
void xmlFreeDocElementContent(xmlDocPtr doc, xmlElementContentPtr cur)
Definition: valid.c:1101
static size_t elem
Definition: string.c:68
smooth NULL
Definition: ftsmooth.c:416
XMLPUBFUN void XMLCALL xmlUnlinkNode(xmlNodePtr cur)
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
Definition: tree.h:489
unsigned char xmlChar
Definition: xmlstring.h:28

Referenced by xmlAddElementDecl(), and xmlFreeElementTableEntry().

◆ xmlFreeElementContent()

void xmlFreeElementContent ( xmlElementContentPtr  cur)

xmlFreeElementContent: @cur: the element content tree to free

Free an element content structure. The whole subtree is removed. Deprecated, use xmlFreeDocElementContent instead

Definition at line 1145 of file valid.c.

1145  {
1147 }
void xmlFreeDocElementContent(xmlDocPtr doc, xmlElementContentPtr cur)
Definition: valid.c:1101
smooth NULL
Definition: ftsmooth.c:416

◆ xmlFreeElementTable()

void xmlFreeElementTable ( xmlElementTablePtr  table)

xmlFreeElementTable: @table: An element table

Deallocate the memory used by an element hash table.

Definition at line 1612 of file valid.c.

1612  {
1614 }
XMLPUBFUN void XMLCALL xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f)
Definition: hash.c:320
static void xmlFreeElementTableEntry(void *elem, const xmlChar *name ATTRIBUTE_UNUSED)
Definition: valid.c:1601

◆ xmlFreeElementTableEntry()

static void xmlFreeElementTableEntry ( void elem,
const xmlChar *name  ATTRIBUTE_UNUSED 
)
static

Definition at line 1601 of file valid.c.

1601  {
1603 }
static void xmlFreeElement(xmlElementPtr elem)
Definition: valid.c:1358
static size_t elem
Definition: string.c:68

Referenced by xmlFreeElementTable().

◆ xmlFreeEnumeration()

void xmlFreeEnumeration ( xmlEnumerationPtr  cur)

xmlFreeEnumeration: @cur: the tree to free.

free an enumeration attribute node (recursive).

Definition at line 1788 of file valid.c.

1788  {
1789  if (cur == NULL) return;
1790 
1791  if (cur->next != NULL) xmlFreeEnumeration(cur->next);
1792 
1793  if (cur->name != NULL) xmlFree((xmlChar *) cur->name);
1794  xmlFree(cur);
1795 }
void xmlFreeEnumeration(xmlEnumerationPtr cur)
Definition: valid.c:1788
const xmlChar * name
Definition: tree.h:242
smooth NULL
Definition: ftsmooth.c:416
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
unsigned char xmlChar
Definition: xmlstring.h:28
struct _xmlEnumeration * next
Definition: tree.h:241

Referenced by attributeDeclDebug(), xmlAddAttributeDecl(), xmlFreeAttribute(), xmlParseAttributeListDecl(), xmlParseEnumerationType(), xmlParseNotationType(), and xmlSAX2AttributeDecl().

◆ xmlFreeID()

static void xmlFreeID ( xmlIDPtr  id)
static

xmlFreeID: @not: A id

Deallocate the memory used by an id definition

Definition at line 2574 of file valid.c.

2574  {
2575  xmlDictPtr dict = NULL;
2576 
2577  if (id == NULL) return;
2578 
2579  if (id->doc != NULL)
2580  dict = id->doc->dict;
2581 
2582  if (id->value != NULL)
2583  DICT_FREE(id->value)
2584  if (id->name != NULL)
2585  DICT_FREE(id->name)
2586  xmlFree(id);
2587 }
smooth NULL
Definition: ftsmooth.c:416
if(!(yy_init))
Definition: macro.lex.yy.c:714
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
#define DICT_FREE(str)
Definition: valid.c:2562
__XML_EXTERNC typedef xmlDict * xmlDictPtr
Definition: dict.h:24
Definition: name.c:36
GLenum GLuint id
Definition: glext.h:5579

Referenced by xmlAddID(), and xmlFreeIDTableEntry().

◆ xmlFreeIDTable()

void xmlFreeIDTable ( xmlIDTablePtr  table)

xmlFreeIDTable: @table: An id table

Deallocate the memory used by an ID hash table.

Definition at line 2686 of file valid.c.

2686  {
2688 }
XMLPUBFUN void XMLCALL xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f)
Definition: hash.c:320
static void xmlFreeIDTableEntry(void *id, const xmlChar *name ATTRIBUTE_UNUSED)
Definition: valid.c:2675

Referenced by xsltReleaseRVT().

◆ xmlFreeIDTableEntry()

static void xmlFreeIDTableEntry ( void id,
const xmlChar *name  ATTRIBUTE_UNUSED 
)
static

Definition at line 2675 of file valid.c.

2675  {
2676  xmlFreeID((xmlIDPtr) id);
2677 }
static void xmlFreeID(xmlIDPtr id)
Definition: valid.c:2574
Definition: tree.h:457

Referenced by xmlFreeIDTable(), and xmlRemoveID().

◆ xmlFreeNotation()

static void xmlFreeNotation ( xmlNotationPtr  nota)
static

xmlFreeNotation: @not: A notation

Deallocate the memory used by an notation definition

Definition at line 2340 of file valid.c.

2340  {
2341  if (nota == NULL) return;
2342  if (nota->name != NULL)
2343  xmlFree((xmlChar *) nota->name);
2344  if (nota->PublicID != NULL)
2345  xmlFree((xmlChar *) nota->PublicID);
2346  if (nota->SystemID != NULL)
2347  xmlFree((xmlChar *) nota->SystemID);
2348  xmlFree(nota);
2349 }
const xmlChar * PublicID
Definition: tree.h:196
smooth NULL
Definition: ftsmooth.c:416
const xmlChar * SystemID
Definition: tree.h:197
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
unsigned char xmlChar
Definition: xmlstring.h:28
const xmlChar * name
Definition: tree.h:195

Referenced by xmlAddNotationDecl(), and xmlFreeNotationTableEntry().

◆ xmlFreeNotationTable()

void xmlFreeNotationTable ( xmlNotationTablePtr  table)

xmlFreeNotationTable: @table: An notation table

Deallocate the memory used by an entities hash table.

Definition at line 2442 of file valid.c.

2442  {
2444 }
XMLPUBFUN void XMLCALL xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f)
Definition: hash.c:320
static void xmlFreeNotationTableEntry(void *nota, const xmlChar *name ATTRIBUTE_UNUSED)
Definition: valid.c:2431

◆ xmlFreeNotationTableEntry()

static void xmlFreeNotationTableEntry ( void nota,
const xmlChar *name  ATTRIBUTE_UNUSED 
)
static

Definition at line 2431 of file valid.c.

2431  {
2433 }
static void xmlFreeNotation(xmlNotationPtr nota)
Definition: valid.c:2340

Referenced by xmlFreeNotationTable().

◆ xmlFreeRef()

static void xmlFreeRef ( xmlLinkPtr  lk)
static

xmlFreeRef: @lk: A list link

Deallocate the memory used by a ref definition

Definition at line 2860 of file valid.c.

2860  {
2862  if (ref == NULL) return;
2863  if (ref->value != NULL)
2864  xmlFree((xmlChar *)ref->value);
2865  if (ref->name != NULL)
2866  xmlFree((xmlChar *)ref->name);
2867  xmlFree(ref);
2868 }
xmlRef * xmlRefPtr
Definition: tree.h:473
Definition: send.c:47
Definition: tree.h:474
char name[1]
Definition: send.c:51
smooth NULL
Definition: ftsmooth.c:416
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
unsigned char xmlChar
Definition: xmlstring.h:28
XMLPUBFUN void *XMLCALL xmlLinkGetData(xmlLinkPtr lk)
Definition: list.c:604

Referenced by xmlAddRef().

◆ xmlFreeRefTable()

void xmlFreeRefTable ( xmlRefTablePtr  table)

xmlFreeRefTable: @table: An ref table

Deallocate the memory used by an Ref hash table.

Definition at line 3028 of file valid.c.

3028  {
3030 }
XMLPUBFUN void XMLCALL xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f)
Definition: hash.c:320
static void xmlFreeRefTableEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED)
Definition: valid.c:2877

Referenced by xsltReleaseRVT().

◆ xmlFreeRefTableEntry()

static void xmlFreeRefTableEntry ( void payload,
const xmlChar *name  ATTRIBUTE_UNUSED 
)
static

xmlFreeRefTableEntry: @list_ref: A list of references.

Deallocate the memory used by a list of references

Definition at line 2877 of file valid.c.

2877  {
2878  xmlListPtr list_ref = (xmlListPtr) payload;
2879  if (list_ref == NULL) return;
2880  xmlListDelete(list_ref);
2881 }
smooth NULL
Definition: ftsmooth.c:416
xmlList * xmlListPtr
Definition: list.h:24
Definition: list.c:38
XMLPUBFUN void XMLCALL xmlListDelete(xmlListPtr l)
Definition: list.c:333

Referenced by xmlFreeRefTable(), and xmlRemoveRef().

◆ xmlGetDtdAttrDesc()

xmlAttributePtr xmlGetDtdAttrDesc ( xmlDtdPtr  dtd,
const xmlChar elem,
const xmlChar name 
)

Definition at line 3298 of file valid.c.

3298  {
3300  xmlAttributePtr cur;
3301  xmlChar *uqname = NULL, *prefix = NULL;
3302 
3303  if (dtd == NULL) return(NULL);
3304  if (dtd->attributes == NULL) return(NULL);
3305 
3307  if (table == NULL)
3308  return(NULL);
3309 
3310  uqname = xmlSplitQName2(name, &prefix);
3311 
3312  if (uqname != NULL) {
3313  cur = xmlHashLookup3(table, uqname, prefix, elem);
3314  if (prefix != NULL) xmlFree(prefix);
3315  if (uqname != NULL) xmlFree(uqname);
3316  } else
3317  cur = xmlHashLookup3(table, name, NULL, elem);
3318  return(cur);
3319 }
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
void * attributes
Definition: tree.h:420
static size_t elem
Definition: string.c:68
smooth NULL
Definition: ftsmooth.c:416
xmlAttributeTable * xmlAttributeTablePtr
Definition: valid.h:134
XMLPUBFUN void *XMLCALL xmlHashLookup3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3)
Definition: hash.c:767
if(!(yy_init))
Definition: macro.lex.yy.c:714
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
unsigned char xmlChar
Definition: xmlstring.h:28
Definition: name.c:36
XMLPUBFUN xmlChar *XMLCALL xmlSplitQName2(const xmlChar *name, xmlChar **prefix)

Referenced by xmlIsID(), xmlIsRef(), xsltGetCNsProp(), and xsltGetNsProp().

◆ xmlGetDtdElementDesc()

xmlElementPtr xmlGetDtdElementDesc ( xmlDtdPtr  dtd,
const xmlChar name 
)

Definition at line 3176 of file valid.c.

3176  {
3178  xmlElementPtr cur;
3179  xmlChar *uqname = NULL, *prefix = NULL;
3180 
3181  if ((dtd == NULL) || (name == NULL)) return(NULL);
3182  if (dtd->elements == NULL)
3183  return(NULL);
3185 
3186  uqname = xmlSplitQName2(name, &prefix);
3187  if (uqname != NULL)
3188  name = uqname;
3189  cur = xmlHashLookup2(table, name, prefix);
3190  if (prefix != NULL) xmlFree(prefix);
3191  if (uqname != NULL) xmlFree(uqname);
3192  return(cur);
3193 }
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
xmlElementTable * xmlElementTablePtr
Definition: valid.h:126
XMLPUBFUN void *XMLCALL xmlHashLookup2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2)
Definition: hash.c:474
smooth NULL
Definition: ftsmooth.c:416
void * elements
Definition: tree.h:419
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
unsigned char xmlChar
Definition: xmlstring.h:28
Definition: name.c:36
XMLPUBFUN xmlChar *XMLCALL xmlSplitQName2(const xmlChar *name, xmlChar **prefix)

Referenced by xmlIsMixedElement().

◆ xmlGetDtdElementDesc2()

static xmlElementPtr xmlGetDtdElementDesc2 ( xmlDtdPtr  dtd,
const xmlChar name,
int  create 
)
static

Definition at line 3206 of file valid.c.

3206  {
3208  xmlElementPtr cur;
3209  xmlChar *uqname = NULL, *prefix = NULL;
3210 
3211  if (dtd == NULL) return(NULL);
3212  if (dtd->elements == NULL) {
3213  xmlDictPtr dict = NULL;
3214 
3215  if (dtd->doc != NULL)
3216  dict = dtd->doc->dict;
3217 
3218  if (!create)
3219  return(NULL);
3220  /*
3221  * Create the Element table if needed.
3222  */
3224  if (table == NULL) {
3225  table = xmlHashCreateDict(0, dict);
3226  dtd->elements = (void *) table;
3227  }
3228  if (table == NULL) {
3229  xmlVErrMemory(NULL, "element table allocation failed");
3230  return(NULL);
3231  }
3232  }
3234 
3235  uqname = xmlSplitQName2(name, &prefix);
3236  if (uqname != NULL)
3237  name = uqname;
3238  cur = xmlHashLookup2(table, name, prefix);
3239  if ((cur == NULL) && (create)) {
3240  cur = (xmlElementPtr) xmlMalloc(sizeof(xmlElement));
3241  if (cur == NULL) {
3242  xmlVErrMemory(NULL, "malloc failed");
3243  return(NULL);
3244  }
3245  memset(cur, 0, sizeof(xmlElement));
3246  cur->type = XML_ELEMENT_DECL;
3247 
3248  /*
3249  * fill the structure.
3250  */
3251  cur->name = xmlStrdup(name);
3252  cur->prefix = xmlStrdup(prefix);
3254 
3255  xmlHashAddEntry2(table, name, prefix, cur);
3256  }
3257  if (prefix != NULL) xmlFree(prefix);
3258  if (uqname != NULL) xmlFree(uqname);
3259  return(cur);
3260 }
struct _xmlDoc * doc
Definition: tree.h:415
XMLPUBFUN int XMLCALL xmlHashAddEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, void *userdata)
Definition: hash.c:404
xmlElementTypeVal etype
Definition: tree.h:357
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
static void xmlVErrMemory(xmlValidCtxtPtr ctxt, const char *extra)
Definition: valid.c:58
const xmlChar * prefix
Definition: tree.h:360
xmlElementTable * xmlElementTablePtr
Definition: valid.h:126
XMLPUBFUN void *XMLCALL xmlHashLookup2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2)
Definition: hash.c:474
xmlElementType type
Definition: tree.h:348
smooth NULL
Definition: ftsmooth.c:416
const xmlChar * name
Definition: tree.h:349
if(!(yy_init))
Definition: macro.lex.yy.c:714
xmlElement * xmlElementPtr
Definition: tree.h:345
void * elements
Definition: tree.h:419
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
unsigned char xmlChar
Definition: xmlstring.h:28
__XML_EXTERNC typedef xmlDict * xmlDictPtr
Definition: dict.h:24
XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreateDict(int size, xmlDictPtr dict)
Definition: hash.c:208
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
Definition: name.c:36
#define memset(x, y, z)
Definition: compat.h:39
static const struct access_res create[16]
Definition: package.c:7720
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:66
XMLPUBFUN xmlChar *XMLCALL xmlSplitQName2(const xmlChar *name, xmlChar **prefix)

Referenced by xmlAddAttributeDecl().

◆ xmlGetDtdNotationDesc()

xmlNotationPtr xmlGetDtdNotationDesc ( xmlDtdPtr  dtd,
const xmlChar name 
)

Definition at line 3357 of file valid.c.

3357  {
3359 
3360  if (dtd == NULL) return(NULL);
3361  if (dtd->notations == NULL) return(NULL);
3363 
3364  return(xmlHashLookup(table, name));
3365 }
void * notations
Definition: tree.h:418
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
smooth NULL
Definition: ftsmooth.c:416
xmlNotationTable * xmlNotationTablePtr
Definition: valid.h:118
Definition: name.c:36
XMLPUBFUN void *XMLCALL xmlHashLookup(xmlHashTablePtr table, const xmlChar *name)
Definition: hash.c:459

◆ xmlGetDtdQAttrDesc()

xmlAttributePtr xmlGetDtdQAttrDesc ( xmlDtdPtr  dtd,
const xmlChar elem,
const xmlChar name,
const xmlChar prefix 
)

Definition at line 3335 of file valid.c.

3336  {
3338 
3339  if (dtd == NULL) return(NULL);
3340  if (dtd->attributes == NULL) return(NULL);
3342 
3343  return(xmlHashLookup3(table, name, prefix, elem));
3344 }
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
void * attributes
Definition: tree.h:420
static size_t elem
Definition: string.c:68
smooth NULL
Definition: ftsmooth.c:416
xmlAttributeTable * xmlAttributeTablePtr
Definition: valid.h:134
XMLPUBFUN void *XMLCALL xmlHashLookup3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3)
Definition: hash.c:767
Definition: name.c:36

◆ xmlGetDtdQElementDesc()

xmlElementPtr xmlGetDtdQElementDesc ( xmlDtdPtr  dtd,
const xmlChar name,
const xmlChar prefix 
)

Definition at line 3274 of file valid.c.

3275  {
3277 
3278  if (dtd == NULL) return(NULL);
3279  if (dtd->elements == NULL) return(NULL);
3281 
3282  return(xmlHashLookup2(table, name, prefix));
3283 }
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
xmlElementTable * xmlElementTablePtr
Definition: valid.h:126
XMLPUBFUN void *XMLCALL xmlHashLookup2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2)
Definition: hash.c:474
smooth NULL
Definition: ftsmooth.c:416
void * elements
Definition: tree.h:419
Definition: name.c:36

◆ xmlGetID()

xmlAttrPtr xmlGetID ( xmlDocPtr  doc,
const xmlChar ID 
)

xmlGetID: @doc: pointer to the document @ID: the ID value

Search the attribute declaring the given ID

Returns NULL if not found, otherwise the xmlAttrPtr defining the ID

Definition at line 2803 of file valid.c.

2803  {
2805  xmlIDPtr id;
2806 
2807  if (doc == NULL) {
2808  return(NULL);
2809  }
2810 
2811  if (ID == NULL) {
2812  return(NULL);
2813  }
2814 
2815  table = (xmlIDTablePtr) doc->ids;
2816  if (table == NULL)
2817  return(NULL);
2818 
2819  id = xmlHashLookup(table, ID);
2820  if (id == NULL)
2821  return(NULL);
2822  if (id->attr == NULL) {
2823  /*
2824  * We are operating on a stream, return a well known reference
2825  * since the attribute node doesn't exist anymore
2826  */
2827  return((xmlAttrPtr) doc);
2828  }
2829  return(id->attr);
2830 }
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
smooth NULL
Definition: ftsmooth.c:416
void * ids
Definition: tree.h:575
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define ID
Definition: ruserpass.c:36
xmlIDTable * xmlIDTablePtr
Definition: valid.h:142
Definition: tree.h:434
GLenum GLuint id
Definition: glext.h:5579
XMLPUBFUN void *XMLCALL xmlHashLookup(xmlHashTablePtr table, const xmlChar *name)
Definition: hash.c:459
Definition: tree.h:457

Referenced by xsltLoadStylesheetPI(), and xsltTestCompMatch().

◆ xmlGetRefs()

xmlListPtr xmlGetRefs ( xmlDocPtr  doc,
const xmlChar ID 
)

xmlGetRefs: @doc: pointer to the document @ID: the ID value

Find the set of references for the supplied ID.

Returns NULL if not found, otherwise node set for the ID.

Definition at line 3141 of file valid.c.

3141  {
3143 
3144  if (doc == NULL) {
3145  return(NULL);
3146  }
3147 
3148  if (ID == NULL) {
3149  return(NULL);
3150  }
3151 
3152  table = (xmlRefTablePtr) doc->refs;
3153  if (table == NULL)
3154  return(NULL);
3155 
3156  return (xmlHashLookup(table, ID));
3157 }
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
void * refs
Definition: tree.h:576
smooth NULL
Definition: ftsmooth.c:416
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define ID
Definition: ruserpass.c:36
xmlRefTable * xmlRefTablePtr
Definition: valid.h:150
XMLPUBFUN void *XMLCALL xmlHashLookup(xmlHashTablePtr table, const xmlChar *name)
Definition: hash.c:459

◆ xmlIsID()

int xmlIsID ( xmlDocPtr  doc,
xmlNodePtr  elem,
xmlAttrPtr  attr 
)

xmlIsID: @doc: the document @elem: the element carrying the attribute @attr: the attribute

Determine whether an attribute is of type ID. In case we have DTD(s) then this is done if DTD loading has been requested. In the case of HTML documents parsed with the HTML parser, then ID detection is done systematically.

Returns 0 or 1 depending on the lookup result

Definition at line 2704 of file valid.c.

2704  {
2705  if ((attr == NULL) || (attr->name == NULL)) return(0);
2706  if ((attr->ns != NULL) && (attr->ns->prefix != NULL) &&
2707  (!strcmp((char *) attr->name, "id")) &&
2708  (!strcmp((char *) attr->ns->prefix, "xml")))
2709  return(1);
2710  if (doc == NULL) return(0);
2711  if ((doc->intSubset == NULL) && (doc->extSubset == NULL) &&
2712  (doc->type != XML_HTML_DOCUMENT_NODE)) {
2713  return(0);
2714  } else if (doc->type == XML_HTML_DOCUMENT_NODE) {
2715  if ((xmlStrEqual(BAD_CAST "id", attr->name)) ||
2716  ((xmlStrEqual(BAD_CAST "name", attr->name)) &&
2717  ((elem == NULL) || (xmlStrEqual(elem->name, BAD_CAST "a")))))
2718  return(1);
2719  return(0);
2720  } else if (elem == NULL) {
2721  return(0);
2722  } else {
2723  xmlAttributePtr attrDecl = NULL;
2724 
2725  xmlChar felem[50], fattr[50];
2726  xmlChar *fullelemname, *fullattrname;
2727 
2728  fullelemname = (elem->ns != NULL && elem->ns->prefix != NULL) ?
2729  xmlBuildQName(elem->name, elem->ns->prefix, felem, 50) :
2730  (xmlChar *)elem->name;
2731 
2732  fullattrname = (attr->ns != NULL && attr->ns->prefix != NULL) ?
2733  xmlBuildQName(attr->name, attr->ns->prefix, fattr, 50) :
2734  (xmlChar *)attr->name;
2735 
2736  if (fullelemname != NULL && fullattrname != NULL) {
2737  attrDecl = xmlGetDtdAttrDesc(doc->intSubset, fullelemname,
2738  fullattrname);
2739  if ((attrDecl == NULL) && (doc->extSubset != NULL))
2740  attrDecl = xmlGetDtdAttrDesc(doc->extSubset, fullelemname,
2741  fullattrname);
2742  }
2743 
2744  if ((fullattrname != fattr) && (fullattrname != attr->name))
2745  xmlFree(fullattrname);
2746  if ((fullelemname != felem) && (fullelemname != elem->name))
2747  xmlFree(fullelemname);
2748 
2749  if ((attrDecl != NULL) && (attrDecl->atype == XML_ATTRIBUTE_ID))
2750  return(1);
2751  }
2752  return(0);
2753 }
xmlElementType type
Definition: tree.h:553
XMLPUBFUN xmlChar *XMLCALL xmlBuildQName(const xmlChar *ncname, const xmlChar *prefix, xmlChar *memory, int len)
struct _xmlDtd * intSubset
Definition: tree.h:570
Definition: fatfs.h:133
static size_t elem
Definition: string.c:68
smooth NULL
Definition: ftsmooth.c:416
xmlAttributeType atype
Definition: tree.h:265
#define BAD_CAST
Definition: xmlstring.h:35
xmlAttributePtr xmlGetDtdAttrDesc(xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name)
Definition: valid.c:3298
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
Definition: cookie.c:170
unsigned char xmlChar
Definition: xmlstring.h:28
struct _xmlDtd * extSubset
Definition: tree.h:571
Definition: name.c:36
WCHAR * name
Definition: cookie.c:172
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:157

Referenced by xmlSAX2AttributeNs(), xsltAttribute(), and xsltAttrListTemplateProcess().

◆ xmlIsMixedElement()

int xmlIsMixedElement ( xmlDocPtr  doc,
const xmlChar name 
)

The public function calls related to validity checking.

Definition at line 3413 of file valid.c.

3413  {
3414  xmlElementPtr elemDecl;
3415 
3416  if ((doc == NULL) || (doc->intSubset == NULL)) return(-1);
3417 
3418  elemDecl = xmlGetDtdElementDesc(doc->intSubset, name);
3419  if ((elemDecl == NULL) && (doc->extSubset != NULL))
3420  elemDecl = xmlGetDtdElementDesc(doc->extSubset, name);
3421  if (elemDecl == NULL) return(-1);
3422  switch (elemDecl->etype) {
3424  return(-1);
3426  return(0);
3428  /*
3429  * return 1 for EMPTY since we want VC error to pop up
3430  * on <empty> </empty> for example
3431  */
3432  case XML_ELEMENT_TYPE_ANY:
3434  return(1);
3435  }
3436  return(1);
3437 }
struct _xmlDtd * intSubset
Definition: tree.h:570
xmlElementTypeVal etype
Definition: tree.h:357
xmlElementPtr xmlGetDtdElementDesc(xmlDtdPtr dtd, const xmlChar *name)
Definition: valid.c:3176
smooth NULL
Definition: ftsmooth.c:416
struct _xmlDtd * extSubset
Definition: tree.h:571
Definition: name.c:36

Referenced by areBlanks().

◆ xmlIsRef()

int xmlIsRef ( xmlDocPtr  doc,
xmlNodePtr  elem,
xmlAttrPtr  attr 
)

xmlIsRef: @doc: the document @elem: the element carrying the attribute @attr: the attribute

Determine whether an attribute is of type Ref. In case we have DTD(s) then this is simple, otherwise we use an heuristic: name Ref (upper or lowercase).

Returns 0 or 1 depending on the lookup result

Definition at line 3045 of file valid.c.

3045  {
3046  if (attr == NULL)
3047  return(0);
3048  if (doc == NULL) {
3049  doc = attr->doc;
3050  if (doc == NULL) return(0);
3051  }
3052 
3053  if ((doc->intSubset == NULL) && (doc->extSubset == NULL)) {
3054  return(0);
3055  } else if (doc->type == XML_HTML_DOCUMENT_NODE) {
3056  /* TODO @@@ */
3057  return(0);
3058  } else {
3059  xmlAttributePtr attrDecl;
3060 
3061  if (elem == NULL) return(0);
3062  attrDecl = xmlGetDtdAttrDesc(doc->intSubset, elem->name, attr->name);
3063  if ((attrDecl == NULL) && (doc->extSubset != NULL))
3064  attrDecl = xmlGetDtdAttrDesc(doc->extSubset,
3065  elem->name, attr->name);
3066 
3067  if ((attrDecl != NULL) &&
3068  (attrDecl->atype == XML_ATTRIBUTE_IDREF ||
3069  attrDecl->atype == XML_ATTRIBUTE_IDREFS))
3070  return(1);
3071  }
3072  return(0);
3073 }
xmlElementType type
Definition: tree.h:553
struct _xmlDtd * intSubset
Definition: tree.h:570
static size_t elem
Definition: string.c:68
smooth NULL
Definition: ftsmooth.c:416
xmlAttributeType atype
Definition: tree.h:265
xmlAttributePtr xmlGetDtdAttrDesc(xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name)
Definition: valid.c:3298
Definition: cookie.c:170
struct _xmlDtd * extSubset
Definition: tree.h:571
WCHAR * name
Definition: cookie.c:172

Referenced by xmlSAX2AttributeNs().

◆ xmlNewDocElementContent()

xmlElementContentPtr xmlNewDocElementContent ( xmlDocPtr  doc,
const xmlChar name,
xmlElementContentType  type 
)

Definition at line 921 of file valid.c.

922  {
924  xmlDictPtr dict = NULL;
925 
926  if (doc != NULL)
927  dict = doc->dict;
928 
929  switch(type) {
931  if (name == NULL) {
932  xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR,
933  "xmlNewElementContent : name == NULL !\n",
934  NULL);
935  }
936  break;
940  if (name != NULL) {
941  xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR,
942  "xmlNewElementContent : name != NULL !\n",
943  NULL);
944  }
945  break;
946  default:
947  xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR,
948  "Internal: ELEMENT content corrupted invalid type\n",
949  NULL);
950  return(NULL);
951  }
953  if (ret == NULL) {
954  xmlVErrMemory(NULL, "malloc failed");
955  return(NULL);
956  }
957  memset(ret, 0, sizeof(xmlElementContent));
958  ret->type = type;
960  if (name != NULL) {
961  int l;
962  const xmlChar *tmp;
963 
964  tmp = xmlSplitQName3(name, &l);
965  if (tmp == NULL) {
966  if (dict == NULL)
967  ret->name = xmlStrdup(name);
968  else
969  ret->name = xmlDictLookup(dict, name, -1);
970  } else {
971  if (dict == NULL) {
972  ret->prefix = xmlStrndup(name, l);
973  ret->name = xmlStrdup(tmp);
974  } else {
975  ret->prefix = xmlDictLookup(dict, name, l);
976  ret->name = xmlDictLookup(dict, tmp, -1);
977  }
978  }
979  }
980  return(ret);
981 }
XMLPUBFUN const xmlChar *XMLCALL xmlSplitQName3(const xmlChar *name, int *len)
XMLPUBFUN xmlChar *XMLCALL xmlStrndup(const xmlChar *cur, int len)
Definition: xmlstring.c:41
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static void xmlVErrMemory(xmlValidCtxtPtr ctxt, const char *extra)
Definition: valid.c:58
smooth NULL
Definition: ftsmooth.c:416
r l[0]
Definition: byte_order.h:167
XMLPUBFUN const xmlChar *XMLCALL xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len)
Definition: dict.c:858
int ret
unsigned char xmlChar
Definition: xmlstring.h:28
__XML_EXTERNC typedef xmlDict * xmlDictPtr
Definition: dict.h:24
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
Definition: name.c:36
#define memset(x, y, z)
Definition: compat.h:39
struct _xmlDict * dict
Definition: tree.h:580
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:66
xmlElementContent * xmlElementContentPtr
Definition: tree.h:305

Referenced by xmlNewElementContent(), xmlParseElementChildrenContentDeclPriv(), and xmlParseElementMixedContentDecl().

◆ xmlNewElementContent()

xmlElementContentPtr xmlNewElementContent ( const xmlChar name,
xmlElementContentType  type 
)

Definition at line 994 of file valid.c.

994  {
996 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
xmlElementContentPtr xmlNewDocElementContent(xmlDocPtr doc, const xmlChar *name, xmlElementContentType type)
Definition: valid.c:921
smooth NULL
Definition: ftsmooth.c:416
Definition: name.c:36

◆ xmlRemoveID()

int xmlRemoveID ( xmlDocPtr  doc,
xmlAttrPtr  attr 
)

xmlRemoveID: @doc: the document @attr: the attribute

Remove the given attribute from the ID table maintained internally.

Returns -1 if the lookup failed and 0 otherwise

Definition at line 2765 of file valid.c.

2765  {
2767  xmlIDPtr id;
2768  xmlChar *ID;
2769 
2770  if (doc == NULL) return(-1);
2771  if (attr == NULL) return(-1);
2772 
2773  table = (xmlIDTablePtr) doc->ids;
2774  if (table == NULL)
2775  return(-1);
2776 
2777  ID = xmlNodeListGetString(doc, attr->children, 1);
2778  if (ID == NULL)
2779  return(-1);
2780 
2781  id = xmlHashLookup(table, ID);
2782  if (id == NULL || id->attr != attr) {
2783  xmlFree(ID);
2784  return(-1);
2785  }
2786 
2788  xmlFree(ID);
2789  attr->atype = 0;
2790  return(0);
2791 }
XMLPUBFUN int XMLCALL xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name, xmlHashDeallocator f)
Definition: hash.c:1050
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
smooth NULL
Definition: ftsmooth.c:416
void * ids
Definition: tree.h:575
static void xmlFreeIDTableEntry(void *id, const xmlChar *name ATTRIBUTE_UNUSED)
Definition: valid.c:2675
if(!(yy_init))
Definition: macro.lex.yy.c:714
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
Definition: cookie.c:170
XMLPUBFUN xmlChar *XMLCALL xmlNodeListGetString(xmlDocPtr doc, const xmlNode *list, int inLine)
unsigned char xmlChar
Definition: xmlstring.h:28
#define ID
Definition: ruserpass.c:36
xmlIDTable * xmlIDTablePtr
Definition: valid.h:142
GLenum GLuint id
Definition: glext.h:5579
XMLPUBFUN void *XMLCALL xmlHashLookup(xmlHashTablePtr table, const xmlChar *name)
Definition: hash.c:459
Definition: tree.h:457

◆ xmlRemoveRef()

int xmlRemoveRef ( xmlDocPtr  doc,
xmlAttrPtr  attr 
)

xmlRemoveRef: @doc: the document @attr: the attribute

Remove the given attribute from the Ref table maintained internally.

Returns -1 if the lookup failed and 0 otherwise

Definition at line 3085 of file valid.c.

3085  {
3086  xmlListPtr ref_list;
3088  xmlChar *ID;
3090 
3091  if (doc == NULL) return(-1);
3092  if (attr == NULL) return(-1);
3093 
3094  table = (xmlRefTablePtr) doc->refs;
3095  if (table == NULL)
3096  return(-1);
3097 
3098  ID = xmlNodeListGetString(doc, attr->children, 1);
3099  if (ID == NULL)
3100  return(-1);
3101 
3102  ref_list = xmlHashLookup(table, ID);
3103  if(ref_list == NULL) {
3104  xmlFree(ID);
3105  return (-1);
3106  }
3107 
3108  /* At this point, ref_list refers to a list of references which
3109  * have the same key as the supplied attr. Our list of references
3110  * is ordered by reference address and we don't have that information
3111  * here to use when removing. We'll have to walk the list and
3112  * check for a matching attribute, when we find one stop the walk
3113  * and remove the entry.
3114  * The list is ordered by reference, so that means we don't have the
3115  * key. Passing the list and the reference to the walker means we
3116  * will have enough data to be able to remove the entry.
3117  */
3118  target.l = ref_list;
3119  target.ap = attr;
3120 
3121  /* Remove the supplied attr from our list */
3122  xmlListWalk(ref_list, xmlWalkRemoveRef, &target);
3123 
3124  /*If the list is empty then remove the list entry in the hash */
3125  if (xmlListEmpty(ref_list))
3127  xmlFree(ID);
3128  return(0);
3129 }
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
XMLPUBFUN int XMLCALL xmlListEmpty(xmlListPtr l)
Definition: list.c:446
void * refs
Definition: tree.h:576
XMLPUBFUN void XMLCALL xmlListWalk(xmlListPtr l, xmlListWalker walker, void *user)
Definition: list.c:676
smooth NULL
Definition: ftsmooth.c:416
if(!(yy_init))
Definition: macro.lex.yy.c:714
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
Definition: cookie.c:170
XMLPUBFUN xmlChar *XMLCALL xmlNodeListGetString(xmlDocPtr doc, const xmlNode *list, int inLine)
__u8 attr
Definition: mkdosfs.c:359
unsigned char xmlChar
Definition: xmlstring.h:28
#define ID
Definition: ruserpass.c:36
XMLPUBFUN int XMLCALL xmlHashUpdateEntry(xmlHashTablePtr table, const xmlChar *name, void *userdata, xmlHashDeallocator f)
Definition: hash.c:423
Definition: list.c:38
xmlRefTable * xmlRefTablePtr
Definition: valid.h:150
GLenum target
Definition: glext.h:7315
XMLPUBFUN void *XMLCALL xmlHashLookup(xmlHashTablePtr table, const xmlChar *name)
Definition: hash.c:459
static void xmlFreeRefTableEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED)
Definition: valid.c:2877
static int xmlWalkRemoveRef(const void *data, void *user)
Definition: valid.c:2891

◆ xmlSnprintfElementContent()

void xmlSnprintfElementContent ( char buf,
int  size,
xmlElementContentPtr  content,
int  englob 
)

xmlSnprintfElementContent: @buf: an output buffer @size: the buffer size @content: An element table @englob: 1 if one must print the englobing parenthesis, 0 otherwise

This will dump the content of the element content definition Intended just for the debug routine

Definition at line 1254 of file valid.c.

1254  {
1255  int len;
1256 
1257  if (content == NULL) return;
1258  len = strlen(buf);
1259  if (size - len < 50) {
1260  if ((size - len > 4) && (buf[len - 1] != '.'))
1261  strcat(buf, " ...");
1262  return;
1263  }
1264  if (englob) strcat(buf, "(");
1265  switch (content->type) {
1267  strcat(buf, "#PCDATA");
1268  break;
1270  int qnameLen = xmlStrlen(content->name);
1271 
1272  if (content->prefix != NULL)
1273  qnameLen += xmlStrlen(content->prefix) + 1;
1274  if (size - len < qnameLen + 10) {
1275  strcat(buf, " ...");
1276  return;
1277  }
1278  if (content->prefix != NULL) {
1279  strcat(buf, (char *) content->prefix);
1280  strcat(buf, ":");
1281  }
1282  if (content->name != NULL)
1283  strcat(buf, (char *) content->name);
1284  break;
1285  }
1287  if ((content->c1->type == XML_ELEMENT_CONTENT_OR) ||
1288  (content->c1->type == XML_ELEMENT_CONTENT_SEQ))
1290  else
1292  len = strlen(buf);
1293  if (size - len < 50) {
1294  if ((size - len > 4) && (buf[len - 1] != '.'))
1295  strcat(buf, " ...");
1296  return;
1297  }
1298  strcat(buf, " , ");
1299  if (((content->c2->type == XML_ELEMENT_CONTENT_OR) ||
1300  (content->c2->ocur != XML_ELEMENT_CONTENT_ONCE)) &&
1301  (content->c2->type != XML_ELEMENT_CONTENT_ELEMENT))
1303  else
1305  break;
1307  if ((content->c1->type == XML_ELEMENT_CONTENT_OR) ||
1308  (content->c1->type == XML_ELEMENT_CONTENT_SEQ))
1310  else
1312  len = strlen(buf);
1313  if (size - len < 50) {
1314  if ((size - len > 4) && (buf[len - 1] != '.'))
1315  strcat(buf, " ...");
1316  return;
1317  }
1318  strcat(buf, " | ");
1319  if (((content->c2->type == XML_ELEMENT_CONTENT_SEQ) ||
1320  (content->c2->ocur != XML_ELEMENT_CONTENT_ONCE)) &&
1321  (content->c2->type != XML_ELEMENT_CONTENT_ELEMENT))
1323  else
1325  break;
1326  }
1327  if (size - strlen(buf) <= 2) return;
1328  if (englob)
1329  strcat(buf, ")");
1330  switch (content->ocur) {
1332  break;
1334  strcat(buf, "?");
1335  break;
1337  strcat(buf, "*");
1338  break;
1340  strcat(buf, "+");
1341  break;
1342  }
1343 }
void xmlSnprintfElementContent(char *buf, int size, xmlElementContentPtr content, int englob)
Definition: valid.c:1254
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
XMLPUBFUN int XMLCALL xmlStrlen(const xmlChar *str)
Definition: xmlstring.c:422
content
Definition: atl_ax.c:994
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
GLenum GLsizei len
Definition: glext.h:6722

◆ xmlVErrMemory()

static void xmlVErrMemory ( xmlValidCtxtPtr  ctxt,
const char extra 
)
static

xmlVErrMemory: @ctxt: an XML validation parser context @extra: extra informations

Handle an out of memory error

Definition at line 58 of file valid.c.

59 {
60  xmlGenericErrorFunc channel = NULL;
61  xmlParserCtxtPtr pctxt = NULL;
62  void *data = NULL;
63 
64  if (ctxt != NULL) {
65  channel = ctxt->error;
66  data = ctxt->userData;
67  /* Use the special values to detect if it is part of a parsing
68  context */
69  if ((ctxt->finishDtd == XML_CTXT_FINISH_DTD_0) ||
70  (ctxt->finishDtd == XML_CTXT_FINISH_DTD_1)) {
71  long delta = (char *) ctxt - (char *) ctxt->userData;
72  if ((delta > 0) && (delta < 250))
73  pctxt = ctxt->userData;
74  }
75  }
76  if (extra)
77  __xmlRaiseError(NULL, channel, data,
79  XML_ERR_FATAL, NULL, 0, extra, NULL, NULL, 0, 0,
80  "Memory allocation failed : %s\n", extra);
81  else
82  __xmlRaiseError(NULL, channel, data,
84  XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, 0, 0,
85  "Memory allocation failed\n");
86 }
unsigned int finishDtd
Definition: valid.h:93
xmlValidityErrorFunc error
Definition: valid.h:84
smooth NULL
Definition: ftsmooth.c:416
Definition: id3.c:18
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
void(XMLCDECL * xmlGenericErrorFunc)(void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
Definition: xmlerror.h:845
void * userData
Definition: valid.h:83

Referenced by xmlAddAttributeDecl(), xmlAddElementDecl(), xmlAddID(), xmlAddNotationDecl(), xmlAddRef(), xmlCopyDocElementContent(), xmlCreateEnumeration(), xmlGetDtdElementDesc2(), and xmlNewDocElementContent().

◆ xmlWalkRemoveRef()

static int xmlWalkRemoveRef ( const void data,
void user 
)
static

xmlWalkRemoveRef: @data: Contents of current link @user: Value supplied by the user

Returns 0 to abort the walk or 1 to continue

Definition at line 2891 of file valid.c.

2892 {
2893  xmlAttrPtr attr0 = ((xmlRefPtr)data)->attr;
2894  xmlAttrPtr attr1 = ((xmlRemoveMemoPtr)user)->ap;
2895  xmlListPtr ref_list = ((xmlRemoveMemoPtr)user)->l;
2896 
2897  if (attr0 == attr1) { /* Matched: remove and terminate walk */
2898  xmlListRemoveFirst(ref_list, (void *)data);
2899  return 0;
2900  }
2901  return 1;
2902 }
XMLPUBFUN int XMLCALL xmlListRemoveFirst(xmlListPtr l, void *data)
Definition: list.c:353
xmlRef * xmlRefPtr
Definition: tree.h:473
xmlRemoveMemo * xmlRemoveMemoPtr
Definition: valid.c:2843
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
Definition: list.c:38
Definition: tree.h:434
void user(int argc, const char *argv[])
Definition: cmds.c:1350

Referenced by xmlRemoveRef().