[x3d-public] x3d.py roundtrip for Metadata nodes in v.3.3 and v.4.0

Brutzman, Donald (Don) (CIV) brutzman at nps.edu
Tue Oct 31 18:00:18 PDT 2023


Rather than constructing a new example, we have some existing models for
X3D3/X3D4 Metadata nodes already in the X3D Example Archives.

 

I looked at the HTML5 pretty-print documentation for our two sets of
X3D3/X3D4 metadata examples.  Found a problem in X3dToXhtml.xslt conversion
stylesheet, was able to fix it.

 

The following examples should now all show the correct defaults:

 

*	X3D Example Archives: X3D4WA, X3D for Web Authors, Chapter 15
Metadata
*
https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter15Metadat
a/index.html

 

*	Metadata Node Examples X3D 3
*	Metadata Node Examples X3D 4
*	World Info Example Metadata Set X3D 3
*	World Info Example Metadata Set X3D 3

 

Inspection should show that containerField strings are displayed or hidden
as determined by X3D3/X3D4 defaults.

 

As these things go, X3D4 metadata collections are more readable too when
containerField clutter is removed.  For example:

 

*	X3D Example Archives: X3D4WA, X3D for Web Authors, Chapter 15
Metadata, Xmp Metadata Embedded
*
https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter15Metadat
a/XmpMetadataEmbeddedIndex.html
*
https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter15Metadat
a/XmpMetadataEmbedded.html

 

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 https://faculty.nps.edu/brutzman

 

-----Original Message-----
From: x3d-public <x3d-public-bounces at web3d.org> On Behalf Of Andreas Plesch
Sent: Tuesday, October 31, 2023 10:20 AM
To: X3D Graphics public mailing list <x3d-public at web3d.org>
Subject: [x3d-public] x3d.py roundtrip for Metadata nodes in v.3.3 and v.4.0

 

x3d.py may not quite manage a roundtrip back to XML for MetadataSet.

 

 
<https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter01Techni
calOverview/EmptySceneCoreProfileIndex.html>
https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter01Technic
alOverview/EmptySceneCoreProfileIndex.html

 

has the model in XML encoding:

 

..

<Scene>

  <!-- Core profile can only contain WorldInfo and Metadata nodes. here!!!
-->

  <WorldInfo title='EmptySceneCoreProfile.x3d'/>

  <WorldInfo title='EmptySceneCoreProfile.x3d'>

    <MetadataSet name='NodeSet' containerField='metadata'>

      <MetadataBoolean containerField='value' name='BooleanData'

value='true false'/>

      <MetadataDouble containerField='value' name='DoubleData' value='1 2
3'/>

      <MetadataFloat containerField='value' name='FloatData' value='4 5 6'/>

      <MetadataInteger containerField='value' name='IntegerData' value='7 8
9'/>

      <MetadataString containerField='value' name='StringData'

value='"Empty Scene" "Core Profile"'/>

    </MetadataSet>

  </WorldInfo>

</Scene>

...

 

Running
<https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter01Techni
calOverview/EmptySceneCoreProfile.py>
https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter01Technic
alOverview/EmptySceneCoreProfile.py

 

with the latest x3d.py confirms well formedness of the .XML() output.

 

Uncommenting the diagnostic line to print the XML output gives this XML:

 

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN"

" <https://www.web3d.org/specifications/x3d-3.3.dtd>
https://www.web3d.org/specifications/x3d-3.3.dtd">

<X3D profile='Core' version='3.3'

xmlns:xsd='https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2F
www.w3.org%2F2001%2FXMLSchema-instance&data=05%7C01%7Cbrutzman%40nps.edu%7C8
d4dea2a666142e7e57c08dbda35cdad%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7
C638343696855767086%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2lu
MzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Gy9if2fCFr6lduPoGln
0pUEBvJCv5XZvCU%2FvM2QFRro%3D&reserved=0'

xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.3.
xsd'>

  <head>

...

</head>

  <Scene>

    <WorldInfo title='EmptySceneCoreProfile.x3d'/>

    <WorldInfo title='EmptySceneCoreProfile.x3d'>

      <MetadataSet name='NodeSet'>

        <MetadataBoolean name='BooleanData' value='true false'/>

        <MetadataDouble name='DoubleData' value='1 2 3'/>

        <MetadataFloat name='FloatData' value='4 5 6'/>

        <MetadataInteger name='IntegerData' value='7 8 9'/>

        <MetadataString name='StringData' value='"Empty Scene" "Core
Profile"'/>

      </MetadataSet>

    </WorldInfo>

  </Scene>

</X3D>

 

The Metadata containerField attributes of the original XML encoding were
omitted. This is ok for most Metadata nodes since the default containerField
value is 'value'.

 

 
<https://www.web3d.org/specifications/X3dSchemaDocumentation4.0/x3d-4.0_Meta
dataSet.html#Link561>
https://www.web3d.org/specifications/X3dSchemaDocumentation4.0/x3d-4.0_Metad
ataSet.html#Link561

defines the default value for the MetadataSet containerField attribute also
as 'value'. However, in the example the containerField attribute value for
the MetadataSet node needs to be 'metadata' and not 'value', in the x3d.py
generated XML.

 

I believe this may be an example of what John encountered.

 

One option for x3d.py may be to generate containerField attributes for all
nodes since x3d.py will know the field name for which a node is the value.
Perhaps it suffices to do this for all nodes where the containerField
attribute value would not be 'children'. It may not be practical to embed
the containerField default values for all nodes in the x3d.py source.

 

I just noticed that x3d.py explicitly generates X3D 3.3 xml output.

The above only applies to X3D 4.0. However, the same issue persists in a
flipped way with X3D 3.3 which has 'metadata' as default containerField
value for Metadata nodes. This means in the x3d.py generated output all
Metadata nodes except for MetadataSet would need an explicit containerField
value of 'value'.

 

-Andreas

--

Andreas Plesch

Waltham, MA 02453

 

_______________________________________________

x3d-public mailing list

 <mailto:x3d-public at web3d.org> x3d-public at web3d.org

 <http://web3d.org/mailman/listinfo/x3d-public_web3d.org>
http://web3d.org/mailman/listinfo/x3d-public_web3d.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20231101/4121c48c/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5464 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20231101/4121c48c/attachment-0001.p7s>


More information about the x3d-public mailing list