| 5530 | } |
| 5531 | |
| 5532 | static void |
| 5533 | xmlBufGetEntityRefContent(xmlBufPtr buf, const xmlNode *ref) { |
| 5534 | xmlEntityPtr ent; |
| 5535 | |
| 5536 | if (ref->children != NULL) { |
| 5537 | ent = (xmlEntityPtr) ref->children; |
| 5538 | } else { |
| 5539 | /* lookup entity declaration */ |
| 5540 | ent = xmlGetDocEntity(ref->doc, ref->name); |
| 5541 | if (ent == NULL) |
| 5542 | return; |
| 5543 | } |
| 5544 | |
| 5545 | /* |
| 5546 | * The parser should always expand predefined entities but it's |
| 5547 | * possible to create references to predefined entities using |
| 5548 | * the tree API. |
| 5549 | */ |
| 5550 | if (ent->etype == XML_INTERNAL_PREDEFINED_ENTITY) { |
| 5551 | xmlBufCat(buf, ent->content); |
| 5552 | return; |
| 5553 | } |
| 5554 | |
| 5555 | if (ent->flags & XML_ENT_EXPANDING) |
| 5556 | return; |
| 5557 | |
| 5558 | ent->flags |= XML_ENT_EXPANDING; |
| 5559 | xmlBufGetChildContent(buf, (xmlNodePtr) ent); |
| 5560 | ent->flags &= ~XML_ENT_EXPANDING; |
| 5561 | } |
| 5562 | |
| 5563 | static void |
| 5564 | xmlBufGetChildContent(xmlBufPtr buf, const xmlNode *tree) { |
no test coverage detected