<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content="MSHTML 6.00.2800.1458" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Given that getAttributes returns a 'live' list, is
should not be necessary to call setAttributes at all.</FONT></DIV>
<DIV><FONT face=Arial size=2>Indeed, calling setAttributes is causing your
attribute list to be cleared.</FONT></DIV>
<DIV><FONT face=Arial size=2>Please take a look at the JavaDoc for these methods
for a definitive explanation.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>To achieve what you want, I think you can just
remove the setAttributes call, and all should be ok.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Hope that helps.</FONT></DIV>
<DIV><FONT face=Arial size=2>Ed.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=mmgh73@hotmail.com href="mailto:mmgh73@hotmail.com">Mauricio
García</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=jdom-interest@jdom.org
href="mailto:jdom-interest@jdom.org">jdom-interest@jdom.org</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Tuesday, October 12, 2004 1:56
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [jdom-interest] setAttributes
method</DIV>
<DIV><BR></DIV>Hi ,<BR><BR>I've tried to use a List object to set the order of
the attributes of my <BR>element. For example I have the next
code:<BR><BR>List list = elem.getAttributes();<BR>Attribute attrib = new
<BR>Attribute("schemaLocation",getSchemaLocation(),getSchemaInstance());<BR>list.add(0,attrib);<BR>System.out.println(list);<BR>elem.setAttributes(list);<BR>System.out.println(elem);<BR><BR>But,
when get the output of my element I can see it has no attributes, but <BR>the
list had 2 attributes. Console shows me:<BR><BR>[Attribute:
xsi:schemaLocation="<A
href="http://www.mmm.cl/SiiDte">http://www.mmm.cl/SiiDte</A>
EnvioDTE_v10.xsd"], <BR>[Attribute: version="1.0"]<BR>[Element: <EnvioDTE
[Namespace: <A
href="http://www.mmm.cl/SiiDte]/">http://www.mmm.cl/SiiDte]/</A>>]<BR><BR>What
can I do? Does not the Element's method "setAttributes"
work?<BR><BR>Note: when I use:
<BR>elem.setAttribute("schemaLocation",getSchemaLocation(),getSchemaInstance());
<BR>it works! But I need this attribute be the
first.<BR><BR>_________________________________________________________________<BR>Express
yourself instantly with MSN Messenger! Download today it's FREE! <BR><A
href="http://messenger.msn.com/">http://messenger.msn.com/</A><BR><BR>_______________________________________________<BR>To
control your jdom-interest membership:<BR><A
href="http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com">http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com</A></BLOCKQUOTE></BODY></HTML>