CSP for Java
(JCSP) 1.1-rc4

org.jcsp.net
Class XMLNodeFactory

java.lang.Object
  extended by org.jcsp.net.XMLNodeFactory
All Implemented Interfaces:
Serializable, NodeFactory

public class XMLNodeFactory
extends 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.

Author:
Quickstone Technologies Limited
See Also:
Serialized Form

Constructor Summary
XMLNodeFactory(File xmlFile)
          Constructs an XMLNodeFactory that uses the specified file.
XMLNodeFactory(String filename)
          Constructs an XMLNodeFactory that uses the specified file.
XMLNodeFactory(URL xmlFile)
          Constructs an XMLNodeFactory that uses the specified file.
 
Method Summary
 NodeKey initNode(Node node, Node.Attributes attribs)
          This is called by the Node class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLNodeFactory

public XMLNodeFactory(String filename)
               throws IOException
Constructs an XMLNodeFactory that uses the specified file.

Parameters:
filename - the file name of the config file to use.
Throws:
IOException

XMLNodeFactory

public XMLNodeFactory(File xmlFile)
               throws IOException
Constructs an XMLNodeFactory that uses the specified file.

Parameters:
xmlFile - a File object pointing to the XML file to use.
Throws:
IOException

XMLNodeFactory

public XMLNodeFactory(URL xmlFile)
               throws IOException
Constructs an XMLNodeFactory that uses the specified file.

Parameters:
xmlFile - a URL object pointing to the XML file to use.
Throws:
IOException
Method Detail

initNode

public NodeKey initNode(Node node,
                        Node.Attributes attribs)
                 throws NodeInitFailedException
This is called by the Node class.

Specified by:
initNode in interface NodeFactory
Parameters:
node - the Node object calling the method.
attribs - the attributes that need to be set by the method.
Throws:
NodeInitFailedException - if initialization failed.

CSP for Java
(JCSP) 1.1-rc4

Submit a bug or feature to jcsp-team@kent.ac.uk
Version 1.1-rc4 of the JCSP API Specification (Copyright 1997-2008 P.D.Austin and P.H.Welch - All Rights Reserved)
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.