Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004
    Location
    Atlanta, GA
    Posts
    541

    XML data files... anyone know how to...

    does anyone know XML and how to create flat xml data files. where all the search data is in a .xml file on the system. I want to create a product database of about 40-60 items that will be called up via a drop-down box.

    i wanted to do something like this in a products.xml
    <prodname>Ipods</prodname>
    <desc>20gig ipod</desc>
    <url>http://www.url.com</url>

    <prodname>PSP</prodname>
    <desc>Sony PSP</desc>
    <url>http://www.urlpsp.com</url>

    then i want to use a FORM with a drop down box [ prodnames ] and when the user selects from the drop down box it the url for the product will load on the main page.

  2. #2
    Try do it using PEAR library from php.net.... That will help you with all that XML stuff.

  3. #3
    Join Date
    Jul 2003
    Location
    Kuwait
    Posts
    5,099
    You are asking two different things here. One, how to create XML files and then how to parse XML files.

    XML files are just plain text files with a very specific syntax (for example, properly nested tags, the xml declaration, quoted attributes, etc.) You can write XML files in any plain text program (like notepad) and use any programming language that can write files to create them.

    Having said that, there are a some libraries out there that will help you with creating well formed XML files.

    Now is the matter of reading them. To read XML files you need to feed them to a parser. Again, depending on your platform you might have access to a few parsers.

    Instead of repeating myself here, I have written up a basic tutorial that shows you some XML basics and how to parse XML files using PHP4. It is available at my personal website (I have also submitted it to devpapers.com, but I forgot the URL there). Have a look there for a general idea on how this process goes. Hopefully it will answer some of your basic questions You are welcome to reply back here with questions, but if its something specifc about the article, I would appreciate a comment on the website itself, so as to not spam this board with my website.
    In order to understand recursion, one must first understand recursion.
    If you feel like it, you can read my blog
    Signal > Noise

Posting Permissions

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