Sxml (v.1.0.2) API documentation

siena.sxml
Class EventMap

java.lang.Object
  |
  +--siena.sxml.EventMap

public class EventMap
extends java.lang.Object

defines the mapping of XML data into a Siena notification. Associates attribute names of a Siena notification to rules (see AttributeRule). Once rules are defined for an EventMap, that EventMap can be used to process XML documents or in-memory document representations to produce event notifications.


Constructor Summary
EventMap()
          creates an empty map
 
Method Summary
 void attachContent(boolean b)
          determines whether this EventMap will make the content of the processed document available to subscribers.
 void attachXml()
          instructs this EventMap to make the content of the processed document available to subscribers.
 void exportRules(java.io.OutputStream os)
          saves this map onto an output stream.
 AttributeRule getRule(java.lang.String attr_name)
          returns the mapping rule associated with the given attribute name
static java.lang.String getXmlText(siena.Notification n)
          extracts the XML text from a notification produced by an EventMap
 void importRules(java.io.InputStream is)
          reads a set of rules from the given input stream.
 void importRules(java.lang.String filename)
          reads a set of rules from the given input file.
 siena.Notification makeNotification(java.io.InputStream is)
          processes an XML document to produce a Siena notification
 siena.Notification makeNotification(org.w3c.dom.Node root)
          processes an XML document to produce a Siena notification
 siena.Notification makeNotification(java.lang.String filename)
          processes an XML document to produce a Siena notification
 void putRule(java.lang.String attr_name, AttributeRule rule)
          adds or overwrites a mapping rule for the given attribute name
 AttributeRule removeRule(java.lang.String attr_name)
          removes the mapping rule for the given attribute name
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventMap

public EventMap()
creates an empty map
Method Detail

attachXml

public void attachXml()
instructs this EventMap to make the content of the processed document available to subscribers. By default, the XML source document is not transferred.

attachContent

public void attachContent(boolean b)
determines whether this EventMap will make the content of the processed document available to subscribers. By default, the XML source document is not transferred.

getXmlText

public static java.lang.String getXmlText(siena.Notification n)
extracts the XML text from a notification produced by an EventMap
Returns:
XML text of the source document that produced this notification. Or null is the source document was not attached to the notification or if this notification was not generated by an EventMap

exportRules

public void exportRules(java.io.OutputStream os)
                 throws java.io.IOException
saves this map onto an output stream. The map is saved in a text file, with the syntax specified in importRules(java.io.InputStream).

importRules

public void importRules(java.io.InputStream is)
                 throws RuleParseException,
                        java.io.IOException
reads a set of rules from the given input stream. This method expects a text stream, with the following (semi-formal) syntax:
<S> ::= ( <rule> ; ) +
<rule> ::= <type> <name> = <path> [ <multivalue-spec> ]
<type> ::= int | string | double | bool
<name> ::= valid Siena attribute name (see Siena.Notification)
<path> ::= valid Java/C/C++ string literal
<multivalue-spec> ::= first | last | xml | separator separator
<separator> ::= valid Java/C/C++ string literal

Anything following a pound sign (#) up to the first end of line is a comment.

Example:


      #
      #  this is a set of Sxml rules
      #
      string name="/person/@name";  # default multivalue=first
      int age="/person/@age" first;
      string parents="/person/parents/person/@name" separator ", ";
      string job="/person/job" xml;
  
See Also:
exportRules(OutputStream)

importRules

public void importRules(java.lang.String filename)
                 throws RuleParseException,
                        java.io.IOException
reads a set of rules from the given input file.
See Also:
importRules(java.io.InputStream)

putRule

public void putRule(java.lang.String attr_name,
                    AttributeRule rule)
adds or overwrites a mapping rule for the given attribute name

removeRule

public AttributeRule removeRule(java.lang.String attr_name)
removes the mapping rule for the given attribute name

getRule

public AttributeRule getRule(java.lang.String attr_name)
returns the mapping rule associated with the given attribute name

makeNotification

public siena.Notification makeNotification(java.io.InputStream is)
                                    throws org.xml.sax.SAXException,
                                           java.io.IOException,
                                           javax.xml.transform.TransformerException,
                                           EventMapException
processes an XML document to produce a Siena notification

makeNotification

public siena.Notification makeNotification(java.lang.String filename)
                                    throws org.xml.sax.SAXException,
                                           java.io.IOException,
                                           javax.xml.transform.TransformerException,
                                           EventMapException
processes an XML document to produce a Siena notification

makeNotification

public siena.Notification makeNotification(org.w3c.dom.Node root)
                                    throws javax.xml.transform.TransformerException,
                                           EventMapException
processes an XML document to produce a Siena notification

Sxml (v.1.0.2) API documentation

Copyright © 2001 University of Colorado.
This documentation is maintained by Antonio Carzaniga