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 13:30:52 GMT

It is almost embarrassing.
Of course, the solution is very simple and it alleviates Xalan's quirks.
Each of the auto generated elements is within an element already defined in
the source document. So all I had to do is listen to the startPrefixMapping
callback and remember the prefix.

Thanks Stephan !



-=Ivelin=-
----- Original Message -----
From: "Stephan Michels" <stephan@apache.org>
To: <cocoon-dev@xml.apache.org>
Sent: Wednesday, April 23, 2003 1:35 AM
Subject: Re: [XMLForm] Declarative xmlns attribute


>
> On Tue, 22 Apr 2003, ivelin wrote:
>
> >
> > 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.
>
> I think this was a bug of Serializer in the past.
>
> > 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?
> >
>
> Yes, at moment, must only remove the code from above. You should
> already have a prefix mapping, if you transform your xform example.
>
> A problem occur, if you use a different prefix than 'xf'. So
> to be sure, you must make a startPrefixMapping in front of
> the startTranformingElement.
>
> Stephan.


Mime
View raw message