2 Replies Latest reply on Jul 26, 2007 12:38 PM by Hal B. Helms

    reading file

    Nick201 Level 1
      I am reading xml file. I would like to build string and insert at end. how can do that. any example.
        • 1. Re: reading file
          Sankalan Level 1
          I think <cffile action="append" will do.

          • 2. Re: reading file
            Hal B. Helms Level 1
            Maybe this will get you started.

            Given this XML file:


            use this code:

            <cffile action="read" file="c:\ColdFusion8\wwwroot\test\MyXml.xml" variable="XMLFileText">
            <cfset myXMLDocument=XmlParse(XMLFileText)>

            <cfset ArrayAppend(myXMLDocument.composers.modern[1].XmlChildren, XmlElemNew(myXMLDocument, 'composer')) />
            <cfset myXMLDocument.composers.modern.XmlChildren[2].name = XmlElemNew(myXMLDocument, 'name') />
            <cfset myXmlDocument.composers.modern.XmlChildren[2].name.XmlText = "Stravinsky" />

            <cfdump var="#myXMLDocument#" />

            See if that gets you anywhere near what you're trying to do.