]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/UPT/Library/Xml/XmlRoutines.py
BaseTools: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / BaseTools / Source / Python / UPT / Library / Xml / XmlRoutines.py
index f20ae4dfa82f24acba91f1f3de06c899aa358aea..94e97fa45c12d24b430fb556f8dc7f652a170ec0 100644 (file)
@@ -2,15 +2,9 @@
 # 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
-# http://opensource.org/licenses/bsd-license.php\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
 #\r
 \r
 '''\r
@@ -40,7 +34,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 +135,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
@@ -180,7 +174,7 @@ def XmlElementData(Dom):
 # @param  String             A XPath style path.\r
 #\r
 def XmlElementList(Dom, String):\r
-    return map(XmlElementData, XmlList(Dom, String))\r
+    return list(map(XmlElementData, XmlList(Dom, String)))\r
 \r
 \r
 ## Get the XML attribute of the current node.\r
@@ -224,6 +218,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