SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    Ribbit... Eric.Coleman's Avatar
    Join Date
    Jun 2001
    Location
    In your basement
    Posts
    1,268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    XML Format, and parsing it

    Im trying to get an idea how to store a Module/Plugin information in XML format, this is what I have come up with, it really needs work as I don't really use XML all that much:

    Code:
    <?xml version="1.0" encoding="iso-8859-1"?>
    <configuration plugin="Test Plugin">
    
    	<!-- GENERAL INFORMATION -->
    	
    	<plugin>
    		<version dev="true">1.0.2</version>
    		<description>Test Plugin</description>
    	</plugin>
    	
    	<!-- VERSION INFORMATION -->
    	
    	<version>
    		<!-- KEY:
    			* - ALl Version
    			Numeric Values, mean it needs atleast that, i.e. Plugin Needs PHP > <php version="" />
    		-->
    		<sitemod version="*" />
    		<php version="4.2.1" />
    
    		<!-- TYPE SHOULD BE THE DRIVER NAME -->
    		<db type="mysql" version="*" />
    		<db type="pgsql" version="*" />
    	</version>
    	
    	<!-- AUTHOR INFORMATION -->
    
    	<author>
    		<name>Eric Coleman, Mike Jordan</name>
    		<group>ZaireWeb Solutions</group>
    		<home>http://somesite.com</home>
    	</author>
    	
    	<!-- INSTALLATION INFORMATION -->
    	
    	<install define="true" file="testInstall.sm.php" />
    	
    	<!-- IF YOU DON"T WANT TO CHANGE THE INSTALL FILE, USE:
    	<install define="false" />
    	-->
    		
    </configuration>
    Now, I don't really know how I would parse this.. Im not sure how to get values that are like <install define="true" file="blah" />

    Can someone tell me if my formatting is good, and a way to parse all this information out into an array?

    Thanks,
    Eric
    Eric Coleman
    We're consentratin' on fallin' apart
    We were contenders, now throwin' the fight
    I just wanna believe, I just wanna believe in us

  2. #2
    SitePoint Guru okrogius's Avatar
    Join Date
    Mar 2002
    Location
    US
    Posts
    622
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Take a look in php section of hotscripts.com if you didn't do so already.

    Otherwise, here's another handy xml renderer:
    http://www.php-tools.de/site.php?fil...erOverview.xml

  3. #3
    As the name suggests... trickie's Avatar
    Join Date
    Jul 2002
    Location
    Melbourne, Australia
    Posts
    678
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The manual has an overview of PHP's wrapper around the Expat XML library.

    It is pretty simple to whip up a SAX based parser, but there are some good XML scripts over at phpclasses if you want something more sophisticated

  4. #4
    Ribbit... Eric.Coleman's Avatar
    Join Date
    Jun 2001
    Location
    In your basement
    Posts
    1,268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Should I repost this in the XML forum to get an idea of how properly formatted it is, or for more suggestions?
    Eric Coleman
    We're consentratin' on fallin' apart
    We were contenders, now throwin' the fight
    I just wanna believe, I just wanna believe in us

  5. #5
    As the name suggests... trickie's Avatar
    Join Date
    Jul 2002
    Location
    Melbourne, Australia
    Posts
    678
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    format looks good to me!

    Very readable.

    As long as it validates it's fine!
    Last edited by trickie; Oct 28, 2002 at 08:02.


Bookmarks

Posting Permissions

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