<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body lang=EN-US link=blue vlink="#954F72"><div class=WordSection1><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>John, looks like there is still a problem in .x3d -> .json stylesheet conversion.  Output attached.  Perhaps you can spot the difficulty there?  Looks like the MetadataSet for EntityDefinition doesn't have a proper containerField setting.  Further trickiness...</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>aha.  Each MetadataSetObject has two child-field methods</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>   SFNode:</p><p class=MsoNormal>                setMetadata(X3DMetadataObject newValue)</p><p class=MsoNormal>                http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/sai/Core/MetadataSet.html#setMetadata-org.web3d.x3d.sai.Core.X3DMetadataObject-</p><p class=MsoNormal>   MFNode:</p><p class=MsoNormal>                setValue(X3DNode[] newValue)</p><p class=MsoNormal>                http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/sai/Core/MetadataSet.html#setValue-org.web3d.x3d.sai.Core.X3DNode:A-</p><p class=MsoNormal>--</p><p class=MsoNormal><span style='color:#70AD47'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#70AD47'>I believe I use the setMetadata option, even with multiple metadata objects.  But I need to confirm that.  It seems very confusing that setValue is used with MFNode, but oh well.   Results of research:  I use setMetadata() with the Metadata* objects, and addValue() with the MetadataSet objects.  See Bollard.java attached.  So the addValue must have superceded the containerField somehow.  Hmm.  Ah yes, I see, the are duplicate keys in my JSON object, and the addValue value overwrites setMetadata.  Hmm.  Should it be setMetadata or addValue?  I believe this is the only place that I have addValue in my map to method object.  So we can delete the method, but the question becomes, where does it come from, and would addChildren/addChild be better?  Anyway excellent catch!  I know I have some overriding of child object types which comes from non-discriminatory use of the Object Model (and I need to redo this with the new object model).  Consider what addValue means and if you really mean addChildren.  IDK.<o:p></o:p></span></p><p class=MsoNormal><span style='color:#70AD47'><o:p> </o:p></span></p><p class=MsoNormal>I checked the original model and it appears to have the correct Metadata* containerField values.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>                https://savage.nps.edu/Savage/Buildings/SecurityPerimeter/BollardIndex.html</p><p class=MsoNormal>                https://savage.nps.edu/Savage/Buildings/SecurityPerimeter/Bollard.html</p><p class=MsoNormal>                https://savage.nps.edu/Savage/Buildings/SecurityPerimeter/Bollard.x3d</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Excerpt:</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><MetadataSet name='SMAL' reference=' https://savage.nps.edu/Savage/Tools/SMAL/SMAL.html ' containerField='metadata'></p><p class=MsoNormal>                <MetadataString containerField='value' name='version' value='"1.0"'></p><p class=MsoNormal>                                <MetadataString name='appinfo' value='"This is the version of SMAL employed, not of the model."' containerField='metadata'/></p><p class=MsoNormal>                </MetadataString></p><p class=MsoNormal>                <MetadataSet containerField='value' name='EntityDefinition'></p><p class=MsoNormal>                <!-- Identifying metadata for the current simulation of interest --></p><p class=MsoNormal>                                etc.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>John, it appears that you must already look at containerField values when populating MetadataSet children appropriately.  Please confirm whether all this makes sense.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='color:#70AD47'>This is what I do when I hit a containerField in DOM.  Grandparent is the parent of element.  Essentially, when I find a containerField in DOM, I create a set method based on the container field value, then call the set method on the parent node, passing the child.<o:p></o:p></span></p><p class=MsoNormal><span style='color:#70AD47'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#70AD47'>       for (let a in element.attributes) {<o:p></o:p></span></p><p class=MsoNormal><span style='color:#70AD47'>                let attrs = element.attributes;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#70AD47'>                try {<o:p></o:p></span></p><p class=MsoNormal><span style='color:#70AD47'>                        parseInt(a);<o:p></o:p></span></p><p class=MsoNormal><span style='color:#70AD47'>                        if (attrs.hasOwnProperty(a) && attrs[a].nodeType == 2) {<o:p></o:p></span></p><p class=MsoNormal><span style='color:#70AD47'>                                let attr = attrs[a].nodeName;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#70AD47'>[snip]<o:p></o:p></span></p><p class=MsoNormal><span style='color:#70AD47'>                                if (attr === 'containerField') {<o:p></o:p></span></p><p class=MsoNormal><span style='color:#70AD47'>                                        let method = attrs[a].nodeValue;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#70AD47'>                                        method = "set"+method.charAt(0).toUpperCase() + method.slice(1);<o:p></o:p></span></p><p class=MsoNormal><span style='color:#70AD47'>                                        str += "                "+grandparent.nodeName+gn+"."+method+"(";<o:p></o:p></span></p><p class=MsoNormal><span style='color:#70AD47'>                                        str += element.nodeName+n;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#70AD47'>                                } else {<o:p></o:p></span></p><p class=MsoNormal><span style='color:#70AD47'>[snip]<o:p></o:p></span></p><p class=MsoNormal><span style='color:#70AD47'>                                   }<o:p></o:p></span></p><p class=MsoNormal><span style='color:#70AD47'>                                str += ");\n";<o:p></o:p></span></p><p class=MsoNormal><span style='color:#70AD47'>                        }<o:p></o:p></span></p><p class=MsoNormal><span style='color:#70AD47'>                } catch (e) {<o:p></o:p></span></p><p class=MsoNormal><span style='color:#70AD47'>                        console.error(e);<o:p></o:p></span></p><p class=MsoNormal><span style='color:#70AD47'>                }<o:p></o:p></span></p><p class=MsoNormal><span style='color:#70AD47'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#70AD47'>I also disable regular parent/child adding/setting if the child has a containerField.<o:p></o:p></span></p><p class=MsoNormal><span style='color:#70AD47'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#70AD47'>Not sure if that’s right or not.  Last I checked, it didn’t work with CADFace and Shape or perhaps Transform (shape container field), but something might have changed.  .  Attached is a recent set of files I worked with.<o:p></o:p></span></p><p class=MsoNormal><span style='color:#70AD47'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#70AD47'>I do need to upgrade and run on a recent set of java files.  Mine are dated as of 2/26.<o:p></o:p></span></p><p class=MsoNormal><span style='color:#70AD47'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#70AD47'>John<o:p></o:p></span></p></div></body></html>