cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ivelin" <ive...@apache.org>
Subject Re: [XMLForm] Declarative xmlns attribute
Date Wed, 23 Apr 2003 03:41:40 GMT

Ok, here is what I tried, but not quite sure if it is correct.

AttributesImpl atts;
if (attributes == null || attributes.getLength() == 0) {
atts = new AttributesImpl();
} else {
atts = new AttributesImpl(attributes);
}
startPrefixMapping(NS_PREFIX, NS);
atts.addAttribute( "", NS_PREFIX, XMLNS_PREFIX + ":" + NS_PREFIX, "CDATA",
NS);
attributes = atts;

The gist is that startPrefixMapping is immediately followed by an explicit
attribute.
The reason I did this is because without passing an explicit attribute,
org.apache.xalan.serialize.SerializerToXML does not output it.
Its startPrefixMappingMethod is:

public void startPrefixMapping(String prefix, String uri)
throws org.xml.sax.SAXException{}

And of course there is a matching endPrefixMapping after endElement.

Is this how it is supposed to work?


-=Ivelin=-

----- Original Message -----
From: "Vadim Gritsenko" <vadim.gritsenko@verizon.net>
To: <cocoon-dev@xml.apache.org>
Sent: Tuesday, April 22, 2003 8:34 AM
Subject: Re: [XMLForm] Declarative xmlns attribute


> ivelin wrote:
>
> >Good question.
> >startPrefixMap is somewhat confusing.
> >http://lists.xml.org/archives/xml-dev/200108/msg00718.html
> >
>
> Hmm... It's pretty clear to me somehow... This means to me that
> namespace declarations can be moved up/down the XML tree and not
> necesseraly have to stick to the tags they are declared on. Main rule
> is: declare namespace before using it. You can declare it well before or
> right before - this does not matter.
>
>
> >What is the Xalan error text?
> >How would you suggest to patch the code?
> >
>
> We have to use start/endPrefixMappings there, like in all other Cocoon
> components.
>
> Vadim
>
>
> >From: "Stephan Michels" <stephan@apache.org>
> >
> >
> >
> >>Hi,
> >>
> >>I have some problems with the following line of the XMLFormTransformer
> >>
> >> atts.addAttribute( null, NS_PREFIX, XMLNS_PREFIX + ":" + NS_PREFIX,
> >>
> >>
> >"CDATA", NS);
> >
> >
> >>Xalan throw a violation exception, because you shouldn't set xmlns
> >>attribute manually.
> >>
> >>Can we remove this line?
> >>
> >>BTW, I don't see a startPrefixMapping within the transformer.
> >>
> >>Stephan.
> >>
> >>
>


Mime
View raw message