summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
c7c02fa)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2289
6f19259b-4bc3-4df7-8a09-
765794883524
"""Add a child element to a DOM(Document Object Model) tree with optional Attributes."""
TagName = TagName.strip()
if TagName == '':
"""Add a child element to a DOM(Document Object Model) tree with optional Attributes."""
TagName = TagName.strip()
if TagName == '':
Depth = 0
Dom = ParentNode
while Dom != None and Dom.nodeType != Dom.DOCUMENT_NODE:
Dom = Dom.parentNode
Depth += 1
if Dom == None:
Depth = 0
Dom = ParentNode
while Dom != None and Dom.nodeType != Dom.DOCUMENT_NODE:
Dom = Dom.parentNode
Depth += 1
if Dom == None:
ParentNode.appendChild(Dom.createTextNode('\n%*s' % (Depth * 2, '')))
ElementNode = Dom.createElement(TagName)
if ElementText != '':
ParentNode.appendChild(Dom.createTextNode('\n%*s' % (Depth * 2, '')))
ElementNode = Dom.createElement(TagName)
if ElementText != '':
for Item in AttributeDictionary:
ElementNode.setAttribute(Item, AttributeDictionary[Item])
ParentNode.appendChild(ElementNode)
for Item in AttributeDictionary:
ElementNode.setAttribute(Item, AttributeDictionary[Item])
ParentNode.appendChild(ElementNode)
# This acts like the main() function for the script, unless it is 'import'ed into another
# This acts like the main() function for the script, unless it is 'import'ed into another