Class: XPathFile
Last update: 22.06.2026Package: com.phoenix_int.aserver.util.scriptwrapper.api
Class Hierarchy
↳ java.lang.Object
↳ com.phoenix_int.aserver.util.scriptwrapper.api.AbstractFile
↳ com.phoenix_int.aserver.util.scriptwrapper.api.XPathFile
Implemented Interfaces
InputFile,OutputFile,OutputFile2,ParseableFile,java.io.Closeable,java.lang.AutoCloseable
Declaration
public class XPathFile
extends AbstractFile
implements OutputFile, OutputFile2, InputFile
Represents an XML file (not a file variable) used in a script wrapper, with access to the XML node values via XPath statements
Nested Class Summary
Nested classes/interfaces inherited from interface com.phoenix_int.aserver.util.scriptwrapper.api.ParseableFile
ParseableFile.Mode
Field Summary
Fields inherited from class com.phoenix_int.aserver.util.scriptwrapper.api.AbstractFile
encoding, fileName, mode, parser, templateFileName, wrapper
Constructor Summary
| Constructor and Description |
|---|
XPathFile(PHXScriptWrapperObject wrapper, ParseableFile.Mode mode) Constructs a new XPathFile |
Method Summary
| Modifier and Type | Method and Description |
|---|---|
void |
addVariable(java.lang.String name, java.lang.String type, boolean isInput, java.lang.String xpath) Add a variable to the wrapper. |
void |
generate() Generate the input file |
com.phoenix_int.aserver.util.XPathParser |
getParser() Get the XPath parser |
protected com.phoenix_int.aserver.util.XPathParser |
newParser(java.io.File file) Allow a sub-class to form a parser using custom options/features, such as handling DTD and entities |
protected Parser |
newParser(java.io.File rFile, Parser.Mode pmode) Generate a new parser for the given file and mode |
void |
parse() Parse the output file |
void |
setFileToGenerate(java.lang.String fileName) Set the file to be generated |
void |
setFileToParse(java.lang.String fileName) Set the file to be parsed |
void |
transferArray(PHXSimpleArray var, java.lang.String exp) Transfer an array of values, either from the file to the variable, or vice-versa, depending on ParseableFile.Mode |
void |
transferVar(IPHXType var, java.lang.String exp) Transfer a value, either from the file to the variable, or vice-versa, depending on ParseableFile.Mode |
protected void |
transferVars(ParseableFile.Mode mode) Transfer values for variables that have been defined using methods from the concrete implementation |
Methods inherited from class com.phoenix_int.aserver.util.scriptwrapper.api.AbstractFile
actionByMode, backup, close, delete, ensureFileParser, getEncoding, getRealFile, readTemplate, setEncoding, setEncoding, setFileToGenerateOrParse, setTempEmbedded, setTemplateFile, setVariable
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.phoenix_int.aserver.util.scriptwrapper.api.ParseableFile
backup, close, delete, readTemplate, setFileToGenerateOrParse, setTempEmbedded, setTemplateFile, setVariable
Constructor Detail
XPathFile
public XPathFile(PHXScriptWrapperObject wrapper,
ParseableFile.Mode mode)
Construct a new XPathFile
Parameters:
wrapper- script wrapper objectmode- parser mode
Method Detail
addVariable
public void addVariable(java.lang.String name,
java.lang.String type,
boolean isInput,
java.lang.String xpath)
throws PHXNameAlreadyInUseException,
PHXInvalidNameException,
PHXInvalidTypeException
Add a variable to the wrapper. The transfer of variable values will be handled automatically during any call to generate(), parse(), or AbstractFile.readTemplate().
Parameters:
name- variable nametype- variable typeisInput- whether variable is an inputxpath- XPath expression
Throws:
PHXNameAlreadyInUseExceptionPHXInvalidNameExceptionPHXInvalidTypeException
newParser
protected Parser newParser(java.io.File rFile,
Parser.Mode pmode)
throws java.io.IOException
Generate a new parser for the given file and mode
Specified by:
newParserin classAbstractFile
Parameters:
rFile- The file to openpmode- caching mode for underlying parser
Throws:
java.io.IOException
newParser
protected com.phoenix_int.aserver.util.XPathParser newParser(java.io.File file)
throws java.io.IOException,
org.xml.sax.SAXException,
javax.xml.parsers.ParserConfigurationException
Allow a sub-class to form a parser using custom options/features, such as handling DTD and entities
Parameters:
file-
Throws:
java.io.IOExceptionorg.xml.sax.SAXExceptionjavax.xml.parsers.ParserConfigurationException
getParser
public com.phoenix_int.aserver.util.XPathParser getParser()
throws java.io.IOException
Get the XPath parser
Throws:
java.io.IOException
transferVars
protected void transferVars(ParseableFile.Mode mode)
throws java.io.IOException,
com.phoenix_int.aserver.util.PHXInvalidFormatException,
PHXNoSuchTokenException,
java.lang.IllegalAccessException,
java.lang.InstantiationException,
PHXNumberFormatException
Transfer values for variables that have been defined using methods from the concrete implementation, i.e.PHXRowFieldFile.defineVar(String, String, boolean, String)
Variables defined using PHXScriptWrapperObject.addVariable(String, String, boolean) must be explicitly transferred using methods of the concrete implementation class
Specified by:
transferVarsin classAbstractFile
Throws:
java.io.IOExceptioncom.phoenix_int.aserver.util.PHXInvalidFormatExceptionPHXNoSuchTokenExceptionjava.lang.IllegalAccessExceptionjava.lang.InstantiationExceptionPHXNumberFormatException
transferArray
public void transferArray(PHXSimpleArray var,
java.lang.String exp)
throws PHXNoSuchTokenException,
java.io.IOException,
javax.xml.xpath.XPathExpressionException
Transfer an array of values, either from the file to the variable, or vice-versa, depending on ParseableFile.Mode
Parameters:
var- array variableexp- XPath expression
Throws:
PHXNoSuchTokenExceptionjava.io.IOExceptionjavax.xml.xpath.XPathExpressionException
transferVar
public void transferVar(IPHXType var,
java.lang.String exp)
throws javax.xml.xpath.XPathExpressionException,
PHXNoSuchTokenException,
java.io.IOException
Transfer a value, either from the file to the variable, or vice-versa, depending on ParseableFile.Mode
Parameters:
var- variableexp- XPath expression
Throws:
javax.xml.xpath.XPathExpressionExceptionPHXNoSuchTokenExceptionjava.io.IOException
parse
public void parse()
throws java.io.IOException,
com.phoenix_int.aserver.util.PHXInvalidFormatException,
PHXNoSuchTokenException,
java.lang.IllegalAccessException,
java.lang.InstantiationException,
PHXNumberFormatException
Parse the output file
Specified by:
parsein interfaceOutputFileparsein interfaceOutputFile2
Throws:
java.io.IOExceptioncom.phoenix_int.aserver.util.PHXInvalidFormatExceptionPHXNoSuchTokenExceptionjava.lang.IllegalAccessExceptionjava.lang.InstantiationExceptionPHXNumberFormatException
setFileToParse
public void setFileToParse(java.lang.String fileName)
Set the file to be parsed
Specified by:
setFileToParsein interfaceOutputFilesetFileToParsein interfaceOutputFile2
Parameters:
fileName- file name
generate
public void generate()
throws java.io.IOException,
com.phoenix_int.aserver.util.PHXInvalidFormatException,
PHXNoSuchTokenException,
java.lang.IllegalAccessException,
java.lang.InstantiationException,
PHXNumberFormatException
Generate the input file
Specified by:
generatein interfaceInputFile
Throws:
java.io.IOExceptioncom.phoenix_int.aserver.util.PHXInvalidFormatExceptionPHXNoSuchTokenExceptionjava.lang.IllegalAccessExceptionjava.lang.InstantiationExceptionPHXNumberFormatException
setFileToGenerate
public void setFileToGenerate(java.lang.String fileName)
Set the file to be generated
Specified by:
setFileToGeneratein interfaceInputFile
Parameters:
fileName- file name