I would like to create and structure an XML file with varialbes provided from $_POST acording to the rules set out by a DTD file.

Previously I have been dynamically building XML files by just sighting a DTD, but the DTD keeps changing and I gotta go back and make modifications to my code.

Can anyone help?

    i would recommend to use a basic xml file that (almost) never changes. then use XSLT to transform your basic xml into the xml that fits the DTD.
    This way you won't have to change your code, only one single XSL file.

      Im not sure what you mean, but as I understand it XSL formats the way an xml file is viewed.

      I need to create an xml file on the fly, so that my script may send the it to an ftp server.

      The DTD file is the set of rules that I must follow in order for the xml file to be valid.

        right, XSLT takes the data from an XML an outputs them in another format. but you decide what the output of a XSL transformation will be. it may be plaintext, HTML, a PDF Document, whatever... but it can also output an XML-document matching you DTD. so it would transform your basic (not-DTD-conform) XML file to a valid one.

        You can do XSL-transformation on the fly too.

          Ok, thanks for your help but i'm still lost,

          http://reaxml.realestate.com.au/propertyList.dtd

          Thats the DTD, i figure the only way to do this is to make or find a script that looks at the dtd and makes a sample or template xml file.

          I don't know enough about xsl, but i'm reading up on it now. I'm puzzled on how an xslt file can do what i need.

          As far as I am aware xsl reads an xml file and formats it. I need to read the DTD and formulate the structure of an XML file.

            don't think of XSL-"formatting" as CSS formats HTML, it's far more than just an optical gloss.

            a DTD is an XML file too, so you can use XSL to process and format a XML file out of it. but i really don't wanna stick to this XSLT-stuff... it's just the way i would try 🙂

            I've just found that article on phpbuilder. maybe you wanna take a look at it:
            http://www.phpbuilder.com/columns/justin20001025.php3

              Write a Reply...