[x3d-public] quotes in xml -> xhtml conversion

Don Brutzman brutzman at nps.edu
Sat Jan 23 23:49:31 PST 2016


cc: group due to likely general interest, hope that is OK

On 1/23/2016 12:12 PM, Andreas Plesch wrote:
> While cleaning up GeoLOD implementation I noticed the following.
>
> The Geospatial Squaw Valley example at
>
> http://www.web3d.org/x3d/content/examples/Basic/#Geospatial
>
> has double quotes surrounding the content field value of the meta node in the canonical xml:
>
> http://www.web3d.org/x3d/content/examples/Basic/Geospatial/SquawCanonical.xml
>
> but has singles quotes surrounding the same field value in the xhtml:
>
> http://www.web3d.org/x3d/content/examples/Basic/Geospatial/Squaw.xhtml
>
> which leads to an unavoidable parsing error because the value string has an embedded single quote.
>
> The safest way to deal with embedded quotes may be to escape them (&quot) but I am not sure. Keeping the surrounding quotes as double quotes may also work but then it is necessary to escape embedded double quotes (which may more rarely occur).

Thanks for your error report Andreas.  Just to be sure, I think you are talking about the following tag:

     <meta content='This model was output using the GeoVRML export capabilities of ESRI's 3D Analyst Extension for ArcView/ArcInfo 8.1 product (official release date Q1 2001). This example is created by combining an ortho image (retouched to have a blue color) with a DEM of the squaw valley, near Lake Tahoe. Coordinates are UTM.' name='description'/>

http://www.web3d.org/x3d/content/examples/Basic/Geospatial/Squaw.xhtml (pretty print)
http://www.web3d.org/x3d/content/examples/Basic/Geospatial/Squaw.xhtml (problem version)

I typically use apostrophes for attribute='value' definitions to simplify handling of quote marks.

Incidentally, ' and " are always safe in HTML  as part of attribute content, regardless of whether apostrophes or quote marks are used to contain that data.
http://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html#HTML

More on this topic can be found in _X3D for Web Authors_ and the following links.
- corresponding slideset, under Thttp://x3dgraphics.com/slidesets/X3dForWebAuthors/Chapter02-GeometryPrimitives.pdf
   especially slides 25-27
- http://x3dgraphics.com/examples/X3dForWebAuthors/Chapter02-GeometryPrimitives/#TextSpecialCharacters
- X3D-Edit usually handles all such conversions for the author.

As it turns out, "user agents" (a fancy spec term for software tools) are allowed to use either apostrophe or quote-mark pairs for attribute values - the resulting XML document does not have to match the original author's XML document in this respect.

I try to apply things consistently and get these right when converting to X3D Canonical, pretty-print HTML, X3D Tidy etc.

Looks OK:
http://www.web3d.org/x3d/content/examples/Basic/Geospatial/Squaw.x3d
http://www.web3d.org/x3d/content/examples/Basic/Geospatial/Squaw.html

Aha, failure confirmed (earlier version):
http://www.web3d.org/x3d/content/examples/Basic/Geospatial/Squaw.xhtml
======================================================================
XML Parsing Error: not well-formed Location: http://www.web3d.org/x3d/content/examples/Basic/Geospatial/Squaw.xhtml Line Number 213, Column 84:
<meta content='This model was output using the GeoVRML export capabilities of ESRI's 3D Analyst Extension for ArcView/ArcInfo 8.1 product - etc.' name='description'/>
-----------------------------------------------------------------------------------^
======================================================================

took a little bit of doing but i think that attribute values are better escaped now.  corrected test-output copy attached for archives, this online link is working now.

... Corrected versions of all Geospatial example .xhtml versions are now refreshed online, hope that helps your continued testing and improvements for X3DOM.  i will run the improved stylesheet on all example scenes and upload the .xhtml X3DOM versions next week.
http://www.web3d.org/x3d/content/examples/Basic/Geospatial

Also updated the internal list of supported nodes in X3dToX3dom.xslt stylesheet to match the current list at
http://doc.x3dom.org/author/nodes.html

There were also some overzealous diagnostics in the X3D Validator and X3D DTD for this geospatial scene... most improvements complete.
https://savage.nps.edu/X3dValidator?url=http://www.web3d.org/x3d/content/examples/Basic/Geospatial/Squaw.x3d

The Squaw valley scene examples are curious because they came from an old ESRI tool, and because it only uses one of 4 quad urls in each GeoLOD.  Probably ought to be improved.

Again thanks for reporting this deficiency.

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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Squaw.x3d (X3dToDom)
Type: application/xhtml+xml
Size: 102590 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20160123/0d9eab06/attachment-0001.xhtml>


More information about the x3d-public mailing list