cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

How to save in-memory documents to hard drive

ebenton
1-Newbie

How to save in-memory documents to hard drive

This is a question from a co-worker. He is trying to figure out how to save to the hard drive a well-formed XML document that he wants to create in memory. He's trying to create the document by using a doc_open command, but this doesn't work because the file doesn't exist yet; using the command without specifying a filename doesn't cause an error, but it's not known to him where the document is saved by the doc_save command.

Seems simple enough: he just wants to create a document in memory, insert data into it, save it, and open it later for reading. This should all be invisible to the user.

Should he be using "file_*" commands instead of "doc_*" commands?

Does any of this make any sense to anyone? Any ideas?

2 REPLIES 2

Hi Ed-



He should probably use either save_as or write commands, since they let
you specify the filename explicitly. I'm not sure what would happen if
you invoke doc_save() on a new file that doesn't yet have a filename, I
suspect it would either fail (which you might be able to test by
checking $main::ERROR) or it would save it in some inconvenient spot
like a temp directory.



With save_as or write, you can tell it exactly where you want the file
saved so you can find it later.



--Clay


BrianJ
3-Visitor
(To:ebenton)

Ed,

Looking at the documentation, calling the doc_open function without a
path will open an empty document, so you should be OK there. It returns
the document identifier that can be used in other acl functions. If you
need to know where the document is saved doc_path will do the trick, but
not when doc_open is called without a path. But you can use the
doc_set_path function to specify where you want the doc saved to. Then
calling doc_save will write the document to the path you specified in
doc_set_path.




Brian Jensen
bjensen@bluelid.com



Announcements

Top Tags