Skip to content

Commit 381423e

Browse files
committed
CoreFoundation: Create an XML Node of notation declaration when DTD node is parsed.
1 parent a481040 commit 381423e

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

CoreFoundation/Parsing.subproj/CFXMLInterface.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1009,6 +1009,14 @@ _CFXMLDTDPtr _CFXMLNewDTD(_CFXMLDocPtr doc, const unsigned char* name, const uns
10091009
return xmlNewDtd(doc, name, publicID, systemID);
10101010
}
10111011

1012+
void _CFXMLNotationScanner(void* payload, void* data, xmlChar* name) {
1013+
xmlNotationPtr notation = (xmlNotationPtr)payload;
1014+
_cfxmlNotation* node = (_cfxmlNotation*)data;
1015+
node->type = XML_NOTATION_NODE;
1016+
node->name = notation->name;
1017+
node->notation = notation;
1018+
}
1019+
10121020
_CFXMLDTDNodePtr _CFXMLParseDTDNode(const unsigned char* xmlString) {
10131021
CFDataRef data = CFDataCreateWithBytesNoCopy(NULL, xmlString, xmlStrlen(xmlString), kCFAllocatorNull);
10141022
xmlDtdPtr dtd = _CFXMLParseDTDFromData(data, NULL);
@@ -1019,7 +1027,12 @@ _CFXMLDTDNodePtr _CFXMLParseDTDNode(const unsigned char* xmlString) {
10191027
}
10201028

10211029
xmlNodePtr node = dtd->children;
1022-
xmlUnlinkNode(node);
1030+
if (node != NULL) {
1031+
xmlUnlinkNode(node);
1032+
} else if (dtd->notations) {
1033+
node = (xmlNodePtr)calloc(1, sizeof(_cfxmlNotation));
1034+
xmlHashScan((xmlNotationTablePtr)dtd->notations, &_CFXMLNotationScanner, (void*)node);
1035+
}
10231036

10241037
return node;
10251038
}

0 commit comments

Comments
 (0)