View Full Version : XML structure

06-19-2002, 11:05 AM
deciding on the structure of an XML document is prooving difficult for me.... I want an easy to parse representation of the following array for example

(sorry its long)

I have come up with several different representations of the below array - all valid in one respect or another, are there any hard and fast rules that would help me in structuring an XML document keeping the logic of the array obvious and usable ? - or is it a case of whatever works for me ?? (in which case I dont see the point) -

dev_start=>array('dev_start','','start','forg.xpm','HORZ','start phpdev','dev5_start',''),
dev_stop=>array('dev_stop','','start','forg.xpm','HORZ','shutdown phpdev','dev5_stop',''),
dev_configure=>array('dev_configure','','start','forg.xpm','HORZ','phpdev installation options','run_exe','..\install.bat')
ap_start=>array('ap_start','','start','forg.xpm','HORZ','start the apache server','apache_start',''),
ap_stop=>array('ap_stop','','start','forg.xpm','HORZ','stop the apache server','apache_stop',''),
ap_restart=>array('ap_restart','','start','forg.xpm','HORZ','restart the apache server','apache_restart',''),
ap_swap=>array('ap_swap','','start','forg.xpm','HORZ','swap default apache installation','apache_swap',''),
ap_install=>array('ap_install','','start','forg.xpm','HORZ','install apache as a windows service','apache_install',''),
ap_uninstall=>array('ap_uninstall','','start','forg.xpm','HORZ','uninstall the apache service','apache_uninstall','callback,vars,ok'),
ap_test=>array('ap_test','','start','forg.xpm','HORZ','test the apache configuration','apache_test','callback,vars,ok')
my_start=>array('my_start','','start','forg.xpm','HORZ','start mysql','mysql_start','callback,vars,ok'),
my_stop=>array('my_stop','','start','forg.xpm','HORZ','stop mysql','mysql_stop','callback,vars,ok'),
my_status=>array('my_status','','start','forg.xpm','HORZ','check MySQL ','my_status','1'),
my_install=>array('my_install','','start','forg.xpm','HORZ','install mysql as a \'service\'','my_install','callback,vars,ok')
analog_but=>array('analog_but','','start','forg.xpm','HORZ','run the php.ini configuration tool','run_exe',ANALOG_PATH),
gtkdev_but=>array('gtkdev_but','','start','forg.xpm','HORZ','gtkdev app browser','my_echo','callback,vars,ok')
ping_but=>array('ping_but','','start','forg.xpm','HORZ','ping a host','ping',''),
trace_but=>array('trace_but','','start','forg.xpm','HORZ','run a trace against an IP or hostname','tracert',''),
ip_but=>array('ip_but','','start','forg.xpm','HORZ','get your current IP (NT/XP only)','ip_config',''),
who_but=>array('who_but','','start','forg.xpm','HORZ','run a whois query','run_this_whois','')

06-19-2002, 11:29 AM

i'd say each array is a container which holds all the elements within it; when an element is yet another array, it becomes a container which holds... etc, something like (not the whole lot):


Does that make sense?

06-19-2002, 02:19 PM
Hi ronaldb66 - yep that makes sense to me, and one of my attempts is in a similar format, I was just wondering if there is a 'right' or more importantly a 'wrong' way to structure the data ?

i.e. are there any 'no-nos' apart from the basic validity of the XML, in fact are there any rules at all past basic validity?, all the XML stuff I have read lends me to believe not apart from 'known' formats such as RSS/RDF documents and even then these are not always strictly adhered to.

06-19-2002, 03:12 PM
Errmmm... i don't really know. On the element-attribute issue i read a statement like "... if it feels like data it should be an element.", and likewise, attributes should be used for meta-data.

The whole point is identifying atomic data elements and describing the structure in which they relate to one another; i haven't yet found a receipe for that either. Really more a data modelling issue rather then an XML one, i guess.

06-19-2002, 03:16 PM
I perfer to use attributes opposed to elements. I have made some very large xml files, useing elements the file came out 16MG and useing attributes 2.5MG.

<name a="dev_frame" />
<title a="phpdev5" />
<dev_start a="dev_start" b="" c="start" d="forg.xpm" />
<dev_stop a="dev_stop" b="" c="start" d="forg.xpm" />
<dev_configure a="dev_configure" b="" c="start" d="forg.xpm" />

Alex Vincent
06-20-2002, 01:50 AM
May I make a suggestion?

Perhaps in the midst of building your XML files you should look at XLink. XLink is a W3C standard for creating links between documents (and that doesn't necessarily mean hyperlinks). You could outsource some of the more detailed info to other files and keep one file as a central summary of everything else.

That would significantly cut down on file sizes to download.