// if using LiveSite 3.0, you must get the user from the RequestContext// which is passed in the method signature.EndUserIfc user = context.getUser();// if using LiveSite 2.2.1 or prior, the user object is passed directly // to the method.FileDALIfc dal = user.getFileDAL();String path = "templatedata/Category/Type/data/file.xml";String fullPath = dal.getRoot() + dal.getSeparator() + path;String fileData = null;if( dal.exists(fullPath) ){ fileData = dal.read(fullPath);}// fileData contains file contents or is null if file doesn't exist.
public interface FileDALIfc extends XmlEmittable{ /***************************************************************************** * See if path exist * * @param path the path to the file or directory * @return true if file Exists ****************************************************************************/ boolean exists(String path); /***************************************************************************** * See if path is a file * * @param path the path to a file * @return true if file Exists ****************************************************************************/ boolean isFile(String path); /***************************************************************************** * See if path is directory * * @param path the path to a directory * @return true if file Exists ****************************************************************************/ boolean isDirectory(String path); /***************************************************************************** * Read a file * * @param path the path to the file * @return the data read ****************************************************************************/ String read(String path); /***************************************************************************** * write data to a file * * @param relativePath the path relative to the root * @param data the data *****************************************************************************/ void write(String relativePath, String data); /***************************************************************************** * get the list of child files * * @param path the the path to the file * @return the list of child files ****************************************************************************/ String[] getChildFiles(String path); /***************************************************************************** * get the list of child Directories * * @param path the the path to the file * @return the list of child Directories ****************************************************************************/ String[] getChildDirectories(String path); /***************************************************************************** * Get the root directory -- points to the web root. * * @return the web root directory. *****************************************************************************/ String getRoot(); /***************************************************************************** * get a file as a stream * * @param path the path to the file * @return the input stream ****************************************************************************/ InputStream getStream(String path); /***************************************************************************** * Get the seperator * * @return the seperator *****************************************************************************/ char getSeparator();}
where is the documentation for this?
Now how do I get this parameter, dcrName, and pass it to the tag of ContentXML?
If all goes well, your DCR XML will be appended as a child of /Properties/Data/Result in your component's XML data source.