|
#1
|
|||
|
|||
|
File.Create
There's a folder.create function but I can't find any file.create function (to create a new file). It would be good to have that. Thanks.
|
|
#2
|
||||
|
||||
|
Hi,
what kind of file do you want o create?
Ulrich |
|
#3
|
|||
|
|||
|
Thanks. I wanted to create both a new text file and a XML file. The Textfile.writefromstring would work for me for the text file. Sorry I was looking under "file" for the create option.
For creating a new XML file, however, XML.Save() saves whatever I have already loaded (using XML.Load) into the file I specify, unless I save it right at the beginning before I have loaded anything. If I create a blank XML file using textfile.writefromstring, I get an error loading this new blank xml file using xml.load. I see that this is a suggestions forum, so maybe I should move it to the discussion forum... Thanks. |
|
#4
|
||||
|
||||
|
Quote:
Code:
-- create new XML skeleton
XML.SetXML("<?xml version=\"1.0\"?>\n<myxml>\n<creator>TrueUpdate 3.0</creator>\n</myxml>\n");
-- create first node
XML.InsertXML("myxml/creator", "<data>\n<name>John Doe</name>\n</data>\n", XML.INSERT_AFTER);
-- insert more data
XML.InsertXML("myxml/data/name", "<address>123 Somewere Road</address>\n", XML.INSERT_AFTER);
-- insert more data
XML.InsertXML("myxml/data/name", "<city>Demotown</city>\n", XML.INSERT_AFTER);
-- create second node
XML.InsertXML("myxml/data", "<data>\n<name>Jane Smith</name>\n</data>\n", XML.INSERT_AFTER);
-- insert more data
XML.InsertXML("myxml/data:2/name", "<address>456 Windy Ave</address>\n", XML.INSERT_AFTER);
-- insert more data
XML.InsertXML("myxml/data:2/name", "<city>Smallville</city>\n", XML.INSERT_AFTER);
-- create third node
XML.InsertXML("myxml/data:2", "<data>\n<name>Joe Sixpack</name>\n</data>\n", XML.INSERT_AFTER);
-- insert more data
XML.InsertXML("myxml/data:3/name", "<address>789 NW 8th Ave</address>\n", XML.INSERT_AFTER);
-- insert more data
XML.InsertXML("myxml/data:3/name", "<city>Ontario</city>\n", XML.INSERT_AFTER);
-- save XML file somewhere
XML.Save("D:\\temp\\test.xml");
|
|
#5
|
|||
|
|||
|
Thanks a lot Ulrich. It works. This would solve my problem!
|
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
All times are GMT -6. The time now is 08:38 AM.









Linear Mode
