Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / July 2007



Tip: Looking for answers? Try searching our database.

reading file

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nick201 - 26 Jul 2007 19:06 GMT
I am reading xml file. I would like to build string and insert at end. how can do that. any example.
Sankalan - 26 Jul 2007 20:24 GMT
I think <cffile action="append" will do.

Thanks
Hal B. Helms - 26 Jul 2007 20:38 GMT
Maybe this will get you started.

Given this XML file:

<composers>
    <modern>
        <composer>
            <name>Schoenberg</name>
        </composer>
    </modern>
</composers>

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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.