Attribute Centric XML is ALOT Less Lines and Less Nesting.  

If you try to parse Element Centric XML in DOM, you will have to Jump through More "EMPTY NODES"
VS NO Empty Text Node in Attribute Centric XML

EMPTY NODES = "\n" (which creates more looping)

<user username="barneyb"> (Calling NodeList.item(0).getChildNodes() = 5-6 Items depending on "\n")

CFMX takes care of the Internal XML Parsing to Arrays/Structs... so you generally dont see whats involved.

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

Here there is NO Nesting and NO Empty Nodes/Text Nodes (NodeNamedMap nnm = Node.getAttributes() )

Havent timed any performance though on Attribute Vs Element (Centric XML)

Joe Eugene

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

  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