Bug 32543 - remove lenya:dummy namespace workaround
Summary: remove lenya:dummy namespace workaround
Status: NEW
Alias: None
Product: Lenya
Classification: Unclassified
Component: Form Editor (show other bugs)
Version: unspecified
Hardware: PC Windows XP
: P2 normal
Target Milestone: 2.0.1
Assignee: Lenya Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-06 16:33 UTC by Gregor J. Rothfuss
Modified: 2007-07-16 02:26 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gregor J. Rothfuss 2004-12-06 16:33:25 UTC
On 6.12.2004 10:06 Uhr, Michael Wechner wrote:

> Gregor J. Rothfuss wrote:
>
>> michi, do you recall if we still need
>>
>> <?xml version="1.0" encoding="UTF-8"?><html
xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:unizh="http://unizh.ch/doctypes/elements/1.0"
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns="http://www.w3.org/1999/xhtml"
dc:dummy="FIXME:keepNamespace" dcterms:dummy="FIXME:keepNamespace"
lenya:dummy="FIXME:keepNamespace" unizh:columns="2">
>>
>> the dummy namespace declarations?
>
> yes, the "multiple" forms editor gets a problem otherwise (see FIXME)
>
> src/java/org/apache/lenya/cms/cocoon/acting/HTMLFormSaveAction.java
>
> because IIRC org.apache.xpath.compiler.XPathParser will have a problem.
>
> Some time ago I had an idea how to fix this, but didn't get around to try it out.


In libxml2 (the XML/XSLT/XPath library I use), the XPath engine is only aware of
prefix-to-namespaceURI mappings defined in the root node (or the context note,
for that matter). In JS it's basically the same, and it looks like in your
engine, also. According to the spec, this doesn't have to happen, but usually
engines do that for easier use.

Therefore, looks like you need your own PrefixResolver for making XPath
correctly work ( found this
http://www.stylusstudio.com/api/xalan-j_2_6_0/org/apache/xml/utils/PrefixResolver.htm
). We had to do this in BXE as well. And in PHP there's a method
$xpathquery->registerNamespace($prefix,$uri) for the same problem.

The same goes for default namespaces (another fixme in that file). There are no
default namespaces in XPath ;) You have to use some prefixes for them (and of
course register, resp. do an PrefixResolver)

HTH

chregu

>> iirc they are in there because one of the form editors would strip them out
otherwise.
Comment 1 Jean Pierre LeJacq 2004-12-16 18:07:30 UTC
A bit more information.  If a document has the following namespaces and dummy
attributes defined:

  <html
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:xhtml="http://www.w3.org/1999/xhtml"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0"
    xhtml:dummy="FIXME:keepNamespace"
    dc:dummy="FIXME:keepNamespace"
    lenya:dummy="FIXME:keepNamespace"
    >

The forms editor writes this out in the work area:

  <html
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0"
    dc:dummy="FIXME:keepNamespace"
    lenya:dummy="FIXME:keepNamespace"
    tagID="tag.1"
    :dummy="FIXME:keepNamespace"
    >

The problem seems to be with the default namespace being stripped by
the forms editor.

Michi points out that XSLT is being used during saving:

  src/java/org/apache/lenya/cms/cocoon/acting/HTMLFormSaveAction.java

So switching the XSLT processor library might cause a problem.
Comment 2 Gregor J. Rothfuss 2005-04-18 00:03:09 UTC
i believe this has been addressed with the port of the multiple forms editor to
uc fw