[Yanel-dev] Another namespace problem with the XML resource

Michael Wechner michael.wechner at wyona.com
Fri Jun 26 00:15:23 CEST 2009


simon litwan schrieb:
> i'm answering to this thread, because i think i have the same problem.
> see thread [xml resource-type lossing namespace declaration when 
> applying xslt]
>
>
> Michael Wechner schrieb:
>> Josias Thöny wrote:
>>
>>>
>>>>>
>>>>> However I'm not sure if this is a good solution.
>>>>
>>>>
>>>>
>>>> why not?
>>>
>>>
>>> Our XMLSerializer expects that an element in the SAX stream with a 
>>> namespace either has an attribute which declares this namespace (or 
>>> one of the ancestors has such an attribute).
>>> AFAIK this is not required in a SAX stream, and apparently the 
>>> default of the Xerces XMLReader is to omit the namespace declaration 
>>> attributes.
>>> This has been changed by the above setFeature(...) line, but if 
>>> someone uses our serializer in a different situation, the same 
>>> problem may occur again.
>>
> i debugged a bit, and i don't think this is a problem of the seriealizer.
> because if i don't use an xslt, the serializer gets the namespace 
> declaration as an attribute within the startElement method. but if i 
> add a xslt the serializer doesn't get the the namespace declaration as 
> attribute anymore.
> to me it seems the the namespace get lost within the xslt-transformation.

btw, I have tested now

http://127.0.0.1:8080/yanel/test/use-cases/namespaces.xml

on Mac OS X with Java

java version "1.5.0_19"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_19-b02-304)
Java HotSpot(TM) Client VM (build 1.5.0_19-137, mixed mode, sharing)

and it works, whereas it generates the following code:

<?xml version="1.0"?>
<yanel:root xmlns:yanel="http://www.wyona.org/yanel/1.0" xmlns:i18n="http://www.wyona.org/yanel/i18n/1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:xhtml="http://www.w3.org/1999/xhtml"><foo:hugo xmlns:foo="http://foo.bar" foo:dummy="susi"/>
<yanel:hello>world</yanel:hello>
</yanel:root>

and the log says:

23146 2009-06-26 00:09:00,527 [http-8080-Processor25] WARN  org.wyona.yanel.core.serialization.XMLSerializer.startElement():61  - DEBUG: Attribute     : xmlns:yanel, http://www.wyona.org/yanel/1.0
23147 2009-06-26 00:09:00,528 [http-8080-Processor25] WARN  org.wyona.yanel.core.serialization.XMLSerializer.startElement():61  - DEBUG: Attribute     : xmlns:i18n, http://www.wyona.org/yanel/i18n/1.0
23147 2009-06-26 00:09:00,528 [http-8080-Processor25] WARN  org.wyona.yanel.core.serialization.XMLSerializer.startElement():61  - DEBUG: Attribute     : xmlns, http://www.w3.org/1999/xhtml
23148 2009-06-26 00:09:00,529 [http-8080-Processor25] WARN  org.wyona.yanel.core.serialization.XMLSerializer.startElement():61  - DEBUG: Attribute     : xmlns:xhtml, http://www.w3.org/1999/xhtml
23149 2009-06-26 00:09:00,530 [http-8080-Processor25] WARN  org.wyona.yanel.core.serialization.XMLSerializer.startElement():61  - DEBUG: Attribute     : xmlns:foo, http://foo.bar
23149 2009-06-26 00:09:00,530 [http-8080-Processor25] WARN  org.wyona.yanel.core.serialization.XMLSerializer.startElement():61  - DEBUG: Attribute     : foo:dummy, susi

whereas I guess the i18n namespace comes from the 

I18n transformer inside

src/impl/java/org/wyona/yanel/impl/resources/BasicXMLResource.java

whereas it is not clear to me where the xhtml namespace comes from.

Cheers

Michi


>
> simon
>>
>> ok
>>
>>>
>>>>
>>>>> I guess the "correct" solution would be to implement namespace 
>>>>> normalization in the XMLSerializer. But that might be a lot of 
>>>>> work...
>>>>
>>>>
>>>>
>>>> have we a bug/task entry for this already?
>>>
>>>
>>> I just filed a bug:
>>>
>>> http://bugzilla.wyona.com/cgi-bin/bugzilla/show_bug.cgi?id=5458
>>
>>
>> thanks very much
>>
>> Michi
>>
>>>
>>> Josias
>>>
>>>>
>>>> Cheers
>>>>
>>>> Michi
>>>>
>>>>>
>>>>> Josias
>>>>>
>>>>>
>>>>>
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> Michi
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Yanel-development mailing list
>>>>> Yanel-development at wyona.com
>>>>> http://lists.wyona.org/cgi-bin/mailman/listinfo/yanel-development
>>>>
>>>>
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Yanel-development mailing list
>>> Yanel-development at wyona.com
>>> http://lists.wyona.org/cgi-bin/mailman/listinfo/yanel-development
>>
>>
>>
>



More information about the Yanel-development mailing list