<div dir="auto">Another idea is to write a post-processor to add containerField output. I’m not volunteering.</div><div dir="auto"><br></div><div dir="auto">John </div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Oct 31, 2023 at 12:21 PM Andreas Plesch <<a href="mailto:andreasplesch@gmail.com">andreasplesch@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">x3d.py may not quite manage a roundtrip back to XML for MetadataSet.<br>
<br>
<a href="https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter01TechnicalOverview/EmptySceneCoreProfileIndex.html" rel="noreferrer" target="_blank">https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter01TechnicalOverview/EmptySceneCoreProfileIndex.html</a><br>
<br>
has the model in XML encoding:<br>
<br>
..<br>
<Scene><br>
<!-- Core profile can only contain WorldInfo and Metadata nodes. here!!! --><br>
<WorldInfo title='EmptySceneCoreProfile.x3d'/><br>
<WorldInfo title='EmptySceneCoreProfile.x3d'><br>
<MetadataSet name='NodeSet' containerField='metadata'><br>
<MetadataBoolean containerField='value' name='BooleanData'<br>
value='true false'/><br>
<MetadataDouble containerField='value' name='DoubleData' value='1 2 3'/><br>
<MetadataFloat containerField='value' name='FloatData' value='4 5 6'/><br>
<MetadataInteger containerField='value' name='IntegerData' value='7 8 9'/><br>
<MetadataString containerField='value' name='StringData'<br>
value='"Empty Scene" "Core Profile"'/><br>
</MetadataSet><br>
</WorldInfo><br>
</Scene><br>
...<br>
<br>
Running <a href="https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter01TechnicalOverview/EmptySceneCoreProfile.py" rel="noreferrer" target="_blank">https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter01TechnicalOverview/EmptySceneCoreProfile.py</a><br>
<br>
with the latest x3d.py confirms well formedness of the .XML() output.<br>
<br>
Uncommenting the diagnostic line to print the XML output gives this XML:<br>
<br>
<?xml version="1.0" encoding="UTF-8"?><br>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN"<br>
"<a href="https://www.web3d.org/specifications/x3d-3.3.dtd" rel="noreferrer" target="_blank">https://www.web3d.org/specifications/x3d-3.3.dtd</a>"><br>
<X3D profile='Core' version='3.3'<br>
xmlns:xsd='<a href="http://www.w3.org/2001/XMLSchema-instance" rel="noreferrer" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a>'<br>
xsd:noNamespaceSchemaLocation='<a href="https://www.web3d.org/specifications/x3d-3.3.xsd" rel="noreferrer" target="_blank">https://www.web3d.org/specifications/x3d-3.3.xsd</a>'><br>
<head><br>
...<br>
</head><br>
<Scene><br>
<WorldInfo title='EmptySceneCoreProfile.x3d'/><br>
<WorldInfo title='EmptySceneCoreProfile.x3d'><br>
<MetadataSet name='NodeSet'><br>
<MetadataBoolean name='BooleanData' value='true false'/><br>
<MetadataDouble name='DoubleData' value='1 2 3'/><br>
<MetadataFloat name='FloatData' value='4 5 6'/><br>
<MetadataInteger name='IntegerData' value='7 8 9'/><br>
<MetadataString name='StringData' value='"Empty Scene" "Core Profile"'/><br>
</MetadataSet><br>
</WorldInfo><br>
</Scene><br>
</X3D><br>
<br>
The Metadata containerField attributes of the original XML encoding<br>
were omitted. This is ok for most Metadata nodes since the default<br>
containerField value is 'value'.<br>
<br>
<a href="https://www.web3d.org/specifications/X3dSchemaDocumentation4.0/x3d-4.0_MetadataSet.html#Link561" rel="noreferrer" target="_blank">https://www.web3d.org/specifications/X3dSchemaDocumentation4.0/x3d-4.0_MetadataSet.html#Link561</a><br>
defines the default value for the MetadataSet containerField attribute<br>
also as 'value'. However, in the example the containerField attribute<br>
value for the MetadataSet node needs to be 'metadata' and not 'value',<br>
in the x3d.py generated XML.<br>
<br>
I believe this may be an example of what John encountered.<br>
<br>
One option for x3d.py may be to generate containerField attributes for<br>
all nodes since x3d.py will know the field name for which a node is<br>
the value. Perhaps it suffices to do this for all nodes where the<br>
containerField attribute value would not be 'children'. It may not be<br>
practical to embed the containerField default values for all nodes in<br>
the x3d.py source.<br>
<br>
I just noticed that x3d.py explicitly generates X3D 3.3 xml output.<br>
The above only applies to X3D 4.0. However, the same issue persists in<br>
a flipped way with X3D 3.3 which has 'metadata' as default<br>
containerField value for Metadata nodes. This means in the x3d.py<br>
generated output all Metadata nodes except for MetadataSet would need<br>
an explicit containerField value of 'value'.<br>
<br>
-Andreas<br>
-- <br>
Andreas Plesch<br>
Waltham, MA 02453<br>
<br>
_______________________________________________<br>
x3d-public mailing list<br>
<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a><br>
<a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org" rel="noreferrer" target="_blank">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a><br>
</blockquote></div></div>