[x3d-public] Ouch, x3d.py XML output does not list required fields in unit and component

John Carlson yottzumm at gmail.com
Mon Apr 3 07:43:14 PDT 2023


Here's a small python program which shows the issue. Note that required
fields level=1 and conversionFactor=1.0 are not shown in XML output, but
they are in the python program.

Thanks!

John

# x3d.py package 4.0.64.4 loaded, have fun with X3D Graphics!
print("<!--")
from x3d import *
print("-->")
print(
X3D(class_="x3dModel.class", profile="Full", style_="x3dModel.style",
version="4.0",
head=head(children=[component(name="Navigation", level=3),
component(name="Shaders", level=1),
component(name="CADGeometry", level=2),
unit(name="LengthUnitConversion", category="length", conversionFactor=1.0),
unit(name="ForceFromPoundsToNewtons", category="force",
conversionFactor=4.4482),
]),
Scene=Scene())
.XML())

On Mon, Apr 3, 2023 at 9:17 AM John Carlson <yottzumm at gmail.com> wrote:

> Low impact issue in x3d.py at this point:
>
> Does one even need to list the component or unit nodes if level and
> conversionFactor fields are defaulted? Note: the fields are required.  If a
> defaulted, but required field is reset in a python program, should the
> default be in XML output? I would like it so.  See attached python program.
>
> I'll do the tooltip thing.
>
> X3D Tooltips in English version 4.0 (web3d.org)
> <https://www.web3d.org/x3d/content/X3dTooltips.html#unit.conversionFactor> --
> conversionFactor is required!
>
> X3D Tooltips in English version 4.0 (web3d.org)
> <https://www.web3d.org/x3d/content/X3dTooltips.html#component.level> --
> level is required
>
> X3DUOM says use="required" for both fields.
>
> Should I check XML schema?
>
> This is why program output needs to be validated and verified, especially
> if it's a program!
>
> Luckily, I'm hoping this doesn't affect much, probably just x3d.py and an
> xslt.
>
> Thanks!
>
> John
>
> <component level='3' name='Navigation'/>
>     <component name='Shaders'/>
>     <component level='2' name='CADGeometry'/>
>     <component level='2' name='DIS'/>
>     <component name='H-Anim'/>
>     <component name='Grouping'/>
>     <component name='Layering'/>
>     <unit category='angle' name='AngleUnitConversion'/>
>     <unit category='length' name='LengthUnitConversion'/>
>     <unit category='force' conversionFactor='4.4482'
> name='ForceFromPoundsToNewtons'/>
>     <meta content='HelloWorldProgramOutput.x3d' name='title'/>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20230403/24f1bad6/attachment.html>


More information about the x3d-public mailing list