Implement XmlNodePrepend

This commit is contained in:
vit9696 2019-03-23 13:24:04 +03:00
parent fecc396a46
commit c7ca70a9cc
2 changed files with 33 additions and 0 deletions

View File

@ -235,6 +235,18 @@ XmlNodeAppend (
CONST CHAR8 *Content
);
//
// Prepend new node to current node.
// Otherwise equivalent to XmlNodeAppend.
//
XML_NODE *
XmlNodePrepend (
XML_NODE *Node,
CONST CHAR8 *Name,
CONST CHAR8 *Attributes,
CONST CHAR8 *Content
);
//
// @return XML_NODE representing plist root or NULL.
// @warning Only a subset of plist is supported.

View File

@ -1310,6 +1310,27 @@ XmlNodeAppend (
return NewNode;
}
XML_NODE *
XmlNodePrepend (
XML_NODE *Node,
CONST CHAR8 *Name,
CONST CHAR8 *Attributes,
CONST CHAR8 *Content
)
{
XML_NODE *NewNode;
NewNode = XmlNodeAppend (Node, Name, Attributes, Content);
if (NewNode == NULL) {
return NULL;
}
CopyMem (&Node->Children->NodeList[1], &Node->Children->NodeList[0], (Node->Children->NodeCount - 1) * sizeof (Node->Children->NodeList[0]));
Node->Children->NodeList[0] = NewNode;
return NewNode;
}
XML_NODE *
PlistDocumentRoot (
XML_DOCUMENT *Document