* xmlScanIDAttributeDecl: * @ctxt: the validation context * @elem: the element name * @err: whether to raise errors here * * Verify that the element don't have too many ID attributes * declared. * * Returns the number of ID attributes found. */
| 1569 | * Returns the number of ID attributes found. |
| 1570 | */ |
| 1571 | static int |
| 1572 | xmlScanIDAttributeDecl(xmlValidCtxtPtr ctxt, xmlElementPtr elem, int err) { |
| 1573 | xmlAttributePtr cur; |
| 1574 | int ret = 0; |
| 1575 | |
| 1576 | if (elem == NULL) return(0); |
| 1577 | cur = elem->attributes; |
| 1578 | while (cur != NULL) { |
| 1579 | if (cur->atype == XML_ATTRIBUTE_ID) { |
| 1580 | ret ++; |
| 1581 | if ((ret > 1) && (err)) |
| 1582 | xmlErrValidNode(ctxt, (xmlNodePtr) elem, XML_DTD_MULTIPLE_ID, |
| 1583 | "Element %s has too many ID attributes defined : %s\n", |
| 1584 | elem->name, cur->name, NULL); |
| 1585 | } |
| 1586 | cur = cur->nexth; |
| 1587 | } |
| 1588 | return(ret); |
| 1589 | } |
| 1590 | #endif /* LIBXML_VALID_ENABLED */ |
| 1591 | |
| 1592 | /** |
no outgoing calls
no test coverage detected