[x3d-public] jupyter notebook; X3DOM syntax for including X3Dwithin HTML

John Carlson yottzumm at gmail.com
Sat Jun 1 14:05:14 PDT 2019


I believe I saw this space somewhere else, perhaps in my serializers, and I
removed it by filtering out zero length or null SFStrings.

On Sat, Jun 1, 2019 at 4:01 PM John Carlson <yottzumm at gmail.com> wrote:

> I’m not sure where the space came from in this example, but removing it
> might make things easier.
>
> John
>
> On Sat, Jun 1, 2019 at 3:51 PM Andreas Plesch <andreasplesch at gmail.com>
> wrote:
>
>> Hi John,
>>
>> thanks. I tried ElementTree.tostring as in
>>
>> ET.tostring(ET.XML(X3D0.toStringX3D()), short_empty_elements=False)
>>
>> and it does generate the full tags.
>>
>> But it does not preserve the X3D quoting for MFStrings. It represents
>> url=' " ... as url=" " which may work in some players but is not X3D.
>>
>> I do not want to reopen the MFString discussion.
>>
>> I will check if x3dom can work with these quotes. If so, such a wrapper
>> could become a solution and may be considered in a potential x3dpsail so
>> users do not have to rediscover.
>>
>> Andreas
>>
>>
>> On Sat, Jun 1, 2019 at 12:21 AM John Carlson <yottzumm at gmail.com> wrote:
>> >
>> > I’m just holding up the conversation until Don provides feedback.  No
>> need to read.
>> >
>> >
>> >
>> > It’s a custom serializer written in Java, no DOM involved on output.
>> Don would know.  I’m not sure if he’s just reticent to change or there’s
>> another requirement for roundtrip testing perhaps.
>> >
>> >
>> >
>> > The options are stored in the ConfigurationProperties class.
>> >
>> >
>> >
>> > It might be more flexible to write a
>> >
>> >
>> >
>> > toDOM() method
>> >
>> >
>> >
>> > which could be rendered into XML, XHTML, HTML, … several ways, with
>> serializers provided by the application programmer.
>> >
>> >
>> >
>> > I believe XSLT could transform DOM, but I haven’t done it.
>> >
>> >
>> >
>> > There currently isn’t any Python ElementTree anything implemented.  It
>> is desired to generate XML from another generated python API, if you’re
>> interested in digging into the “research” API.
>> >
>> >
>> >
>> > Yeah, I’m not doing anything but emails right now.  I’m hopefully
>> sitting on some golden eggs which are about to hatch.  Maybe I’m inventing
>> something bigger than design patterns (higher level of complexity)
>> https://en.wikipedia.org/wiki/Model_of_hierarchical_complexity#Stages_of_hierarchical_complexity
>> https://en.wikipedia.org/wiki/Software_design_pattern  Christopher
>> Alexander only covers visual aspects I think, and not non-visual aspects.
>> Design Patterns works on non-visual aspects.   There is also hearing and
>> feeling and manipulating.  For example, what is the pattern behind the
>> mouse, the keyboard, the webcam, the display etc.   Do we have senses
>> beyond the normal 5 which can be put into a pattern?  A sense of comfort?
>> A sense of ease?  A sense of ease of use?  What makes an API easy to use?
>>  What is a “good” API?
>> >
>> >
>> >
>> > John
>> >
>> >
>> >
>> > Sent from Mail for Windows 10
>> >
>> >
>> >
>> > From: Andreas Plesch
>> > Sent: Friday, May 31, 2019 10:26 PM
>> > To: X3D Graphics public mailing list
>> > Subject: Re: [x3d-public] jupyter notebook; X3DOM syntax for including
>> X3Dwithin HTML
>> >
>> >
>> >
>> > The Python core ElementTree.write method
>> >
>> >
>> >
>> >
>> https://docs.python.org/3/library/xml.etree.elementtree.html#xml.etree.ElementTree.ElementTree.write
>> >
>> >
>> >
>> > has the short_empty_elements option which allows for outputting end
>> tags for empty elements.
>> >
>> >
>> >
>> > I was looking for a similar option. If the underlying java XML
>> serializer has such an option why not pass it along ?
>> >
>> >
>> >
>> > Andreas
>> >
>> >
>> >
>> > ---on the phone---
>> >
>> >
>> >
>> > On Fri, May 31, 2019, 8:56 PM Andreas Plesch <andreasplesch at gmail.com
>> wrote:
>> >
>> > Well, if it was xhtml we were talking about you would be correct.
>> >
>> > But, it is html without the x which is expected by the HTML renderer
>> > in Jupyter. There is no XHTML renderer since the Jupyter notebook
>> > itself is a HTML document.
>> >
>> > And html allows singleton tags only for certain tags, at least in how
>> > all browser parse the markup, and probably also as defined in the
>> > HTML5 spec. These certain tags may include all known HTML elements
>> > which do not use their text content. Unfortunately, the X3D tags are
>> > considered Unknown Elements by html and they seem to require the
>> > explicit end tag.
>> >
>> > x3dom does not use any HTML parsing libraries but completely relies on
>> > the web browser to do the parsing. And the browsers get confused,
>> > because they do not understand the singleton x3d tags in a html
>> > document.
>> >
>> > Alas, if the xml serializing library in X3DJSAIL does not have an
>> > option to generate full tags (they would be still legal XML, no?), we
>> > would need to settle for xhtml IFrames which can also be included in a
>> > Jupyter notebook (but not tested yet), or, as another option, wrap the
>> > xml X3D into an Inline since x3dom always uses the browser XML parser
>> > for Inlines. Would x3d.toStringX3DInline(filename) be considered too
>> > extravagant ? It would generate an xml X3D document string with a
>> > single Inline node, and also the content X3D in the file filename.
>> > x3d.toFileX3DInline(x3dFileName, inlineFileName) would generate two
>> > files.
>> >
>> > Perhaps Python has an option to serialize out the full tags, perhaps
>> > as HTMLFragments. Then a x3d.toStringFullTags() could be included
>> > outside of X3DJSAIL, and with X3DPSAIL.
>> >
>> > To consider X_ITE and x3dom together it would be first necessary get
>> > X_ITE to work at all with Jupyter locally generated content. It may be
>> > possible since X_ITE works with remote URLs in Jupyter.
>> >
>> > -Andreas
>> >
>> > ---on the phone---
>> >
>> > On Fri, May 31, 2019, 5:14 PM <x3d-public-request at web3d.org wrote:
>> > >
>> > > Send x3d-public mailing list submissions to
>> > >         x3d-public at web3d.org
>> > >
>> > > To subscribe or unsubscribe via the World Wide Web, visit
>> > >         http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>> > > or, via email, send a message with subject or body 'help' to
>> > >         x3d-public-request at web3d.org
>> > >
>> > > You can reach the person managing the list at
>> > >         x3d-public-owner at web3d.org
>> > >
>> > > When replying, please edit your Subject line so it is more specific
>> > > than "Re: Contents of x3d-public digest..."
>> > >
>> > >
>> > > Today's Topics:
>> > >
>> > >    1. Re: jupyter notebook; X3DOM syntax for including X3D within
>> > >       HTML/XHTML (Brutzman, Donald (Don) (CIV))
>> > >
>> > >
>> > > ----------------------------------------------------------------------
>> > >
>> > > Message: 1
>> > > Date: Fri, 31 May 2019 10:14:05 +0000
>> > > From: "Brutzman, Donald (Don) (CIV)" <brutzman at nps.edu>
>> > > To: "x3d-public at web3d.org" <x3d-public at web3d.org>
>> > > Subject: Re: [x3d-public] jupyter notebook; X3DOM syntax for including
>> > >         X3D within HTML/XHTML
>> > > Message-ID: <b6c49fa9-6afc-34fe-ee57-59f0ad5fc99d at nps.edu>
>> > > Content-Type: text/plain; charset="utf-8"
>> > >
>> > > thanks for great progress.
>> > >
>> > > On 5/28/2019 12:12 PM, Andreas Plesch wrote:
>> > > > - x3dom has a problem with generated X3D outside of an Inline
>> because
>> > > > the serialized XML output uses self-closing tags such as <Material
>> />
>> > > > which is not HTML compatible.
>> > >
>> > > HTML allows singleton elements, i.e. self-closing tags.
>> > >
>> > > Similarly, element CamelCaseElementNames are legal, so we should not
>> have to rename <Material/> to <material></material> simply because of
>> similarity to another language's naming patterns.
>> > >
>> > > i think root of this problem likely lies in how X3DOM uses the
>> accompanying DOM libraries - not sure of those details.
>> > >
>> > > Note that I got *all* of the X_ITE and X3DOM examples to work with
>> HTML by assigning scenes to .html and .xhtml respectively.
>> > >
>> > > http://www.web3d.org/x3d/content/examples/X3dResources.html#Examples
>> > >
>> > >
>> http://x3dgraphics.com/examples/X3dForWebAuthors/Chapter01TechnicalOverview/HelloWorldIndex.html
>> > >
>> http://x3dgraphics.com/examples/X3dForWebAuthors/Chapter01TechnicalOverview/HelloWorldX3dom.xhtml
>> > >
>> http://x3dgraphics.com/examples/X3dForWebAuthors/Chapter01TechnicalOverview/HelloWorldX_ITE.html
>> > >
>> > > > So the suggestion would be to provide a method, say
>> > > > x3d.toStringX3DClosingTags(), which generates explicit closing tags:
>> > > > <Material></Material>
>> > >
>> > > I don't think it is good to propagate a side-effect fix (which
>> encourages mysterious improper practices and hides path towards fixes).
>> > >
>> > > Rather it is more desirable to isolate and fix the actual problem.
>> If someone can figure out why X3DOM runs differently when included within
>> .xhtml and .html pages, that may reveal whatever idiosyncrasy is actually
>> occurring.
>> > >
>> > > Finally we want to match the same patterns in X_ITE and X3DOM so that
>> choice of player is independent of source-model syntax when using X3D
>> version 4.  So this is a worthy mismatch to figure out and fix.  Hopefully
>> we can get closer to sorting things out fully.
>> > >
>> > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>> > >
>> > > Meanwhile: found and fixed several errors in online X3DOM .xhtml
>> examples:
>> > > - corrected url to match changed release address:
>> > >    https://x3dom.org/release/x3dom.css
>> > >    https://x3dom.org/release/x3dom-full.js
>> > >
>> > > - fixed bug in X3dToX3dom.xslt code logic in order to include
>> function toggleFullscreen ()
>> > >
>> > > - using XHTML Transitional (vice Strict) DTD in order for anchor
>> target attribute to pass validation
>> > >
>> https://stackoverflow.com/questions/4666523/xhtml-strict-1-0-target-blank-not-valid
>> > >
>> > > X3dToX3dom.xslt stylesheet correction checked in, X3DOM example pages
>> updated and uploaded.  Having fun with X3DOM!  8)
>> > >
>> > > 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
>> http://faculty.nps.edu/brutzman
>> > >
>> > > ------------------------------
>> > >
>> > > Subject: Digest Footer
>> > >
>> > > _______________________________________________
>> > > x3d-public mailing list
>> > > x3d-public at web3d.org
>> > > http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>> > >
>> > >
>> > > ------------------------------
>> > >
>> > > End of x3d-public Digest, Vol 122, Issue 137
>> > > ********************************************
>> >
>> >
>>
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20190601/b2245037/attachment-0001.html>


More information about the x3d-public mailing list