[jdom-interest] setAttributes method
Mauricio García
mmgh73 at hotmail.com
Wed Oct 13 06:05:37 PDT 2004
Thank you very much! It works like you said.
>From: "Ed Maher" <ed.maher at euromainbt.co.uk>
>To: Mauricio García <mmgh73 at hotmail.com>,<jdom-interest at jdom.org>
>Subject: Re: [jdom-interest] setAttributes method
>Date: Tue, 12 Oct 2004 10:04:15 +0100
>
>Hi,
>
>Given that getAttributes returns a 'live' list, is should not be necessary
>to call setAttributes at all.
>Indeed, calling setAttributes is causing your attribute list to be cleared.
>Please take a look at the JavaDoc for these methods for a definitive
>explanation.
>
>To achieve what you want, I think you can just remove the setAttributes
>call, and all should be ok.
>
>Hope that helps.
>Ed.
>
> ----- Original Message -----
> From: Mauricio García
> To: jdom-interest at jdom.org
> Sent: Tuesday, October 12, 2004 1:56 AM
> Subject: [jdom-interest] setAttributes method
>
>
> Hi ,
>
> I've tried to use a List object to set the order of the attributes of my
> element. For example I have the next code:
>
> List list = elem.getAttributes();
> Attribute attrib = new
> Attribute("schemaLocation",getSchemaLocation(),getSchemaInstance());
> list.add(0,attrib);
> System.out.println(list);
> elem.setAttributes(list);
> System.out.println(elem);
>
> But, when get the output of my element I can see it has no attributes,
>but
> the list had 2 attributes. Console shows me:
>
> [Attribute: xsi:schemaLocation="http://www.mmm.cl/SiiDte
>EnvioDTE_v10.xsd"],
> [Attribute: version="1.0"]
> [Element: <EnvioDTE [Namespace: http://www.mmm.cl/SiiDte]/>]
>
> What can I do? Does not the Element's method "setAttributes" work?
>
> Note: when I use:
>
>elem.setAttribute("schemaLocation",getSchemaLocation(),getSchemaInstance());
> it works! But I need this attribute be the first.
>
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today it's FREE!
> http://messenger.msn.com/
>
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.com/
More information about the jdom-interest
mailing list