Skip to content
Snippets Groups Projects

adapter.aasx: Add XML deserialization support

Merged Michael Thies requested to merge feature/aasx_xml into master
1 file
+ 3
3
Compare changes
  • Side-by-side
  • Inline
+ 3
3
@@ -30,6 +30,7 @@ import os
@@ -30,6 +30,7 @@ import os
import re
import re
from typing import Dict, Tuple, IO, Union, List, Set, Optional
from typing import Dict, Tuple, IO, Union, List, Set, Optional
 
from .xml import read_aas_xml_file
from .. import model
from .. import model
from .json import read_aas_json_file, write_aas_json_file
from .json import read_aas_json_file, write_aas_json_file
import pyecma376_2
import pyecma376_2
@@ -204,9 +205,8 @@ class AASXReader:
@@ -204,9 +205,8 @@ class AASXReader:
extension = part_name.split("/")[-1].split(".")[-1]
extension = part_name.split("/")[-1].split(".")[-1]
if content_type.split(";")[0] in ("text/xml", "application/xml") or content_type == "" and extension == "xml":
if content_type.split(";")[0] in ("text/xml", "application/xml") or content_type == "" and extension == "xml":
logger.debug("Parsing AAS objects from XML stream in OPC part {} ...".format(part_name))
logger.debug("Parsing AAS objects from XML stream in OPC part {} ...".format(part_name))
# TODO XML Deserialization
with self.reader.open_part(part_name) as p:
raise NotImplementedError("XML deserialization is not implemented yet. Thus, AASX files with XML parts are "
return read_aas_xml_file(p)
"not supported.")
elif content_type.split(";")[0] in ("text/json", "application/json") \
elif content_type.split(";")[0] in ("text/json", "application/json") \
or content_type == "" and extension == "json":
or content_type == "" and extension == "json":
logger.debug("Parsing AAS objects from JSON stream in OPC part {} ...".format(part_name))
logger.debug("Parsing AAS objects from JSON stream in OPC part {} ...".format(part_name))
Loading