TechMonkey Posted February 2, 2007 Posted February 2, 2007 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: 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: A NAME 02/02/2007 INITIALS A ANOTHER NAME YET ANOTHER NAME A HOUSE MORE NAME EVEN MORE NAME STAFF CODE TEST TEST TEST TEST TEST TEST NO TEST 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
Lee_K_81 Posted February 2, 2007 Posted February 2, 2007 I would personally go for the first one. Second one just defines everything as "field" and sets a tab order and id.
webman Posted February 2, 2007 Posted February 2, 2007 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.
TechMonkey Posted February 2, 2007 Author Posted February 2, 2007 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!
webman Posted February 2, 2007 Posted February 2, 2007 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
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now