You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Torsten Curdt <tc...@dff.st> on 2002/04/25 13:10:37 UTC
AttributesImpl
guys, I need a hand... I'm kinda lost. I am trying to add an attribute in
a transformer:
startElement(..)
....
AttributesImpl newAttributes = null;
try {
getLogger().error("creating an attributes copy");
newAttributes = new AttributesImpl(attributes);
getLogger().error("adding an attribute");
newAttributes.addAttribute("","id","id","CDATA", id);
getLogger().error("added an attribute");
}
catch(Throwable e) {
e.printStackTrace(System.out);
}
getLogger().error("passing start");
super.startElement(uri, name, raw, newAttributes);
....
But I only see the "added an attribute" once. After the next "adding an
attriubute" I see nothing more at all. No stacktrace, log message -
nothing. The browser just waits forever and I don't see anything in the
logs...
Seems like there is no way back from the "addAttribute" sometimes :(
Anyone an idea? I always copied the attributes by hand up to now but AFAIK
the above is the proposed way of doing it...
Any ideas?
--
Torsten
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
Re: AttributesImpl
Posted by Torsten Curdt <tc...@dff.st>.
> Torsten,
>
> Check, that you are using the correct version of AttributesImpl class.
> Sometimes this class can be found in various places and can be of different
> and old versions. AttributesImpl was buggy a while ago, but it was fixed and
> I'm using it in I18nTransformer (see translateAttributes() method).
>
> Sometimes the problem came from the batik.jar that was shipped with the old
> version of org.apache.sax.helpers.*.
I checked the latest xerces code and in fact it's a bug :-O
...one can work around it but should not have to. I will post a patch to
xerces-j-dev
Thanks, Konstantin
--
Torsten
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
Re: AttributesImpl
Posted by Konstantin Piroumian <kp...@apache.org>.
Torsten,
Check, that you are using the correct version of AttributesImpl class.
Sometimes this class can be found in various places and can be of different
and old versions. AttributesImpl was buggy a while ago, but it was fixed and
I'm using it in I18nTransformer (see translateAttributes() method).
Sometimes the problem came from the batik.jar that was shipped with the old
version of org.apache.sax.helpers.*.
--
Konstantin
> guys, I need a hand... I'm kinda lost. I am trying to add an attribute in
> a transformer:
>
> startElement(..)
>
> ....
> AttributesImpl newAttributes = null;
> try {
> getLogger().error("creating an attributes copy");
> newAttributes = new AttributesImpl(attributes);
> getLogger().error("adding an attribute");
> newAttributes.addAttribute("","id","id","CDATA", id);
> getLogger().error("added an attribute");
> }
> catch(Throwable e) {
> e.printStackTrace(System.out);
> }
> getLogger().error("passing start");
> super.startElement(uri, name, raw, newAttributes);
> ....
>
>
> But I only see the "added an attribute" once. After the next "adding an
> attriubute" I see nothing more at all. No stacktrace, log message -
> nothing. The browser just waits forever and I don't see anything in the
> logs...
>
> Seems like there is no way back from the "addAttribute" sometimes :(
>
>
> Anyone an idea? I always copied the attributes by hand up to now but AFAIK
> the above is the proposed way of doing it...
>
> Any ideas?
> --
> Torsten
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
Re: AttributesImpl
Posted by Ivelin Ivanov <iv...@apache.org>.
I think Vadim fixed a problem in the XMLFormTransformer, stating that
AttributesImpl has a deadlock problem when the constructor argument is null
or empty.
The fix was:
AttributesImpl atts;
if (attributes == null || attributes.getLength() == 0) {
atts = new AttributesImpl();
} else {
atts = new AttributesImpl(attributes);
}
atts.addAttribute( null, NS_PREFIX, XMLNS_PREFIX + ":" + NS_PREFIX,
"CDATA", NS);
attributes = atts;
}
----- Original Message -----
From: "Torsten Curdt" <tc...@dff.st>
To: <co...@xml.apache.org>
Sent: Thursday, April 25, 2002 6:10 AM
Subject: AttributesImpl
> guys, I need a hand... I'm kinda lost. I am trying to add an attribute in
> a transformer:
>
> startElement(..)
>
> ....
> AttributesImpl newAttributes = null;
> try {
> getLogger().error("creating an attributes copy");
> newAttributes = new AttributesImpl(attributes);
> getLogger().error("adding an attribute");
> newAttributes.addAttribute("","id","id","CDATA", id);
> getLogger().error("added an attribute");
> }
> catch(Throwable e) {
> e.printStackTrace(System.out);
> }
> getLogger().error("passing start");
> super.startElement(uri, name, raw, newAttributes);
> ....
>
>
> But I only see the "added an attribute" once. After the next "adding an
> attriubute" I see nothing more at all. No stacktrace, log message -
> nothing. The browser just waits forever and I don't see anything in the
> logs...
>
> Seems like there is no way back from the "addAttribute" sometimes :(
>
>
> Anyone an idea? I always copied the attributes by hand up to now but AFAIK
> the above is the proposed way of doing it...
>
> Any ideas?
> --
> Torsten
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org