Skip to content

Commit

Permalink
Add missing SPIRIT namespace URI variant for importer
Browse files Browse the repository at this point in the history
  • Loading branch information
amykyta3 committed Mar 24, 2023
1 parent 56188fd commit c6da202
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/peakrdl_ipxact/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.4.0"
__version__ = "3.4.1"
17 changes: 10 additions & 7 deletions src/peakrdl_ipxact/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@


# Expected IP-XACT namespaces. This parser is not strict about the exact version.
IPXACT_NAMESPACE_PREFIX = "http://www.accellera.org/XMLSchema/IPXACT/"
SPIRIT_NAMESPACE_PREFIX = "http://www.spiritconsortium.org/XMLSchema/SPIRIT/"
VALID_NS_PREFIXES = {
"http://www.spiritconsortium.org/XMLSchema/SPIRIT/",
"http://www.accellera.org/XMLSchema/spirit/1685-2009",
"http://www.accellera.org/XMLSchema/IPXACT/",
}

class IPXACTImporter(RDLImporter):

Expand Down Expand Up @@ -70,12 +73,12 @@ def get_component(self, tree: ElementTree.ElementTree) -> ElementTree.Element:
if get_local_name(root) == "component":
component = root
namespace = get_namespace(root)
if IPXACT_NAMESPACE_PREFIX in namespace:
self.ns = namespace
elif SPIRIT_NAMESPACE_PREFIX in namespace:
self.ns = namespace
for ns in VALID_NS_PREFIXES:
if ns in namespace:
self.ns = namespace
break
else:
self.msg.fatal("Could not find a known ip-xact namespace")
self.msg.fatal("Unrecognized namespace URI: %s" % namespace, self.src_ref)
else:
self.msg.fatal(
"Could not find a 'component' element",
Expand Down

0 comments on commit c6da202

Please sign in to comment.