Web Analytics Made Easy -
StatCounter XML advice and help for a forst timer - CodingForum


No announcement yet.

XML advice and help for a forst timer

  • Filter
  • Time
  • Show
Clear All
new posts

  • XML advice and help for a forst timer


    I am designing a site for a medium sized company who make cement render products. The product catalog is only going to be approximately 25 products long and I have decided to store this information in an XML file to negate the need for a database.

    I have never used XML before and I am wondering if it is possible to use ASP (Classic) to parse through the file and select a node that contains the information about the product. The product Id will be bassed via a querystring. An example of the XML file is below:

    <?xml version="1.0" encoding="iso-8859-1"?>
    <Product Id=1>
    <ProdName><h3>Supa Coat PM150 Whiteset</h3></ProdName>
    <ProdDesc>PM150 Whiteset is a high quality lime and gypsum based plaster.</ProdDesc>
    <ProdUse>PM150 is for internal use only.</ProdUse>
    <ProdApp>PM150 Whiteset can be applied from 4mm to 25mm in thickness in one coat. It can also be textured or sponged.</ProdApp>
    <ProdColour>PM150 is a white plaster but can be altered to any colour you desire.</ProdColour>
    <ProdNote>* All coloured products have a minimum turnaround of 3 days *

    I would like to be able to select all the data in the Product node and then use ASP to place the other information into a preset template.

    Is that even possible?

    Also this is the first XML file I have written, is it right? Is there a better way to set it out?

    All comments are appreciated!


  • #2
    I think this is more an ASP question than client-side XML...

    Looking at your source, I would think you could seriously shorten the markup. The attributes must have their value quoted (that is a requirement of XML 1.0 and 1.1). The long text strings can possibly be reduced to single words or even attributes, if they are standard text. If you are using elements to describe individual facts, you could just as easily convert it from



    <parentElement name='value'/>
    Last edited by Alex Vincent; Mar 1, 2004, 11:20 PM.
    "The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
    June 30, 2001
    author, ES-Membrane project (Github Pages site)
    author, Verbosio prototype XML Editor
    author, JavaScript Developer's Dictionary


    • #3
      The text contained in ProdName, ProdDesc, ProdUse etc is what I want to pull from the file and wrap in HTML tags and put straight on the page so I think it is necessary to have the long strings. Would it still be best to use attributes?

      Also there will be more text in there when the customer gives me the exact text they want, they have already told me the ProdDesc will be longer.



      • #4
        There are a number of methods today that pretty much eliminate the need for manually parsing the XML file. There is XSLT (extensible style sheet language transformation) see:

        or you can take a more basic approach and bind the XML to an html table(s). I was doing just this last night, but my example is at home....

        powerful stuff!



        • #5