SienaXML (v.2.0.0) API documentation

siena.xml.rules
Class Rule

java.lang.Object
  extended by siena.xml.rules.Rule

public class Rule
extends java.lang.Object

This object represent the idea of a Rule which is applied to XML statements. Currently the rule is used for XSchema processing only.


Constructor Summary
Rule(java.lang.String target, java.lang.String action)
          This is the constructor for the rule.
 
Method Summary
 void addCondition(siena.xml.rules.Condition condition)
          This method will add a condition to the list of conditions which need to be met by the target in order for the rule to apply to it.
 java.lang.String apply(org.w3c.dom.Node node)
          This method will apply the rule to the node.
 boolean doesRuleApplyToNode(org.w3c.dom.Node node)
          This method determins if a DOM tree node matches the target and condition for this rule.
 java.lang.String getAction()
          This method will return the string version of the action.
 java.lang.String getTarget()
          This method returns the target string for the rule.
 java.lang.String getTargetTag()
          Returns the XML target tag.
 void setAttributeTargets(java.util.Vector targets)
          Sets the attribute targets for the rule.
 void setToAndRule()
          Sets this rule to an "and" rule
 void setToOrRule()
          Sets this rule to an "or" rule
 java.lang.String toString()
          Method to convert the Object to a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Rule

public Rule(java.lang.String target,
            java.lang.String action)
This is the constructor for the rule.

Parameters:
target - This is the target string to apply the rule to. This can be a tag or an attribute in the XSchema file.
action - A string containing the action.
Method Detail

getAction

public java.lang.String getAction()
This method will return the string version of the action.

Returns:
String containing the action.

doesRuleApplyToNode

public boolean doesRuleApplyToNode(org.w3c.dom.Node node)
This method determins if a DOM tree node matches the target and condition for this rule. If there are no conditions then this method will alwyas return true.

Parameters:
node - The node to be tested to see if the rule can be applied to it.
Returns:
true if the rule should be applied to this node, otherwsie false.

addCondition

public void addCondition(siena.xml.rules.Condition condition)
This method will add a condition to the list of conditions which need to be met by the target in order for the rule to apply to it.

Parameters:
condition - A string description of the condition.

getTarget

public java.lang.String getTarget()
This method returns the target string for the rule.

Returns:
String containing the target tag.

setToAndRule

public void setToAndRule()
Sets this rule to an "and" rule


setToOrRule

public void setToOrRule()
Sets this rule to an "or" rule


getTargetTag

public java.lang.String getTargetTag()
Returns the XML target tag. If the target tag is a path, the first XML tag is returned.


setAttributeTargets

public void setAttributeTargets(java.util.Vector targets)
Sets the attribute targets for the rule.


apply

public java.lang.String apply(org.w3c.dom.Node node)
This method will apply the rule to the node. A string is returned that is either the name of the SIENA notification attribute that the value of the node should be stored in or a processing instruction for the node.

Parameters:
node - A DOM tree node for the XML document
Returns:
A String containing a attribute name or processing instruction.

toString

public java.lang.String toString()
Method to convert the Object to a string.

Overrides:
toString in class java.lang.Object
Returns:
String representation of the Rule object.

SienaXML (v.2.0.0) API documentation

Copyright © 2000-2002 University of Colorado.
This documentation is maintained by Antonio Carzaniga