Package org.jcsp.net
Class XMLNodeFactory
- java.lang.Object
-
- org.jcsp.net.XMLNodeFactory
-
- All Implemented Interfaces:
java.io.Serializable,NodeFactory
public class XMLNodeFactory extends java.lang.Object implements NodeFactory
Factory for node instantiation based on an XML-like file.
The factory uses its own XML parser that supports a sub-set of XML. The current implementation will parse a file compatible with jcsp-config.dtd. The parser does not current test conformance to this DTD. It does not currently support XML comments.
An example of using this class can be seen in
.CNS- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private JCSPConfigconfig
-
Constructor Summary
Constructors Constructor Description XMLNodeFactory(java.io.File xmlFile)Constructs anXMLNodeFactorythat uses the specified file.XMLNodeFactory(java.lang.String filename)Constructs anXMLNodeFactorythat uses the specified file.XMLNodeFactory(java.net.URL xmlFile)Constructs anXMLNodeFactorythat uses the specified file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NodeKeyinitNode(Node node, Node.Attributes attribs)This is called by theNodeclass.
-
-
-
Field Detail
-
config
private final JCSPConfig config
-
-
Constructor Detail
-
XMLNodeFactory
public XMLNodeFactory(java.lang.String filename) throws java.io.IOExceptionConstructs anXMLNodeFactorythat uses the specified file.- Parameters:
filename- the file name of the config file to use.- Throws:
java.io.IOException
-
XMLNodeFactory
public XMLNodeFactory(java.io.File xmlFile) throws java.io.IOExceptionConstructs anXMLNodeFactorythat uses the specified file.- Parameters:
xmlFile- aFileobject pointing to the XML file to use.- Throws:
java.io.IOException
-
XMLNodeFactory
public XMLNodeFactory(java.net.URL xmlFile) throws java.io.IOExceptionConstructs anXMLNodeFactorythat uses the specified file.- Parameters:
xmlFile- aURLobject pointing to the XML file to use.- Throws:
java.io.IOException
-
-
Method Detail
-
initNode
public NodeKey initNode(Node node, Node.Attributes attribs) throws NodeInitFailedException
This is called by theNodeclass.- Specified by:
initNodein interfaceNodeFactory- Parameters:
node- the Node object calling the method.attribs- the attributes that need to be set by the method.- Throws:
NodeInitFailedException- if initialization failed.
-
-