Hello List,
I ve a FlowScript which creates a XML tree.
var doc = Packages.org.jdom.Document();
var root = Packages.org.jdom.Element("SWLREPORT");
var outputter =
Packages.org.jdom.output.XMLOutputter(Packages.org.jdom.output.Format.getPre
ttyFormat())
var xmlfile = Packages.java.lang.String(cocoon.session.getId() + ".xml");
var msgname = Packages.java.lang.String(xmlfile.substring(0,
xmlfile.indexOf(".")) + ".msg");
...
doc.setRootElement(root);
...
var status = Packages.org.jdom.Element("STATUS");
if (success == true){
status.setText("OK");
}
else{
status.setText("ERROR");
}
root.addContent(status);
...
outstreamPDF = new Packages.java.io.FileOutputStream( "c:/temp/" + xmlfile
);
outputter.output(doc, outstreamXML);
outstreamXML.close();
cocoon.sendPage(msgname);
..
In this example I create a XML file in the servers local harddrice
(c:/temp/) and afterwards send a request to another sitemap matching *.msg.
This pipeline just shows the xml file on c:/temp. The XMLs name is the
session ID.
<map:match pattern="*.msg">
<!-- {global:working-path} = c:/temp -->
<map:generate type="file" src="{global:working-path}/{1}.xml"/>
<map:serialize type="xml"/>
</map:match>
This method has some seriouse drawbacks.
First and most important for me is, that it look quite silly. I think it is
not supposed to be done this way. Would'nt it be much smarter to just drop
the XML into the result stream that is send to the client anyway than to
save it on disk?
But I *could* live with this if there was'nt
A:
The to the client returning XML file has to be stored on the server, and
also into the clients "temporary internet files" folder.
B:
Do I request the same document twice in a short period, the session ID
has'nt changed and the result of the second job is dumped into the first
jobs result XML (because the XML file name is "cocoon.session.getId() +
'.xml'"). As result I get a accumulated result XML.
C:
I cant delete the created XML file in the servers Harddrive because of some
unkown reasons.
All together I have the feeling that I m doing something fundamentally
wrong.
I ve the feeling I should write the result XML to the stream that is send to
the client. But I dont know how. If I search in JavaScript FAQs arround the
net I often finde something like:
document.write("<B>foo</B>");
what would be just like what I basicly need. But how?
some help?
Thanks & Regards,
Jan
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]