I honestly don't know, but I doubt the difference is worth worrying about.
Element heavy XML is easier to read and maintain, in my opinon, so I
primarily go that route.  Make it work first, and then if it's unacceptably
slow, you can deal with it then.  Don't bother spending time on it now
unless you know you're going to have to make it faster (which probably means
a proper database anyway).
  -----Original Message-----
  From: Joe Eugene [mailto:[EMAIL PROTECTED]
  Sent: Monday, October 13, 2003 1:46 PM
  To: CF-Talk
  Subject: Re: Good way to search XML

  <user-list>
    <user username="barneyb" name="Barney Boisvert" password="myPass" />
    <user username="barneyb1" name="Barney Boisvert 1" password="myPass 1"
/>
  <user-list>

  Is the above (Attribute Centric XML) slower to search using XPATH than
Element Centric ?

  Joe Eugene

    ----- Original Message -----
    From: Barney Boisvert
    To: CF-Talk
    Sent: Monday, October 13, 2003 1:59 PM
    Subject: RE: Good way to search XML

    It depends on your XML file format.  If you want the ability to search
    rapidly based on username, then structure your XML like this:

    <user-list>
      <user username="barneyb">
        <name>Barney Boisvert</name>
        <password>myPass</password>
      </username>
    <user-list>

    Having the username as an attribute to the USER tag will allow you to
pull
    just that node out with your XPath _expression_.  You can obviusly add
multple
    attributes to the tag.  If you want to search that same snip by name,
you
    have to use XPath to get the entire user list in a CF array, and then
loop
    the array and search.  Not nearly as effecient.  This is similar in
concept
    to how indexes work in a database.  Like the database, there is a cost
to
    having lots of attributes, though it's readability in this case, rather
than
    insert/update/delete speed.

    barneyb
      -----Original Message-----
      From: Rich Z [mailto:[EMAIL PROTECTED]
      Sent: Monday, October 13, 2003 10:43 AM
      To: CF-Talk
      Subject: Good way to search XML

      What's the most efficient way to search through an XML to check -
let's
      say - a user name & password kept in an XML file of all users? I
haven't
      dug into this yet - but I'm going to try pulling the XML and then
Xpath?
      Any other approaches?

      -Rich


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to