<div dir="auto">What’s relevant to me is I have often commented out large multi-line chunks of XML in my .x3d files with a multi-line comment, so going back and making them multiple single line comments without making long lines is especially relevant!</div><div dir="auto"><br></div><div dir="auto">I’m going to pursue the Java SAXParser in the short term as an experiment.  If it doesn’t work out, I’ll revert the .x3d code and think again!</div><div dir="auto"><br></div><div dir="auto">If you put a newline in an “XML” attribute in a multi-line comment, dang it, I can’t handle that yet,  can a better XSLT tokenizer identify newlines between quotes in a multi-line comment?  What a hairy mess!</div><div dir="auto"><br></div><div dir="auto">I don’t really like newlines in XML attributes, maybe they should be banned in the XML encoding?</div><div dir="auto"><br></div><div dir="auto">I guess I can put a better parser for comments in the SAXParser.</div><div dir="auto"><br></div><div dir="auto">Back to you, Don.</div><div dir="auto"><br></div><div dir="auto">Thanks for wise words,</div><div dir="auto"><br></div><div dir="auto">John </div><div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Mon, Jan 5, 2026 at 10:42 AM Don Brutzman <<a href="mailto:don.brutzman@gmail.com">don.brutzman@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div dir="ltr"><div>Here are some details and a separate XML example that is relevant.</div><div><br></div><div>XSLT makes it easy to normalize all whitespace characters in a comment, or attribute.  For example, the XSLT function <font face="monospace" style="font-family:monospace;color:rgb(0,0,0)">normalize-space(.)</font> replaces a whitespace character, tab, newline, or linebreak character with a single space between other non-whitespace characters.</div><div><br></div><div>Authors can maintain positive control of their model comments in X3D source files (XML, ClassicVRML, JSON, binary, turtle) by splitting or combining each comment themselves.  JSON does not have any comment capability, by the originator's design, so we have represented them by creating an explicit class.</div><div><br></div><div>Often a comment with longer edited multiline prose might be better served by producing other documentation, or by splitting and separating into smaller chunks.  Shifting to plain-old XML, for example, the X3D tooltips inserts hints and warnings in attribute text.</div><div><ul><li>Extensible 3D (X3D) 4.0 Tooltips</li><li>X3D Tooltips provide authoring hints for each node and field found in X3D Architecture version 4 International Specification (IS).<br>Developmental work on X3D draft 4.1 is also supported.</li></ul><div>Corresponding source, XSLT stylesheet and output:</div><ul><li><a href="https://www.web3d.org/x3d/tooltips/x3d-4.0.profile.xml" target="_blank">https://www.web3d.org/x3d/tooltips/x3d-4.0.profile.xml</a></li><li><a href="https://www.web3d.org/x3d/tooltips/X3dTooltipConversions.xslt" target="_blank">https://www.web3d.org/x3d/tooltips/X3dTooltipConversions.xslt</a></li><li><a href="https://www.web3d.org/x3d/tooltips/X3dTooltips.html" target="_blank">https://www.web3d.org/x3d/tooltips/X3dTooltips.html</a></li></ul></div><div>As before: persistent multiline comments are not a consistent feature in many file encodings or programming-language bindings.  Nor are they a requirement in X3D Architecture.  The option to maintain persistence of single-line comments is a goal requirement in order to maintain round-tripping interoperability.  Round-trip conversion of comments in X3D Example Archive models is an excellent way to test this, typically starting with the .x3d XML encoding.</div><div><br></div><div>Popping up a level:  if an author wants to ensure that any downstream application can never legally strip extra information, then they should use X3D MetadataString/MetadataSet structures for always-persistent retention and machine-readable structured data.</div><div><br></div><div>Popping up another level of abstraction, with apologies to René Magritte:  <font face="monospace" style="font-family:monospace;color:rgb(0,0,0)"><!-- this is not a comment --></font></div><div><ul><li>Wikipedia: The Treachery of Images</li><li><a href="https://en.wikipedia.org/wiki/The_Treachery_of_Images" target="_blank">https://en.wikipedia.org/wiki/The_Treachery_of_Images</a></li></ul></div></div><div dir="ltr"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div style="color:rgb(34,34,34)"><span style="font-family:monospace">all the best, Don</span></div><div style="color:rgb(34,34,34)"><font face="monospace" style="font-family:monospace;color:rgb(34,34,34)">-- </font></div><div style="color:rgb(34,34,34)"><font face="monospace" style="font-family:monospace;color:rgb(34,34,34)">X3D Graphics, Maritime Robotics, Distributed Simulation</font></div><div style="color:rgb(34,34,34)"><font face="monospace" style="font-family:monospace;color:rgb(34,34,34)">Relative Motion Consulting  <a href="https://RelativeMotion.info" target="_blank" style="font-family:monospace">https://RelativeMotion.info</a></font></div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jan 4, 2026 at 2:01 PM John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div dir="auto">My current plan for replacing multiple line comments with single lines comments where the comment content are preserved on separate lines is as follows:</div><div dir="auto"><br></div><div dir="auto">1.  Write a Java SAX parser to replace newlines with —>\n<!— inside XML comments.</div><div dir="auto"><br></div><div dir="auto">2.  Compile with GraalVM native-image into rnl.exe, if not taken.</div><div dir="auto"><br></div><div dir="auto">Write a script to apply to all original .x3d files in my examples.  This will call vim or ex (vim command-line), with the command, %!rnl.exe, then save and exit.</div><div dir="auto"><br></div><div dir="auto">If needed, I will include carriage return.</div><div dir="auto"><br></div><div dir="auto">Others would try to make this a stylesheet, but I don’t know if comment() can be split on newlines in XSLT.   So I’ll ask <a href="http://claude.ai" target="_blank">claude.ai</a> again!</div><div dir="auto"><br></div><div dir="auto"><div style="font-size:inherit" dir="auto"><span style="font-style:normal;font-weight:400;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;font-size:inherit;color:rgb(0,0,0)"></span></div><div style="font-size:inherit"><xsl:stylesheet version="2.0" xmlns:xsl="<a href="http://www.w3.org/1999/XSL/Transform" target="_blank">http://www.w3.org/1999/XSL/Transform</a>"><br style="font-size:inherit">  <br style="font-size:inherit">  <xsl:template match="@*|node()"><br style="font-size:inherit">    <xsl:copy><br style="font-size:inherit">      <xsl:apply-templates select="@*|node()"/><br style="font-size:inherit">    </xsl:copy><br style="font-size:inherit">  </xsl:template><br style="font-size:inherit">  <br style="font-size:inherit">  <xsl:template match="comment()"><br style="font-size:inherit">    <xsl:for-each select="tokenize(., '&#xA;')"><br style="font-size:inherit">      <xsl:if test="normalize-space(.) != ''"><br style="font-size:inherit">        <xsl:comment><xsl:value-of select="normalize-space(.)"/></xsl:comment><br style="font-size:inherit">      </xsl:if><br style="font-size:inherit">    </xsl:for-each><br style="font-size:inherit">  </xsl:template><br style="font-size:inherit">  <br style="font-size:inherit"></xsl:stylesheet></div><div style="font-size:inherit" dir="auto"><span style="font-style:normal;font-weight:400;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;font-size:inherit;color:rgb(0,0,0)"></span></div><br></div><div dir="auto">Gobbledegook to me, but maybe someone can use it.</div><div dir="auto"><br></div><div dir="auto">John</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr"><div style="font-size:inherit" dir="auto"><span>On Sun, Jan 4, 2026 at 3:32 PM John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> wrote:</span></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div dir="auto">For example, it nearly requires program to do this in Python or Perl.</div><div dir="auto"><br></div><div dir="auto">Claude.ai reports:</div><div dir="auto"><br></div><div dir="auto"><div style="font-size:inherit"><span style="font-style:normal;font-weight:400;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;font-size:inherit;color:rgb(0,0,0)">perl -i -0pe </span><span style="font-style:normal;font-weight:400;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;font-size:inherit;color:rgb(80,161,79)">'s/<!--(.*?)-->/join("\n", map {"<!-- $_ -->"} grep {s|^\s*||; s|\s*$||; $_} split("\n", $1))/gse'</span><span style="font-style:normal;font-weight:400;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;font-size:inherit;color:rgb(0,0,0)"> file.xml</span></div><br></div><div dir="auto">Obviously I can put this in a shell script, but I like stuff I can understand!</div><div dir="auto"><br></div><div dir="auto">Something in Java would be great!  Maybe I’ll write and contribute if it doesn’t already exist?</div><div dir="auto"><br></div><div dir="auto">Seems like a simple SAX parser, frankly!</div><div dir="auto"><br></div><div dir="auto">John</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jan 4, 2026 at 3:10 PM John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div dir="auto">Thanks, it wasn’t clear to me that multi-line comments were not supported in X3D XML encoding.  That clears up most of my questions!</div><div dir="auto"><br></div><div dir="auto">I will replace multi-line comments with single-line comments in my examples.   Does X3D-Edit support this feature?  This would be great, and encourage me to use it!</div><div dir="auto"><br></div><div dir="auto">John</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jan 4, 2026 at 2:46 PM Don Brutzman <<a href="mailto:don.brutzman@gmail.com" target="_blank">don.brutzman@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div dir="ltr"><div>For clarity, here is a recap of key points that can be found in prior responses and ticket issues:</div><div><ul><li>Persistent single-line comments are an important feature for X3D model conversions and interoperability.</li><li>You are welcome to use all Python features, including multi-line comments, whenever programming with Python and x3d.py.</li><li>Individual multi-line comments are not supported in a number of file encodings and programming languages.  Nor are they defined by X3D Architecture, nor are they supported by several X3D encodings (such as XML and ClassicVRML).  Thus multi-line comments are not a required feature.</li><li>Persistent comments in x3d.py Python are already supported via a Comment class.</li><li>Persistent single-line comments are now partially supported by X3dToPython.xslt converter, if present as children of Scene head and grouping nodes.  Further future work on content-model representations in the Python class hierarchy may be able to add them elsewhere (e.g. inside Shape Appearance Material geometry etc.</li><li>Tickets are closed after careful review if they are unrepeatable or unactionable.  Suggestions and questions about a clearer ticket are usually included.</li></ul><div>Hope this helps.</div></div></div><div dir="ltr"><div><br></div><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div style="color:rgb(34,34,34)"><font face="monospace" style="font-family:monospace;color:rgb(34,34,34)">all the best, Don</font></div><div style="color:rgb(34,34,34)"><font face="monospace" style="font-family:monospace;color:rgb(34,34,34)">-- </font></div><div style="color:rgb(34,34,34)"><font face="monospace" style="font-family:monospace;color:rgb(34,34,34)">X3D Graphics, Maritime Robotics, Distributed Simulation</font></div><div style="color:rgb(34,34,34)"><font face="monospace" style="font-family:monospace;color:rgb(34,34,34)">Relative Motion Consulting  <a href="https://RelativeMotion.info" style="font-family:monospace" target="_blank">https://RelativeMotion.info</a></font></div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jan 4, 2026 at 5:57 AM John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div dir="auto">Blowing off some steam.  Apologies, I probably should work out instead.</div><div dir="auto"><br></div><div dir="auto">I am unsure if it’s easier to output straight line code instead of hierarchical code in Python; multi-line non-persistent comments might become easier in straight line code.  I don’t know about comments() in XSLT.  In straight line code, wrapping a multi or single line comment in “””…””” is a cinch.  Even if newlines need to be added for the Python interpreter.  </div><div dir="auto"><span>AFAIK, I’ve already mentioned that straight line code is easier to debug</span><span>, in my mind</span><span>.  I think the Java large file discussion is still open; I know hierarchical code is more succinct, and less likely to stack overflow.  I think the choices between code structure in Python and Java might be different.</span><br></div><div dir="auto"><br></div><div dir="auto">Persistent multi-line comments are desirable, even if they aren’t present in the archive.  We will probably make different choices between hierarchical and straight line code when this feature is available.</div><div dir="auto"><br></div><div dir="auto">Short term hacks like single line comments work until features are introduced.  That doesn’t mean tickets should be closed prematurely, or examples outside the archives are invalid.</div><div dir="auto"><br></div><div dir="auto">John </div><div dir="auto"><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Dec 30, 2025 at 3:42 AM John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div><div dir="auto">Don, thanks for your comment on this ticket that naively adding Comment to a children field might not work.  That was one of my intentions on expressing myself so vocally.  I apologize for using your time to do this, but I think it revealed a possible design consideration.  I think if I had discovered it, it would have gone over like a wet balloon.</div></div><div dir="auto"><br></div><div dir="auto">Thank you again, I will not put comments arbitrarily in the scenegraph for now with my PythonSerializer.js, until you indicate it’s ready!   I will leave them out of the scenegraph, as they are now.   Since I handle comments generically, I will have to research the nodes you’ve accomplished.</div><div dir="auto"><br></div><div dir="auto">Now, can we have other multi-line comments, not in the persistent scenegraph, in Python translated from .x3d, in the short term, like:</div><div dir="auto"><br></div><div dir="auto">#</div><div dir="auto"># This is comment line 2</div><div dir="auto"># This is comment line 3</div><div dir="auto">#</div><div dir="auto"><br></div><div dir="auto">?</div><div dir="auto"><br></div><div dir="auto"><span>John</span><br></div><div><div dir="auto"><br></div><div dir="auto">From the ticket:</div><div dir="auto"><br></div><div dir="auto">“<div dir="auto" style="font-size:inherit"><div style="margin:0px;padding:0px;border:0px;outline:0px;font-size:inherit;vertical-align:baseline;background:0% 0% repeat rgba(0,0,0,0);font-family:lato,sans-serif;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;color:rgb(85,85,85)"><div style="margin:0px;padding:0px;border:0px;outline:0px;font-size:14px;vertical-align:baseline;background:0% 0% repeat rgba(0,0,0,0);font-family:lato,sans-serif"><p style="margin:0px;padding:0px 10px 1em;border:0px;outline:0px;font-size:14px;vertical-align:baseline;background:0% 0% repeat rgba(0,0,0,0);font-family:lato,sans-serif">This is not an easy fix for converting files because Comment is not part of the content model for all nodes. Solving this will probably require extending class _ X3DNode in x3d.py and sorting out possible subclass collisions. It will also be difficult to retain the original order of child nodes and child comments within a parent node.</p><p style="margin:0px;padding:0px 10px 1em;border:0px;outline:0px;font-size:14px;vertical-align:baseline;background:0% 0% repeat rgba(0,0,0,0);font-family:lato,sans-serif">This might be fixable someday - after some effort I got it working for head, Scene, field, fieldValue.. Deferred as future work.</p></div></div><span style="font-family:lato,sans-serif;font-size:inherit;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;float:none;display:inline;background-color:rgb(255,255,255);color:rgb(85,85,85)"> ”</span></div></div><div><br><div class="gmail_quote"></div></div></div><div><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Dec 29, 2025 at 12:52 PM Don Brutzman <<a href="mailto:don.brutzman@gmail.com" target="_blank">don.brutzman@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div dir="ltr"><div dir="ltr"><div><br></div></div><div dir="ltr"><div><div>I have posted a new ticket to capture this point.  Perhaps a useful exemplar, as well.</div><div><ul><li>X3D SourceForge ticket #82 creating persistent comments in python when converting from XML</li><li><a href="https://sourceforge.net/p/x3d/tickets/82/" target="_blank">https://sourceforge.net/p/x3d/tickets/82/</a></li></ul></div><div dir="auto">Hope this helps.  Again thanks for your many efforts.  Have fun improving X3D!  🤔 👍</div></div></div></div><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div><p></p></div>    <div>
    <div>
      
      
    </div>
    
    </div></blockquote></div></div>
</blockquote></div></div>
</div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div></div>
</blockquote></div>
</div>
</blockquote></div></div>
</div>
</blockquote></div></div>
</blockquote></div>
</blockquote></div></div>
</blockquote></div></div>
</blockquote></div></div>
</blockquote></div>
</blockquote></div></div>