+ Post New Thread
Results 1 to 5 of 5
Web Development Thread, Any XML gurus? in Coding and Web Development; Trying to update a incident reporting web app we have here to save some files as XML. Now I know ...
  1. #1

    TechMonkey's Avatar
    Join Date
    Dec 2005
    Location
    South East
    Posts
    3,321
    Thank Post
    226
    Thanked 428 Times in 310 Posts
    Rep Power
    171

    Any XML gurus?

    Trying to update a incident reporting web app we have here to save some files as XML. Now I know there is no correct answer generally with XML but wondered if anyone had pros or cons for two different structures. My original thought was to have each item as an element ending up with:
    Code:
    <?xml version="1.0" ?>
    <sis>
      <student></student>
      <date></date>
      <from></from>
      <tutor></tutor>
      <lm></lm>
      <house></house>
      <ha></ha>
      <ah></ah>
      <alt></alt>
      <prob></prob>
      <taken></taken>
      <needed></needed>
    </sis>
    I know that will do it and is nice and simple to be readable straight from the file. A script I have found automagically can read from a form and create an XML file but creates this structure:
    Code:
    <?xml version="1.0"?>
    <contact>
      <field id="student" taborder="1">
        <field_value>A NAME</field_value>
      </field>
      <field id="date" taborder="2">
        <field_value>02/02/2007</field_value>
      </field>
      <field id="from" taborder="3">
        <field_value>INITIALS</field_value>
      </field>
      <field id="tutor" taborder="4">
        <field_value>A ANOTHER NAME</field_value>
      </field>
      <field id="hoh" taborder="5">
        <field_value>YET ANOTHER NAME</field_value>
      </field>
      <field id="house" taborder="6">
        <field_value>A HOUSE</field_value>
      </field>
      <field id="learnAss" taborder="7">
        <field_value>MORE NAME</field_value>
      </field>
      <field id="assHead" taborder="8">
        <field_value>EVEN MORE NAME</field_value>
      </field>
      <field id="altLM" taborder="9">
        <field_value></field_value>
      </field>
      <field id="attention" taborder="10">
        <field_value>STAFF CODE</field_value>
      </field>
      <field id="problem" taborder="11">
        <field_value>TEST TEST TEST</field_value>
      </field>
      <field id="actioned" taborder="12">
        <field_value>TEST TEST TEST</field_value>
      </field>
      <field id="actionreq" taborder="13">
        <field_value>NO TEST</field_value>
      </field>
    </contact>
    Now on some level that just doesn't sit right with me but if it works and is all good I can live with that.

    Can anyone spot a major flaw or future issue with the second structure or a huge benefit for the first? Or am I just being picky, picky, picky?

    Ta

  2. #2

    Join Date
    Jan 2007
    Location
    Birmingham
    Posts
    807
    Thank Post
    29
    Thanked 36 Times in 24 Posts
    Rep Power
    27

    Re: Any XML gurus?

    I would personally go for the first one. Second one just defines everything as "field" and sets a tab order and id.

  3. #3

    webman's Avatar
    Join Date
    Nov 2005
    Location
    North East England
    Posts
    8,417
    Thank Post
    644
    Thanked 965 Times in 665 Posts
    Blog Entries
    2
    Rep Power
    328

    Re: Any XML gurus?

    The second version looks as if it will make it more difficult when using XPath to get the infromation you need, and making the file size larger at the same time. But if the scripts you'll be using can read from the generated XML correctly, it shouldn't be a problem as long as it's all valid XML.

  4. #4

    TechMonkey's Avatar
    Join Date
    Dec 2005
    Location
    South East
    Posts
    3,321
    Thank Post
    226
    Thanked 428 Times in 310 Posts
    Rep Power
    171

    Re: Any XML gurus?

    Ta. My spidey senses were correct. I'm sure I can hack the script to sort that out. It is a function script so probably made to service many forms, whereas mine will be to service one specific form so could be hard coded to just that.

    Thansk again, means that XML stuff I learnt a while back actually may have sunk in!

  5. #5

    webman's Avatar
    Join Date
    Nov 2005
    Location
    North East England
    Posts
    8,417
    Thank Post
    644
    Thanked 965 Times in 665 Posts
    Blog Entries
    2
    Rep Power
    328

    Re: Any XML gurus?

    Nice one

    If you wanted to, you could use an XSLT stylesheet to transform version 2 into version 1 but why make things extra-complex :P



SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 3
    Last Post: 22nd October 2007, 11:35 AM
  2. CSS gurus!
    By nickje in forum Web Development
    Replies: 2
    Last Post: 12th June 2007, 12:42 PM
  3. Replies: 37
    Last Post: 8th November 2006, 08:24 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •