* xmlGetDocEntity: * @doc: the document referencing the entity * @name: the entity name * * Do an entity lookup in the document entity hash table and * returns the corresponding entity, otherwise a lookup is done * in the predefined entities too. * * Returns A pointer to the entity structure or NULL if not found. */
| 488 | * Returns A pointer to the entity structure or NULL if not found. |
| 489 | */ |
| 490 | xmlEntityPtr |
| 491 | xmlGetDocEntity(const xmlDoc *doc, const xmlChar *name) { |
| 492 | xmlEntityPtr cur; |
| 493 | xmlEntitiesTablePtr table; |
| 494 | |
| 495 | if (doc != NULL) { |
| 496 | if ((doc->intSubset != NULL) && (doc->intSubset->entities != NULL)) { |
| 497 | table = (xmlEntitiesTablePtr) doc->intSubset->entities; |
| 498 | cur = xmlGetEntityFromTable(table, name); |
| 499 | if (cur != NULL) |
| 500 | return(cur); |
| 501 | } |
| 502 | if (doc->standalone != 1) { |
| 503 | if ((doc->extSubset != NULL) && |
| 504 | (doc->extSubset->entities != NULL)) { |
| 505 | table = (xmlEntitiesTablePtr) doc->extSubset->entities; |
| 506 | cur = xmlGetEntityFromTable(table, name); |
| 507 | if (cur != NULL) |
| 508 | return(cur); |
| 509 | } |
| 510 | } |
| 511 | } |
| 512 | return(xmlGetPredefinedEntity(name)); |
| 513 | } |
| 514 | |
| 515 | /* |
| 516 | * Macro used to grow the current buffer. |
no test coverage detected