Lines Matching defs:elem
632 /* TODO: use hash table for accesses to elem and attribute definitions */
805 * @elem: an element declaration node
813 xmlValidBuildContentModel(xmlValidCtxtPtr ctxt, xmlElementPtr elem) {
815 if ((ctxt == NULL) || (elem == NULL))
817 if (elem->type != XML_ELEMENT_DECL)
819 if (elem->etype != XML_ELEMENT_TYPE_ELEMENT)
822 if (elem->contModel != NULL) {
823 if (!xmlRegexpIsDeterminist(elem->contModel)) {
832 xmlErrValidNode(ctxt, (xmlNodePtr) elem,
835 elem->name, NULL, NULL);
839 xmlValidBuildAContentModel(elem->content, ctxt, elem->name);
841 elem->contModel = xmlAutomataCompile(ctxt->am);
842 if (xmlRegexpIsDeterminist(elem->contModel) != 1) {
845 xmlSnprintfElementContent(expr, 5000, elem->content, 1);
846 xmlErrValidNode(ctxt, (xmlNodePtr) elem,
849 elem->name, BAD_CAST expr, NULL);
851 xmlRegexpPrint(stderr, elem->contModel);
1347 * @elem: An element
1352 xmlFreeElement(xmlElementPtr elem) {
1353 if (elem == NULL) return;
1354 xmlUnlinkNode((xmlNodePtr) elem);
1355 xmlFreeDocElementContent(elem->doc, elem->content);
1356 if (elem->name != NULL)
1357 xmlFree((xmlChar *) elem->name);
1358 if (elem->prefix != NULL)
1359 xmlFree((xmlChar *) elem->prefix);
1361 if (elem->contModel != NULL)
1362 xmlRegFreeRegexp(elem->contModel);
1364 xmlFree(elem);
1608 * @elem: An element
1615 xmlCopyElement(xmlElementPtr elem) {
1625 cur->etype = elem->etype;
1626 if (elem->name != NULL)
1627 cur->name = xmlStrdup(elem->name);
1630 if (elem->prefix != NULL)
1631 cur->prefix = xmlStrdup(elem->prefix);
1634 cur->content = xmlCopyElementContent(elem->content);
1659 * @elem: An element table
1665 xmlDumpElementDecl(xmlBufferPtr buf, xmlElementPtr elem) {
1666 if ((buf == NULL) || (elem == NULL))
1668 switch (elem->etype) {
1671 if (elem->prefix != NULL) {
1672 xmlBufferWriteCHAR(buf, elem->prefix);
1675 xmlBufferWriteCHAR(buf, elem->name);
1680 if (elem->prefix != NULL) {
1681 xmlBufferWriteCHAR(buf, elem->prefix);
1684 xmlBufferWriteCHAR(buf, elem->name);
1689 if (elem->prefix != NULL) {
1690 xmlBufferWriteCHAR(buf, elem->prefix);
1693 xmlBufferWriteCHAR(buf, elem->name);
1695 xmlDumpElementContent(buf, elem->content, 1);
1700 if (elem->prefix != NULL) {
1701 xmlBufferWriteCHAR(buf, elem->prefix);
1704 xmlBufferWriteCHAR(buf, elem->name);
1706 xmlDumpElementContent(buf, elem->content, 1);
1718 * @elem: An element table
1725 xmlDumpElementDeclScan(xmlElementPtr elem, xmlBufferPtr buf) {
1726 xmlDumpElementDecl(buf, elem);
1837 * @elem: the element name
1846 xmlScanIDAttributeDecl(xmlValidCtxtPtr ctxt, xmlElementPtr elem, int err) {
1850 if (elem == NULL) return(0);
1851 cur = elem->attributes;
1856 xmlErrValidNode(ctxt, (xmlNodePtr) elem, XML_DTD_MULTIPLE_ID,
1858 elem->name, cur->name, NULL);
1868 * @elem: An attribute
1885 if ((attr->elem != NULL) && (!xmlDictOwns(dict, attr->elem)))
1886 xmlFree((xmlChar *) attr->elem);
1895 if (attr->elem != NULL)
1896 xmlFree((xmlChar *) attr->elem);
1912 * @elem: the element name
1927 xmlDtdPtr dtd, const xmlChar *elem,
1944 if (elem == NULL) {
1987 elem, name, defaultValue);
2001 ret = xmlHashLookup3(dtd->doc->intSubset->attributes, name, ns, elem);
2046 ret->elem = xmlDictLookup(dict, elem, -1);
2050 ret->elem = xmlStrdup(elem);
2065 if (xmlHashAddEntry3(table, ret->name, ret->prefix, ret->elem, ret) < 0) {
2072 name, elem, NULL);
2082 elemDef = xmlGetDtdElementDesc2(dtd, elem, 1);
2090 elem, name, NULL);
2174 if (attr->elem != NULL)
2175 cur->elem = xmlStrdup(attr->elem);
2214 xmlBufferWriteCHAR(buf, attr->elem);
2664 * @elem: the element carrying the attribute
2675 xmlIsID(xmlDocPtr doc, xmlNodePtr elem, xmlAttrPtr attr) {
2688 ((elem == NULL) || (xmlStrEqual(elem->name, BAD_CAST "a")))))
2691 } else if (elem == NULL) {
2699 fullelemname = (elem->ns != NULL && elem->ns->prefix != NULL) ?
2700 xmlBuildQName(elem->name, elem->ns->prefix, felem, 50) :
2701 (xmlChar *)elem->name;
2717 if ((fullelemname != felem) && (fullelemname != elem->name))
3005 * @elem: the element carrying the attribute
3015 xmlIsRef(xmlDocPtr doc, xmlNodePtr elem, xmlAttrPtr attr) {
3031 if (elem == NULL) return(0);
3032 attrDecl = xmlGetDtdAttrDesc(doc->intSubset, elem->name, attr->name);
3035 elem->name, attr->name);
3259 * @elem: the element name
3269 xmlGetDtdAttrDesc(xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name) {
3284 cur = xmlHashLookup3(table, uqname, prefix, elem);
3288 cur = xmlHashLookup3(table, name, NULL, elem);
3295 * @elem: the element name
3306 xmlGetDtdQAttrDesc(xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name,
3314 return(xmlHashLookup3(table, name, prefix, elem));
3936 * @elem: the parent
3958 xmlNodePtr elem, const xmlChar *name, const xmlChar *value) {
3965 if (elem == NULL) return(NULL);
3969 if ((elem->ns != NULL) && (elem->ns->prefix != NULL)) {
3973 fullname = xmlBuildQName(elem->name, elem->ns->prefix, fn, 50);
3982 if ((fullname != fn) && (fullname != elem->name))
3986 attrDecl = xmlGetDtdAttrDesc(doc->intSubset, elem->name, name);
3988 attrDecl = xmlGetDtdAttrDesc(doc->extSubset, elem->name, name);
4015 xmlErrValidNode(ctxt, elem, XML_DTD_NOT_STANDALONE,
4017 name, elem->name, NULL);
4026 * @elem: the parent
4043 xmlValidNormalizeAttributeValue(xmlDocPtr doc, xmlNodePtr elem,
4050 if (elem == NULL) return(NULL);
4054 if ((elem->ns != NULL) && (elem->ns->prefix != NULL)) {
4058 fullname = xmlBuildQName(elem->name, elem->ns->prefix, fn, 50);
4061 if ((fullname != fn) && (fullname != elem->name))
4064 attrDecl = xmlGetDtdAttrDesc(doc->intSubset, elem->name, name);
4066 attrDecl = xmlGetDtdAttrDesc(doc->extSubset, elem->name, name);
4132 attr->name, attr->elem, NULL);
4143 attr->name, attr->elem, NULL);
4152 xmlElementPtr elem = xmlGetDtdElementDesc(doc->intSubset,
4153 attr->elem);
4154 if (elem != NULL) {
4155 nbId = xmlScanIDAttributeDecl(NULL, elem, 0);
4166 xmlHashScan3(table, NULL, NULL, attr->elem, (xmlHashScanner)
4174 attr->elem, nbId, attr->name);
4177 elem = xmlGetDtdElementDesc(doc->extSubset, attr->elem);
4178 if (elem != NULL) {
4179 extId = xmlScanIDAttributeDecl(NULL, elem, 0);
4184 attr->elem, extId, attr->name);
4188 attr->elem, attr->name, NULL);
4203 attr->defaultValue, attr->name, attr->elem);
4215 * @elem: an element definition
4229 xmlElementPtr elem) {
4235 if (elem == NULL) return(1);
4240 ret = xmlValidBuildContentModel(ctxt, elem);
4245 if (elem->etype == XML_ELEMENT_TYPE_MIXED) {
4249 cur = elem->content;
4261 xmlErrValidNode(ctxt, (xmlNodePtr) elem, XML_DTD_CONTENT_ERROR,
4263 elem->name, name, NULL);
4265 xmlErrValidNode(ctxt, (xmlNodePtr) elem, XML_DTD_CONTENT_ERROR,
4267 elem->name, cur->c1->prefix, name);
4278 xmlErrValidNode(ctxt, (xmlNodePtr) elem, XML_DTD_CONTENT_ERROR,
4280 elem->name, name, NULL);
4282 xmlErrValidNode(ctxt, (xmlNodePtr) elem, XML_DTD_CONTENT_ERROR,
4284 elem->name, cur->c1->prefix, name);
4296 tst = xmlGetDtdElementDesc(doc->intSubset, elem->name);
4297 if ((tst != NULL ) && (tst != elem) &&
4298 ((tst->prefix == elem->prefix) ||
4299 (xmlStrEqual(tst->prefix, elem->prefix))) &&
4301 xmlErrValidNode(ctxt, (xmlNodePtr) elem, XML_DTD_ELEM_REDEFINED,
4303 elem->name, NULL, NULL);
4306 tst = xmlGetDtdElementDesc(doc->extSubset, elem->name);
4307 if ((tst != NULL ) && (tst != elem) &&
4308 ((tst->prefix == elem->prefix) ||
4309 (xmlStrEqual(tst->prefix, elem->prefix))) &&
4311 xmlErrValidNode(ctxt, (xmlNodePtr) elem, XML_DTD_ELEM_REDEFINED,
4313 elem->name, NULL, NULL);
4318 if (xmlScanIDAttributeDecl(ctxt, elem) > 1) {
4328 * @elem: an element instance
4351 xmlNodePtr elem, xmlAttrPtr attr, const xmlChar *value)
4358 if ((elem == NULL) || (elem->name == NULL)) return(0);
4361 if ((elem->ns != NULL) && (elem->ns->prefix != NULL)) {
4365 fullname = xmlBuildQName(elem->name, elem->ns->prefix, fn, 50);
4380 if ((fullname != fn) && (fullname != elem->name))
4385 attrDecl = xmlGetDtdQAttrDesc(doc->intSubset, elem->name,
4388 attrDecl = xmlGetDtdQAttrDesc(doc->extSubset, elem->name,
4392 elem->name, attr->name);
4395 elem->name, attr->name);
4402 xmlErrValidNode(ctxt, elem, XML_DTD_UNKNOWN_ATTRIBUTE,
4404 attr->name, elem->name, NULL);
4411 xmlErrValidNode(ctxt, elem, XML_DTD_ATTRIBUTE_VALUE,
4413 attr->name, elem->name, NULL);
4420 xmlErrValidNode(ctxt, elem, XML_DTD_ATTRIBUTE_DEFAULT,
4422 attr->name, elem->name, attrDecl->defaultValue);
4450 xmlErrValidNode(ctxt, elem, XML_DTD_UNKNOWN_NOTATION,
4452 value, attr->name, elem->name);
4462 xmlErrValidNode(ctxt, elem, XML_DTD_NOTATION_VALUE,
4464 value, attr->name, elem->name);
4477 xmlErrValidNode(ctxt, elem, XML_DTD_ATTRIBUTE_VALUE,
4479 value, attr->name, elem->name);
4487 xmlErrValidNode(ctxt, elem, XML_DTD_ATTRIBUTE_VALUE,
4489 attr->name, elem->name, attrDecl->defaultValue);
4504 * @elem: an element instance
4528 xmlNodePtr elem, const xmlChar *prefix, xmlNsPtr ns, const xmlChar *value) {
4535 if ((elem == NULL) || (elem->name == NULL)) return(0);
4542 fullname = xmlBuildQName(elem->name, prefix, fn, 50);
4560 if ((fullname != fn) && (fullname != elem->name))
4565 attrDecl = xmlGetDtdQAttrDesc(doc->intSubset, elem->name,
4568 attrDecl = xmlGetDtdQAttrDesc(doc->extSubset, elem->name,
4572 elem->name, BAD_CAST "xmlns");
4575 elem->name, BAD_CAST "xmlns");
4583 xmlErrValidNode(ctxt, elem, XML_DTD_UNKNOWN_ATTRIBUTE,
4585 ns->prefix, elem->name, NULL);
4587 xmlErrValidNode(ctxt, elem, XML_DTD_UNKNOWN_ATTRIBUTE,
4589 elem->name, NULL, NULL);
4597 xmlErrValidNode(ctxt, elem, XML_DTD_INVALID_DEFAULT,
4599 ns->prefix, elem->name, NULL);
4601 xmlErrValidNode(ctxt, elem, XML_DTD_INVALID_DEFAULT,
4603 elem->name, NULL, NULL);
4612 xmlErrValidNode(ctxt, elem, XML_DTD_ATTRIBUTE_DEFAULT,
4614 ns->prefix, elem->name, attrDecl->defaultValue);
4616 xmlErrValidNode(ctxt, elem, XML_DTD_ATTRIBUTE_DEFAULT,
4618 elem->name, attrDecl->defaultValue, NULL);
4648 xmlErrValidNode(ctxt, elem, XML_DTD_UNKNOWN_NOTATION,
4650 value, ns->prefix, elem->name);
4652 xmlErrValidNode(ctxt, elem, XML_DTD_UNKNOWN_NOTATION,
4654 value, elem->name, NULL);
4666 xmlErrValidNode(ctxt, elem, XML_DTD_NOTATION_VALUE,
4668 value, ns->prefix, elem->name);
4670 xmlErrValidNode(ctxt, elem, XML_DTD_NOTATION_VALUE,
4672 value, elem->name, NULL);
4687 xmlErrValidNode(ctxt, elem, XML_DTD_ATTRIBUTE_VALUE,
4689 value, ns->prefix, elem->name);
4691 xmlErrValidNode(ctxt, elem, XML_DTD_ATTRIBUTE_VALUE,
4693 value, elem->name, NULL);
4703 xmlErrValidNode(ctxt, elem, XML_DTD_ELEM_NAMESPACE,
4705 ns->prefix, elem->name, attrDecl->defaultValue);
4707 xmlErrValidNode(ctxt, elem, XML_DTD_ELEM_NAMESPACE,
4709 elem->name, attrDecl->defaultValue, NULL);
5509 * @elem: an element instance
5517 xmlNodePtr elem) {
5521 if ((ctxt == NULL) || (doc == NULL) || (elem == NULL) ||
5522 (elem->type != XML_ELEMENT_NODE))
5525 child = elem->children;
5642 * @elem: an element instance
5652 xmlNodePtr elem, int *extsubset) {
5657 (elem == NULL) || (elem->name == NULL))
5665 if ((elem->ns != NULL) && (elem->ns->prefix != NULL))
5666 prefix = elem->ns->prefix;
5670 elem->name, prefix);
5673 elem->name, prefix);
5685 elemDecl = xmlGetDtdElementDesc(doc->intSubset, elem->name);
5687 elemDecl = xmlGetDtdElementDesc(doc->extSubset, elem->name);
5693 xmlErrValidNode(ctxt, elem,
5696 elem->name, NULL, NULL);
5706 * @elem: an element instance
5715 xmlNodePtr elem, const xmlChar *qname) {
5728 * Check the new element agaisnt the content model of the new elem.
5791 eDecl = xmlValidGetElemDecl(ctxt, doc, elem, &extsubset);
5792 vstateVPush(ctxt, eDecl, elem);
5820 * Check the new element agaisnt the content model of the new elem.
5873 * @elem: an element instance
5882 xmlNodePtr elem ATTRIBUTE_UNUSED,
5894 * Check the new element agaisnt the content model of the new elem.
5927 * @elem: an element instance
5943 xmlNodePtr elem) {
5954 if (elem == NULL) return(0);
5955 switch (elem->type) {
5957 xmlErrValidNode(ctxt, elem, XML_ERR_INTERNAL_ERROR,
5961 if (elem->children != NULL) {
5962 xmlErrValidNode(ctxt, elem, XML_ERR_INTERNAL_ERROR,
5967 if (elem->ns != NULL) {
5968 xmlErrValidNode(ctxt, elem, XML_ERR_INTERNAL_ERROR,
5973 if (elem->content == NULL) {
5974 xmlErrValidNode(ctxt, elem, XML_ERR_INTERNAL_ERROR,
5989 xmlErrValidNode(ctxt, elem, XML_ERR_INTERNAL_ERROR,
5993 xmlErrValidNode(ctxt, elem, XML_ERR_INTERNAL_ERROR,
5999 xmlErrValidNode(ctxt, elem, XML_ERR_INTERNAL_ERROR,
6003 xmlErrValidNode(ctxt, elem, XML_ERR_INTERNAL_ERROR,
6009 xmlErrValidNode(ctxt, elem, XML_ERR_INTERNAL_ERROR,
6017 elemDecl = xmlValidGetElemDecl(ctxt, doc, elem, &extsubset);
6029 xmlErrValidNode(ctxt, elem, XML_DTD_UNKNOWN_ELEM,
6031 elem->name, NULL, NULL);
6034 if (elem->children != NULL) {
6035 xmlErrValidNode(ctxt, elem, XML_DTD_NOT_EMPTY,
6037 elem->name, NULL, NULL);
6049 ret = xmlValidateOneCdataElement(ctxt, doc, elem);
6051 xmlErrValidNode(ctxt, elem, XML_DTD_NOT_PCDATA,
6053 elem->name, NULL, NULL);
6057 child = elem->children;
6114 xmlErrValidNode(ctxt, elem, XML_DTD_INVALID_CHILD,
6116 name, elem->name, NULL);
6131 child = elem->children;
6139 xmlErrValidNode(ctxt, elem,
6142 elem->name, NULL, NULL);
6150 child = elem->children;
6152 tmp = xmlValidateElementContent(ctxt, child, elemDecl, 1, elem);
6169 ns = elem->nsDef;
6178 ns = elem->nsDef;
6187 attrib = elem->properties;
6194 nameSpace = elem->ns;
6224 xmlErrValidNode(ctxt, elem, XML_DTD_MISSING_ATTRIBUTE,
6226 elem->name, attr->name, NULL);
6229 xmlErrValidNode(ctxt, elem, XML_DTD_MISSING_ATTRIBUTE,
6231 elem->name, attr->prefix,attr->name);
6235 xmlErrValidWarning(ctxt, elem, XML_DTD_NO_PREFIX,
6237 elem->name, attr->prefix, attr->name);
6239 xmlErrValidWarning(ctxt, elem, XML_DTD_DIFFERENT_PREFIX,
6241 elem->name, attr->prefix, attr->name);
6253 ns = elem->nsDef;
6257 xmlErrValidNode(ctxt, elem,
6260 elem->name, NULL, NULL);
6270 ns = elem->nsDef;
6274 xmlErrValidNode(ctxt, elem, XML_DTD_ELEM_NAMESPACE,
6276 elem->name, ns->prefix, NULL);
6362 * @elem: an element instance
6370 xmlValidateElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem) {
6377 if (elem == NULL) return(0);
6383 if ((elem->type == XML_XINCLUDE_START) ||
6384 (elem->type == XML_XINCLUDE_END) ||
6385 (elem->type == XML_NAMESPACE_DECL))
6393 if (elem->type == XML_ENTITY_REF_NODE) {
6397 ret &= xmlValidateOneElement(ctxt, doc, elem);
6398 if (elem->type == XML_ELEMENT_NODE) {
6399 attr = elem->properties;
6402 ret &= xmlValidateOneAttribute(ctxt, doc, elem, attr, value);
6407 ns = elem->nsDef;
6409 if (elem->ns == NULL)
6410 ret &= xmlValidateOneNamespace(ctxt, doc, elem, NULL,
6413 ret &= xmlValidateOneNamespace(ctxt, doc, elem,
6414 elem->ns->prefix, ns, ns->href);
6418 child = elem->children;
6671 xmlElementPtr elem = NULL;
6707 if (cur->elem == NULL) {
6715 elem = xmlGetDtdElementDesc(doc->intSubset, cur->elem);
6716 if ((elem == NULL) && (doc != NULL))
6717 elem = xmlGetDtdElementDesc(doc->extSubset, cur->elem);
6718 if ((elem == NULL) && (cur->parent != NULL) &&
6720 elem = xmlGetDtdElementDesc((xmlDtdPtr) cur->parent, cur->elem);
6721 if (elem == NULL) {
6724 cur->name, cur->elem, NULL);
6727 if (elem->etype == XML_ELEMENT_TYPE_EMPTY) {
6730 cur->name, cur->elem, NULL);