[x3d-public] Python toXML() progress

Don Brutzman brutzman at nps.edu
Tue Apr 21 21:17:05 PDT 2020


Found and fixed additional toXML() serialization errors for MFString fields, as well as stringification of value from field/fieldValue elements.

Haven't done round-trip testing, but these programmatic self-checks have exercised toXML() without exceptions for the X3D for Web Authors archive.  Looks like it is pretty thorough!

To confirm thoroughness, will run full set of regression tests tonight and then upgrade the x3d.py X3DPSAIL package on PyPi.  At that point we have .py programs able to output scene graphs in .x3d XML form.


On 4/21/2020 7:21 AM, Don Brutzman wrote:
> I am now exercising the toXML() method as part of X3dToPython.xslt conversions and testing.
> 
> The examples test log immediately reported problems with url list handling.
> 
> Will fix and continue diagnostics across the entire suite of models in X3D Example Archives.
> 
> On 4/20/2020 11:27 PM, Don Brutzman wrote:
>> Excellent catch.  As you indicated, the problem was SFNode fields had improper toXML implementation.  Now fixed, test case added to smoke tests, checked in and deployed as v0.0.26
>>
>> On 4/20/2020 8:57 AM, John Carlson wrote:
>>> testing toXML in python.   BackgroundCollection.py works.
>>>
>>> These don't:
>>> $ python HelloWorld.py
>>> x3d.py package loaded, have fun with X3D Graphics!
>>> Traceback (most recent call last):
>>>    File "HelloWorld.py", line 77, in <module>
>>>      print (     newModel.toXML())
>>>    File "C:\x3d-code\www.web3d.org <http://www.web3d.org>\x3d\stylesheets\python\examples\x3d.py", line 6878, in toXML
>>>      result += str(self.Scene.toXML(indentLevel=indentLevel+1))
>>>    File "C:\x3d-code\www.web3d.org <http://www.web3d.org>\x3d\stylesheets\python\examples\x3d.py", line 6679, in toXML
>>>      result += each.toXML(indentLevel=indentLevel+1)
>>>    File "C:\x3d-code\www.web3d.org <http://www.web3d.org>\x3d\stylesheets\python\examples\x3d.py", line 19183, in toXML
>>>      result += each.toXML(indentLevel=indentLevel+1)
>>>    File "C:\x3d-code\www.web3d.org <http://www.web3d.org>\x3d\stylesheets\python\examples\x3d.py", line 40543, in toXML
>>>      result += each.toXML(indentLevel=indentLevel+1)
>>>    File "C:\x3d-code\www.web3d.org <http://www.web3d.org>\x3d\stylesheets\python\examples\x3d.py", line 35796, in toXML
>>>      for each in self.appearance:
>>> TypeError: 'Appearance' object is not iterable
>>>
>>> coderextreme at DESKTOP-DOPK2VD MINGW64 /c/x3d-code/www.web3d.org/x3d/stylesheets/python/examples <http://www.web3d.org/x3d/stylesheets/python/examples>
>>> $ python HelloWorldPrefixed.py
>>> x3d.py package loaded, have fun with X3D Graphics!
>>> Traceback (most recent call last):
>>>    File "HelloWorldPrefixed.py", line 77, in <module>
>>>      print (     newModel.toXML())
>>>    File "C:\x3d-code\www.web3d.org <http://www.web3d.org>\x3d\stylesheets\python\examples\x3d.py", line 6878, in toXML
>>>      result += str(self.Scene.toXML(indentLevel=indentLevel+1))
>>>    File "C:\x3d-code\www.web3d.org <http://www.web3d.org>\x3d\stylesheets\python\examples\x3d.py", line 6679, in toXML
>>>      result += each.toXML(indentLevel=indentLevel+1)
>>>    File "C:\x3d-code\www.web3d.org <http://www.web3d.org>\x3d\stylesheets\python\examples\x3d.py", line 19183, in toXML
>>>      result += each.toXML(indentLevel=indentLevel+1)
>>>    File "C:\x3d-code\www.web3d.org <http://www.web3d.org>\x3d\stylesheets\python\examples\x3d.py", line 40543, in toXML
>>>      result += each.toXML(indentLevel=indentLevel+1)
>>>    File "C:\x3d-code\www.web3d.org <http://www.web3d.org>\x3d\stylesheets\python\examples\x3d.py", line 35796, in toXML
>>>      for each in self.appearance:
>>> TypeError: 'Appearance' object is not iterable
>>>
>>> -----------------------
>>>
>>> Appearance is an SFNode, so it's not a iterable.
>>>
>>> [...]
> 
> all the best, Don

all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman



More information about the x3d-public mailing list