I have a directory structure and a GDML file as follows
<!DOCTYPE xml [
<!ENTITY define SYSTEM "DC1_define.xml">
<!ENTITY materials SYSTEM "DC1_materials.xml">
<!ENTITY solids SYSTEM "DC1_solids.xml">
<!ENTITY setup SYSTEM "DC1_setup.xml">
<!ENTITY struct SYSTEM "DC1_struct.xml">
]>
<xml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd">&define;&materials;&solids;&setup;&struct;</xml>
Where the files labelled with .xml type are not strictlly xml files as
they have no <xml> ...content ... </xml> just valid include contents
It is processed by
try:
from lxml import etree
parser = etree.XMLParser(resolve_entities=True)
root = etree.parse(filename, parser=parser)
# print('error log')
# print(parser.error_log)
except ImportError:
try:
import xml.etree.ElementTree as etree
FreeCAD.Console.PrintMessage(
"running with etree.ElementTree (import limitations)\n"
)
FreeCAD.Console.PrintMessage(
" for full import add lxml library \n"
)
tree = etree.parse(filename)
This all works fine BUT
I now wish to implement other functions which process the files listed
in the Entities as individual xml files, Is there a way to achieve this?
or alternatively is there a way to use an actual xml file as a include.
--
========== Art & Ceramics ===========
https://www.instagram.com/ksloan1952/
_______________________________________________
lxml - The Python XML Toolkit mailing list -- lxml@python.org
To unsubscribe send an email to lxml-le...@python.org
https://mail.python.org/mailman3/lists/lxml.python.org/
Member address: arch...@mail-archive.com