Save as Word Document | Find | English | Portugues(Brasil)

Reasons for the XMLNuke
The FilenameProcessor Class

How to access files through XMLNuke

Table of contents
1. Introductory Concepts
2. The Context class
3. The FilenameProcessor Class
4. The LanguageCollection Class
5. AnyDataSet and Data Access
6. The "Util" NameSpace
7. Structure of Directories

On this page
The FilenameProcessor class
Example of use


The FilenameProcessor class

Because XMLNuke manipulates XML documents, it has to open text files frequently. To open a file, the complete path must be provided, as well as the name and extension. However, because XMLNuke is for multiple sites, the path of the file will change depending on the site.

The FilenameProcessor class then offers ALL of the mechanisms required to locate the file, such as, its complete path and its extension, for example. The class is also able to determine if the file is located in the public or private folder of the mechanism, providing the programmer COMPLETE independence from the operating system.

The FilenameProcessor class is abstract. However, there is a set of classes that inherit its functionalities and implement specific details about the extension and location of the file system.

This technique is very interesting, since changes to the directory structures do not result in changes to the application. XMLNuke underwent extensive structure modifications when switching from version 1.0 to 2.0; however, the classes already developed were not touched.

Example of use

The FilenameProcessor class only recognizes the SingleName of a file. A SingleName is the name which we should use to reference this file. It should have neither a path nor an extension, since the FilenameProcessor is in charge of providing these elements.

To open an XML file whose SingleName is HOME, for example, we should use the following sequence of commands:

CSharp
// using com.xmlnuke.processor;

XMLFilenameProcessor arq = new XMLFilenameProcessor("home", this._context);

this._context.Debug(arq.FullQualifiedNameAndPath());

PHP
$arq = new XMLFilenameProcessor("home", $this->_context);

FileUtil->Debug(arq.FullQualifiedNameAndPath());

Previous
The Context class
Next
The LanguageCollection Class