[Laszlo-dev] datasets and XML namespace support
Henry Minsky
henry.minsky at gmail.com
Mon Sep 12 12:30:51 PDT 2005
Speaking of which, the default behavior of the data compiler right now
is to trim whitespace from the start and end of text content. I put
that in way back when to provide back compatibility when it was needed
in a hurry for the BEAM deliverable.
Should we change that to not trim whitespace by default? That would
fix another incompatibility with SOLO data loading. There is a flag,
trimwhitespace, but it defaults to true
for proxied data loading, and is ignored in SOLO (text is never trimmed)
On 9/12/05, Max Carlson <max at laszlosystems.com> wrote:
> One more vote for changing the default behavior - with a compatibility flag.
>
> -Max
>
> Henry Minsky wrote:
> > OK, that's one vote for changing the default behavior. Do I hear any others?
> >
> >
> > On 9/12/05, P T Withington <ptw at pobox.com> wrote:
> >
> >>It seems to me that the stripping of namespaces is a bug that should
> >>be fixed. If there are apps that depend on that (mis) feature, you
> >>could have a deprecated compatibility flag for one release.
> >>
> >>On 12 Sep 2005, at 12:43, Henry Minsky wrote:
> >>
> >>
> >>>I'm doing some design and implementation to add simple namespace
> >>>support to the data APIs, and wanted to get some feedback from people
> >>>on how they think things would work best.
> >>>
> >>>I'm a little surprised more people haven't run into this, but I guess
> >>>SOLO deployment hasn't been out in the wild very long. The single bug
> >>>report I have gotten so far was from someone trying to use an RSS feed
> >>>in SOLO mode.
> >>>
> >>>
> >>>Below is an excerpt from the bug I filed, and then some design
> >>>proposals.
> >>>
> >>>
> >>> Key: LPP-653
> >>> URL: http://www.openlaszlo.org/jira/browse/LPP-653
> >>> Project: OpenLaszlo
> >>> Type: Bug
> >>> Components: Laszlo Foundation Classes - Data, Server - Data Transport
> >>> Reporter: Henry Minsky
> >>> Priority: --
> >>>
> >>>
> >>>consider this XML data
> >>>
> >>>
> >>><?xml version="1.0" encoding="UTF-8"?>
> >>><rdf:RDF
> >>> xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
> >>> xmlns="http://purl.org/rss/1.0/"
> >>> xmlns:cc="http://web.resource.org/cc/"
> >>> xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/"
> >>> xmlns:dc="http://purl.org/dc/elements/1.1/"
> >>> xmlns:syn="http://purl.org/rss/1.0/modules/syndication/"
> >>> xmlns:admin="http://webns.net/mvcb/"
> >>>
> >>>
> >>>>
> >>> <channel rdf:about="http://del.icio.us/gyardley">
> >>> <title>del.icio.us/gyardley</title>
> >>> <link>http://del.icio.us/gyardley</link>
> >>>
> >>>
> >>>When loaded at runtime in SOLO mode, you get the XML basically as
> >>>above, but proxied mode, the namespace prefixes are stripped off
> >>>before the data is sent from the server, and the app sees
> >>>
> >>><RDF>
> >>> <channel about=\"http://del.icio.us/gyardley\">
> >>> <title>del.icio.us/gyardley</title>
> >>> <link>http://del.icio.us/gyardley</link>
> >>>
> >>>
> >>>
> >>>Aside from general problem losing the namespace prefixes, the
> >>>developer cannot
> >>>use the same XPath queries in SOLO and proxied mode, because
> >>>element names
> >>>(and attribute names) are different; "rdf:RDF" vs. "RDF", "rdf:about"
> >>>vs. "about".
> >>>
> >>>
> >>>
> >>>+ Proposal:
> >>>
> >>>[A] add a "nsprefix" flag to <dataset>:
> >>>
> >>> <dataset name="lds" src="namespace.xml" nsprefix="false"
> >>>request="true" type="http" />
> >>>
> >>>when nsprefix=false, namespace prefixes are discarded from element and
> >>>attribute names.
> >>>
> >>>
> >>> <dataset name="ldsns" src="namespace.xml" nsprefix="true"
> >>>request="true" type="http" />
> >>>
> >>>when nsprefix=true, namespace prefixes are preserved on element and
> >>>attribute names
> >>>
> >>>
> >>>Currently, all data loads in SOLO mode act as if nsprefix=true, due to
> >>>the Flash XML parser behavior, and all data loads in proxied mode acts
> >>>as if nsprefix=false, because we've always done it that way.
> >>>
> >>>
> >>>[B] I propose not supporting nsprefix=false in SOLO mode, for the
> >>>time being
> >>>
> >>>It would be easy to write the string string frobbing code in the LFC
> >>>to strip namespace prefixes from data nodes, in order to make it act
> >>>like proxied data does now, but it seems to me that would be a
> >>>performance hit that not many developers would want to choose, given
> >>>how slow actionscript is already.
> >>>
> >>>[C] What should be done about compile-time inline data?
> >>>
> >>>If datasets are specified as filenames, the data is compiled into the
> >>>app. In that case we have full control over what it looks like, in
> >>>either SOLO or proxied mode:
> >>>
> >>> <dataset name="localds" src="namespace.xml" nsprefix="false" />
> >>>
> >>> <dataset name="localdsns" src="namespace.xml" nsprefix="true" />
> >>>
> >>>The question is what should the default setting of the nsprefix
> >>>flag be?
> >>>
> >>>Should it remain false in both the SOLO and proxied case? Or should it
> >>>default to true in the SOLO case, so that these cases return
> >>>exactly the
> >>>same values for node and attribute names in SOLO mode?
> >>>
> >>>
> >>> <dataset name="foo" src="namespace.xml" /> # inline
> >>>
> >>> <dataset name="bar" src="namespace.xml" type="http" /> # http
> >>>runtime loaded
> >>>
> >>>
> >>>
> >>>
> >>>--
> >>>Henry Minsky
> >>>Software Architect
> >>>hminsky at laszlosystems.com
> >>>
> >>>_______________________________________________
> >>>Laszlo-dev mailing list
> >>>Laszlo-dev at openlaszlo.org
> >>>http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
> >>>
> >>
> >>
> >
> >
>
>
--
Henry Minsky
Software Architect
hminsky at laszlosystems.com
More information about the Laszlo-dev
mailing list