Sorry for the confusion, I should have phrased my question better. What I wanted to know was how to read in an XML file _as an XML Document_ object. I intend to use that object to determine the flow of control.
Sreedhar -----Original Message----- From: Ray Martin [mailto:[EMAIL PROTECTED]] Sent: Wed 12/18/2002 2:42 PM To: [EMAIL PROTECTED] Cc: Subject: RE: How do I read files inside an Action? Sir, Just like any other file called from java. In the action class you would need: import java.io.File; // cocoon has some defaults - this could be one of them //nothing special here, just an example. however, this directory is where cocoon places uploaded files by default. make yours wherever your xml file is located. String currentPath = "C:/Program Files/Apache Group/Tomcat 4.1/work/Standalone/localhost/cocoon/cocoon-files/upload-dir/"; // next three lines checks the directory for files and sets pointer to the first file in the directory (should put some checks around this)(could iterate through the list) File fileDir = new File(currentPath); File[] listOfFiles = fileDir.listFiles(); String filename = listOfFiles[0].toString(); File uploadDir = new File(currentPath); File theXMLfile = new File(filename); System.out.println("The director is: " + theResume.getParent()); System.out.println("The file name: " + theResume.getName()); long fileLen = theXMLfile.length(); Long testThis = new Long(fileLen); int fileLength = testThis.intValue(); FileInputStream fis = new FileInputStream(theResume); byte[] byteArray = new byte[fileLength]; int cnt = fis.read(byteArray, 0, fileLength); fis.close(); byteArray now contains the contents of theXMLfile. this only works for ASCII files. i do not have an example at my fingertips for Unicode. these are snippets from an action that i have performing. if you need anything else, holler. Ray > -----Original Message----- > From: Chintalapaty, Sreedhar [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, December 18, 2002 10:00 AM > To: [EMAIL PROTECTED] > Subject: How do I read files inside an Action? > > > Hi, > > Can some one point me to an example of how we can access an xml > file on the file system from a custom Action? > > TIA, > > Sreedhar > > --------------------------------------------------------------------- > Please check that your question has not already been answered in the > FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html> > > To unsubscribe, e-mail: <[EMAIL PROTECTED]> > For additional commands, e-mail: <[EMAIL PROTECTED]> > > --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]> --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>