MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlSAX2StartElement

Function xmlSAX2StartElement

ThirdParty/libxml2/vtklibxml2/SAX2.c:1476–1662  ·  view source on GitHub ↗

* xmlSAX2StartElement: * @ctx: the user data (XML parser context) * @fullname: The element name, including namespace prefix * @atts: An array of name/value attributes pairs, NULL terminated * * called when an opening tag has been processed. */

Source from the content-addressed store, hash-verified

1474 * called when an opening tag has been processed.
1475 */
1476void
1477xmlSAX2StartElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
1478{
1479 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
1480 xmlNodePtr ret;
1481 xmlNodePtr parent;
1482 xmlNsPtr ns;
1483 xmlChar *name;
1484 xmlChar *prefix;
1485 const xmlChar *att;
1486 const xmlChar *value;
1487 int i;
1488
1489 if ((ctx == NULL) || (fullname == NULL) || (ctxt->myDoc == NULL)) return;
1490
1491 /*
1492 * First check on validity:
1493 */
1494 if (ctxt->validate && (ctxt->myDoc->extSubset == NULL) &&
1495 ((ctxt->myDoc->intSubset == NULL) ||
1496 ((ctxt->myDoc->intSubset->notations == NULL) &&
1497 (ctxt->myDoc->intSubset->elements == NULL) &&
1498 (ctxt->myDoc->intSubset->attributes == NULL) &&
1499 (ctxt->myDoc->intSubset->entities == NULL)))) {
1500 xmlErrValid(ctxt, XML_ERR_NO_DTD,
1501 "Validation failed: no DTD found !", NULL, NULL);
1502 ctxt->validate = 0;
1503 }
1504
1505 if (ctxt->html) {
1506 prefix = NULL;
1507 name = xmlStrdup(fullname);
1508 } else {
1509 /*
1510 * Split the full name into a namespace prefix and the tag name
1511 */
1512 name = xmlSplitQName(ctxt, fullname, &prefix);
1513 if (name == NULL) {
1514 xmlSAX2ErrMemory(ctxt);
1515 return;
1516 }
1517 }
1518
1519 /*
1520 * Note : the namespace resolution is deferred until the end of the
1521 * attributes parsing, since local namespace can be defined as
1522 * an attribute at this level.
1523 */
1524 ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL, name, NULL);
1525 if (ret == NULL) {
1526 xmlFree(prefix);
1527 xmlSAX2ErrMemory(ctxt);
1528 return;
1529 }
1530 ctxt->nodemem = -1;
1531
1532 /* Initialize parent before pushing node */
1533 parent = ctxt->node;

Callers 2

startElementFunction · 0.85
startElementBndFunction · 0.85

Calls 14

xmlStrdupFunction · 0.85
xmlSplitQNameFunction · 0.85
xmlSAX2ErrMemoryFunction · 0.85
xmlNewDocNodeEatNameFunction · 0.85
xmlSAX2AppendChildFunction · 0.85
nodePushFunction · 0.85
xmlUnlinkNodeFunction · 0.85
xmlFreeNodeFunction · 0.85
xmlSearchNsSafeFunction · 0.85
xmlNewNsFunction · 0.85
xmlSetNsFunction · 0.85

Tested by 1

startElementBndFunction · 0.68