MCPcopy Create free account
hub / github.com/FreeOpcUa/python-opcua / __init__

Method __init__

opcua/common/xmlparser.py:92–108  ·  view source on GitHub ↗
(self, xmlpath=None, xmlstring=None)

Source from the content-addressed store, hash-verified

90class XMLParser(object):
91
92 def __init__(self, xmlpath=None, xmlstring=None):
93 self.logger = logging.getLogger(__name__)
94 self._retag = re.compile(r"(\{.*\})(.*)")
95 self.path = xmlpath
96
97 if xmlstring:
98 self.root = ET.fromstring(xmlstring)
99 else:
100 self.root = ET.parse(xmlpath).getroot()
101
102 # FIXME: hard to get these xml namespaces with ElementTree, we may have to shift to lxml
103 self.ns = {
104 'base': "http://opcfoundation.org/UA/2011/03/UANodeSet.xsd",
105 'uax': "http://opcfoundation.org/UA/2008/02/Types.xsd",
106 'xsd': "http://www.w3.org/2001/XMLSchema",
107 'xsi': "http://www.w3.org/2001/XMLSchema-instance"
108 }
109
110 def get_used_namespaces(self):
111 """

Callers

nothing calls this directly

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected