]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/UPT/Library/Xml/XmlRoutines.py
BaseTools: Clean up source files
[mirror_edk2.git] / BaseTools / Source / Python / UPT / Library / Xml / XmlRoutines.py
index f20ae4dfa82f24acba91f1f3de06c899aa358aea..ee158f33d9dd94cefbc21237a3255892e59778a8 100644 (file)
@@ -2,11 +2,11 @@
 # This is an XML API that uses a syntax similar to XPath, but it is written in\r
 # standard python so that no extra python packages are required to use it.\r
 #\r
-# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>\r
 #\r
-# This program and the accompanying materials are licensed and made available \r
-# under the terms and conditions of the BSD License which accompanies this \r
-# distribution. The full text of the license may be found at \r
+# This program and the accompanying materials are licensed and made available\r
+# under the terms and conditions of the BSD License which accompanies this\r
+# distribution. The full text of the license may be found at\r
 # http://opensource.org/licenses/bsd-license.php\r
 #\r
 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
@@ -40,7 +40,7 @@ def CreateXmlElement(Name, String, NodeList, AttributeList):
         Element.appendChild(Doc.createTextNode(String))\r
 \r
     for Item in NodeList:\r
-        if type(Item) == type([]):\r
+        if isinstance(Item, type([])):\r
             Key = Item[0]\r
             Value = Item[1]\r
             if Key != '' and Key is not None and Value != '' and Value is not None:\r
@@ -141,8 +141,8 @@ def XmlElement(Dom, String):
 ## Get a single XML element using XPath style syntax.\r
 #\r
 # Similar with XmlElement, but do not strip all the leading and tailing space\r
-# and newline, instead just remove the newline and spaces introduced by \r
-# toprettyxml() \r
+# and newline, instead just remove the newline and spaces introduced by\r
+# toprettyxml()\r
 #\r
 # @param  Dom                The root XML DOM object.\r
 # @param  Strin              A XPath style path.\r
@@ -224,6 +224,6 @@ def XmlParseFile(FileName):
         Dom = xml.dom.minidom.parse(XmlFile)\r
         XmlFile.close()\r
         return Dom\r
-    except BaseException, XExcept:\r
+    except BaseException as XExcept:\r
         XmlFile.close()\r
         Logger.Error('\nUPT', PARSER_ERROR, XExcept, File=FileName, RaiseError=True)\r