File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Order of tags in XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Order of tags in XML " Watch "Order of tags in XML " New topic

Order of tags in XML

Yuan Ye
Ranch Hand

Joined: Mar 05, 2003
Posts: 172
Hi,all. I got a question. Are tags order sensitive in an XML or TLD file? I know <servlet-name> must appear before <servlet-class> in XML. Is it true for all the tags defined by DTD? I noticed when using some tags in a JSP, for example <%@ taglib uri="aa" prefix="bb">; the order of "uri" and "prefix" is exchangable. Could anyone please help me to understand this issure? Thanks
Ron Newman
Ranch Hand

Joined: Jun 06, 2002
Posts: 1056
Whether elements have to be in a particular order depends entirely on the DTD that is associated with your XML file.
As for this:

<%@ taglib uri="aa" prefix="bb">; the order of "uri" and "prefix" is exchangable

The "uri" and "prefix" are attributes, not elements. Attributes can always be in any order.
[ July 25, 2003: Message edited by: Ron Newman ]

Ron Newman - SCJP 1.2 (100%, 7 August 2002)
I agree. Here's the link:
subject: Order of tags in XML
It's not a secret anymore!