<div dir="auto">I didn’t see any XML?  I’ll have to look again.  I didn’t realize the code did that.  I ran it the input XML through X3dToPython.xslt it looks like.</div><div dir="auto"><br></div><div dir="auto">On Sun, Jul 16, 2023 at 12:04 PM Brutzman, Donald (Don) (CIV) <<a href="mailto:brutzman@nps.edu">brutzman@nps.edu</a>> wrote:<br></div><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word"><div class="m_1505302498812920524WordSection1"><p class="MsoNormal">Thanks for issue report.  Am first wondering, despite error message, was your XML produced satisfactorily?<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Next, troubleshooting.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">“<b><span style="font-size:10.0pt;font-family:"Courier New"">*** Python-to-XML well-formed XML document test failed</span></b><b>.</b>” means that the Python XML library failed to validate the XML output.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">The error message shows exactly what it dislikes: having a hash tag # in the xmldsig namespace, which in XML parlance refers to a namespace.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">    XMLSchemaParseError cannot import namespace '<a href="https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F2000%2F09%2Fxmldsig%23&data=05%7C01%7Cbrutzman%40nps.edu%7C62e4f8b58b7448e6e1b108db85dd8561%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C638250958735907841%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=9BQStQVSdrx59SRA0ALPIYLsm61LK12bt%2BhABuwHgPw%3D&reserved=0" target="_blank">http://www.w3.org/2000/09/xmldsig#</a>': Entities are forbidden (entity_name='dsig')<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">The construct itself is OK, and used in XML documents with a digital signature, as specified by<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><ul style="margin-top:0in" type="disc"><li class="m_1505302498812920524MsoListParagraph" style="margin-left:0in">XML Signature Syntax and Processing Version 2.0<u></u><u></u></li><li class="m_1505302498812920524MsoListParagraph" style="margin-left:0in">W3C Working Group Note 23 July 2015<u></u><u></u></li><li class="m_1505302498812920524MsoListParagraph" style="margin-left:0in"><a href="http://www.w3.org/TR/xmldsig-core2" target="_blank">http://www.w3.org/TR/xmldsig-core2</a><u></u><u></u></li></ul><p class="MsoNormal"><u></u> <u></u></p><ul style="margin-top:0in" type="disc"><li class="m_1505302498812920524MsoListParagraph" style="margin-left:0in">XML Signature Best Practices, W3C Working Group Note 11 April 2013<u></u><u></u></li><li class="m_1505302498812920524MsoListParagraph" style="margin-left:0in"><a href="https://www.w3.org/TR/xmldsig-bestpractices" target="_blank">https://www.w3.org/TR/xmldsig-bestpractices</a><u></u><u></u></li></ul><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">The second reference on best practices suggests a workaround of sorts (manually coerce until it avoids an error).<u></u><u></u></p><ul type="disc"><li class="m_1505302498812920524MsoListParagraph" style="margin-left:0in"><span style="font-size:13.5pt">3.4 For Applications: Signing XML without namespace information ("legacy XML") <u></u><u></u></span></li><li class="m_1505302498812920524MsoListParagraph" style="margin-left:0in">Best Practice 21: Applications: When creating an enveloping signature over XML without namespace information, take steps to avoid having that content inherit the XML Signature namespace.<u></u><u></u></li><li class="m_1505302498812920524MsoListParagraph" style="margin-left:0in">Avoid enveloped content from inheriting the XML Signature namespace by either inserting an empty default namespace declaration or by defining a namespace prefix for the Signature Namespace usage. <u></u><u></u></li><li class="m_1505302498812920524MsoListParagraph" style="margin-left:0in"><a href="https://www.w3.org/TR/2013/NOTE-xmldsig-bestpractices-20130411/#signing-xml-without-namespaces" target="_blank">https://www.w3.org/TR/2013/NOTE-xmldsig-bestpractices-20130411/#signing-xml-without-namespaces</a><u></u><u></u></li></ul><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">The current code producing this warning in our x3d.py library is on line 15186.  The preceding lines of code use python’s xmlschema package and then xml.etree XML()<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Root-cause analysis: this appears to be a failure in the xmlschema Python library.  We will need to track down how to report an issue there… here goes….<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><ul style="margin-top:0in" type="disc"><li class="m_1505302498812920524MsoListParagraph" style="margin-left:0in"><a href="https://pypi.org/project/xmlschema" target="_blank">https://pypi.org/project/xmlschema</a><u></u><u></u></li></ul><p class="MsoNormal"><u></u> <u></u></p><ul style="margin-top:0in" type="disc"><li class="m_1505302498812920524MsoListParagraph" style="margin-left:0in"><a href="https://xmlschema.readthedocs.io/en/latest" target="_blank">https://xmlschema.readthedocs.io/en/latest</a><u></u><u></u></li><li class="m_1505302498812920524MsoListParagraph" style="margin-left:0in"><a href="https://xmlschema.readthedocs.io/en/latest/api.html#xmlschema.XMLSchemaNamespaceError" target="_blank">https://xmlschema.readthedocs.io/en/latest/api.html#xmlschema.XMLSchemaNamespaceError</a><u></u><u></u></li><ul style="margin-top:0in" type="circle"><li class="m_1505302498812920524MsoListParagraph" style="margin-left:0in"><i>exception </i>XMLSchemaNamespaceError<u></u><u></u></li><li class="m_1505302498812920524MsoListParagraph" style="margin-left:0in">Raised when a wrong runtime condition is found with a namespace.<u></u><u></u></li></ul><li class="m_1505302498812920524MsoListParagraph" style="margin-left:0in">xmlschema project page<u></u><u></u></li><li class="m_1505302498812920524MsoListParagraph" style="margin-left:0in"><a href="https://github.com/sissaschool/xmlschema" target="_blank">https://github.com/sissaschool/xmlschema</a><u></u><u></u></li></ul><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Bug report submitted:<u></u><u></u></p><ul style="margin-top:0in" type="disc"><li class="m_1505302498812920524MsoListParagraph" style="margin-left:0in">xmlschema issues<u></u><u></u></li><li class="m_1505302498812920524MsoListParagraph" style="margin-left:0in">validation problem, xmldsig# namespace for XML digital signature #357<u></u><u></u></li><li class="m_1505302498812920524MsoListParagraph" style="margin-left:0in"><a href="https://github.com/sissaschool/xmlschema/issues/357" target="_blank">https://github.com/sissaschool/xmlschema/issues/357</a><u></u><u></u></li></ul><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I’ve added a TODO item in the x3d.py code generator to help us track this down at some future point.  Code block follows for full clarity and future reference.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">        try:<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">            selfX3dXmlText = ''<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">            import xmlschema<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">            x3dSchemaUrl = '<a href="https://www.web3d.org/specifications/x3d-" target="_blank">https://www.web3d.org/specifications/x3d-</a>' + validationVersion + '.xsd'<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">            x3dschema = xmlschema.XMLSchema(x3dSchemaUrl)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">            try:<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">                from xml.etree import ElementTree<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">                selfX3dXmlText = self.XML()<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">                selfX3dXmlTree = ElementTree.fromstring(selfX3dXmlText)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">                print("Python-to-XML well-formed XML document  test of XML output complete")<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">                x3dschema.is_valid(selfX3dXmlTree)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">                print("Python-to-XML X3D", str(self.version), "schema validation test of XML output complete")<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">            except SyntaxError as err: # Exception<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">                # <a href="https://stackoverflow.com/questions/18176602/how-to-get-the-name-of-an-exception-that-was-caught-in-python" target="_blank">https://stackoverflow.com/questions/18176602/how-to-get-the-name-of-an-exception-that-was-caught-in-python</a><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">                print("*** Python-to-XML X3D", str(self.version), "schema validation test of XML output failed.")<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">                print("    x3dSchemaUrl=", x3dSchemaUrl)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">                if hasattr(err,'position') and err.position[0]:<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">                    print("   ", type(err).__name__, "(line=" + str(err.lineno) + ')', err)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">                if selfX3dXmlText: # might have failed to generate<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">                    print(prependLineNumbers(selfX3dXmlText,err.lineno))<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">        except Exception as err: # usually ParseError<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">            # <a href="https://docs.python.org/3/library/xml.etree.elementtree.html#exceptions" target="_blank">https://docs.python.org/3/library/xml.etree.elementtree.html#exceptions</a><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">            print("*** Python-to-XML well-formed XML document test failed.")<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">            print("    x3dSchemaUrl=" + x3dSchemaUrl)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">            print("    " + type(err).__name__, err)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">            if hasattr(err,'position') and err.position[0]:<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">                lineNumber = err.position[0]<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">                print('type(err.position)=' + str(type(err.position)), 'lineNumber=' + str(lineNumber))<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">            else:<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">                lineNumber = 1<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">            if selfX3dXmlText: # might have failed to generate<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">                print(prependLineNumbers(selfX3dXmlText,lineNumber))<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New"">            <b># TODO handle xmldsig# namespace error by xmlschema library - otherwise trap/identify this error<u></u><u></u></b></span></p><p class="MsoNormal"><b><span style="font-size:8.0pt;font-family:"Courier New"">            # Submitted bug report: validation problem, xmldsig# namespace for XML digital signature #357<u></u><u></u></span></b></p><p class="MsoNormal"><b><span style="font-size:8.0pt;font-family:"Courier New"">            # <a href="https://github.com/sissaschool/xmlschema/issues/357" target="_blank">https://github.com/sissaschool/xmlschema/issues/357</a><u></u><u></u></span></b></p><div><p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New""><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:9.0pt">Again thanks for helpful issue report.  Have fun with X3D Python!<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New""><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">all the best, Don<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">-- <u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">Don Brutzman  Naval Postgraduate School, Code USW/Br        <a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA    +1.831.656.2149<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New"">X3D graphics, virtual worlds, navy robotics <a href="https://faculty.nps.edu/brutzman" target="_blank">https://faculty.nps.edu/brutzman</a><u></u><u></u></span></p></div><p class="MsoNormal"><u></u> <u></u></p><div><div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0in 0in 0in"><p class="MsoNormal"><b>From:</b> John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> <br><b>Sent:</b> Sunday, July 16, 2023 2:18 AM<br><b>To:</b> Brutzman, Donald (Don) (CIV) <<a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a>>; X3D Graphics public mailing list <<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a>><br><b>Subject:</b> Not sure what to do with this failure?<u></u><u></u></p></div></div><p class="MsoNormal"><u></u> <u></u></p><div><div><div><div><p class="MsoNormal">Text-python attached, see below weird issue. Should I upgrade? What is happening with x3d.py and X3D 4.0?  The link is good, but it looks like the schema doesn't validate?<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Back to JSON.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">py JinLOA4Canonical101.py.txt<u></u><u></u></p></div><div><p class="MsoNormal">x3d.py package 4.0.64.4 loaded, have fun with X3D Graphics!<u></u><u></u></p></div><div><p class="MsoNormal">Self-test diagnostics:<u></u><u></u></p></div><div><p class="MsoNormal">*** Python-to-XML well-formed XML document test failed.<u></u><u></u></p></div><div><p class="MsoNormal">    x3dSchemaUrl=<a href="https://www.web3d.org/specifications/x3d-4.0.xsd" target="_blank">https://www.web3d.org/specifications/x3d-4.0.xsd</a><u></u><u></u></p></div><div><p class="MsoNormal">    XMLSchemaParseError cannot import namespace '<a href="http://www.w3.org/2000/09/xmldsig#" target="_blank">http://www.w3.org/2000/09/xmldsig#</a>': Entities are forbidden (entity_name='dsig')<u></u><u></u></p></div><div><p class="MsoNormal">Python-to-VRML export of VRML output successful<u></u><u></u></p></div><div><p class="MsoNormal">Python-to-JSON export of JSON output successful (under development)<u></u><u></u></p></div><div><p class="MsoNormal">python load and self-test diagnostics complete.<u></u><u></u></p></div></div></div></div></div></div></blockquote></div></div>