Skip to main content
Participant
July 23, 2007
Answered

File creation problems

  • July 23, 2007
  • 2 replies
  • 267 views
Hi,
I'm pretty new at writing extensions so I'm quite certain my problem is a mistake on my part.
I've written a piece of code that takes a data file and formats it into a table and writes the table to a new file (the client doesn't want to use templates, that's why it's done this way).
The data file is formatted with the first line as the page title, the second line has the column names and the rest is the data. The data if formatted with ";"
The function doStuff calls the fixTag function.

Whenever I run this, the contents of the data file (opened with fh = dreamweaver.openDocument(theFile); in the fixTag function) receives the data I try to write to the new file (created with var newTableDoc = dreamweaver.createXHTMLDocument(); in the doStuff function).

What am I doing wrong here. I've tried using dreamweaver.releaseDocument to release the data file, but it doesn't help. I've tried creating the new file with dreamweaver.getNewDocumentDOM but can't figure out how to then save that without running into the same overwrite problem.
Any help, tips, and the like is greatly appreciated.

Problem code is attached.
This topic has been closed for replies.
Correct answer four-ks
Found the solution. Was my poor coding.
I just need to have

dreamweaver.createXHTMLDocument();
newTableDoc=dreamweaver.getActiveWindow();
newTableDoc.getElementsByTagName("body")[0].innerHTML = rString;

hope this helps someone else.

Cheers.

2 replies

four-ksAuthorCorrect answer
Participant
July 24, 2007
Found the solution. Was my poor coding.
I just need to have

dreamweaver.createXHTMLDocument();
newTableDoc=dreamweaver.getActiveWindow();
newTableDoc.getElementsByTagName("body")[0].innerHTML = rString;

hope this helps someone else.

Cheers.
four-ksAuthor
Participant
July 23, 2007
Almost forgot some important details.
Dreamweaver MX 2004 running on win 2k system.