[jdom-interest] Are Children under an Element returned in the proper order

Paul Jakubik pauljakubik at yahoo.com
Thu Mar 8 08:50:05 PST 2001


Not only is maintaining the order a good idea, its
required for properly handling documents that will be
validated against an XML Schema. XML Schemas are
allowed to specify the order that elements appear in.

If JDOM did not maintain this order, then reading a
document into JDOM and outputting it back to an XML
string could take a valid document and make it
invalid.

I don't think it is an accident that the current JDOM
preserves the order of elements, and hopefully this
thread will be a reminder to any potential
contributers that order can matter in an XML document,
and so should be preserved by JDOM.

--Paul

--- Aspi Siganporia <aspicool at yahoo.com> wrote:
> Hi,
> 
> I made this query and am quite interested in the
> final conclusion.
> 
> It is clear, as I had suspected, that order is
> maintained as a side
> effect but not as an intention.
> 
> Since the JDOM implementation seems to provide the
> order by list
> implementation with no additional cost, couldn't we
> just make it an
> intent.
> 
> I see a lot of value in being able to extract
> Element children in the
> correct order.
> 
> Thanks
> Aspi
> 
> 
> > -----Original Message-----
> > From: jdom-interest-admin at jdom.org
> > [mailto:jdom-interest-admin at jdom.org]On Behalf Of
> Richard Cook
> > Sent: Thursday, March 08, 2001 8:13 AM
> > To: jdom-interest at jdom.org
> > Subject: RE: [jdom-interest] Are Children under an
> Element
> > returned in
> > the proper order
> >
> >
> >
> > > >
> > > > When we invoke the method
> Element.getChildren() does
> > the return list
> > > > maintain the order in which the children
> existed in the XML.
> > >
> > > In practice it may happen but there is no code
> to enforce this.
> >
> > I hope that's not true - implementing it via a
> list is how
> > it's enforced?
> >
> > > _______________________________________________
> > > To control your jdom-interest membership:
> > >
>
http://lists.denveronline.net/mailman/options/jdom-interest/yourad
> > dr at yourhost.com
> >
> > _______________________________________________
> > To control your jdom-interest membership:
> >
>
http://lists.denveronline.net/mailman/options/jdom-interest/
> > youraddr at yourhost.com
> 
> _______________________________________________
> To control your jdom-interest membership:
>
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com


__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/



More information about the jdom-interest mailing list