defineTag

Error message

Deprecated function: The each() function is deprecated. This message will be suppressed on further calls in book_prev() (line 775 of /home/drbiz/public/tools.realism.com/modules/book/book.module).

Primary tabs

The defineTag method of xseen.Tag is one of two ways to define a new tag (see loadTags for the other). It creates a data structure that is inserted into the parsing table (overwriting a previous entry if it exists) with the addTag method. The parsing table is used by the XSeen to completely parse the XSeen input prior to any run-time processing.

tagStructure = xseen.Tag.defineTag (name, init, fin, event);

This can also be called with a JSON data structure with the above names as the field names all passed as the first argument.

  • name
    The name of the tag as a string. The string is converted to lower case before saving. The first character must be a letter. Legal characters are [a-z0-9-]. Note that 'x-' is prepended to all tag names
  • init
    The method that is called when the opening tag (i.e., <name ...>) is found. [Actually, it is when element.name is name, but that is really a minor point.]. All tag setup operations should be performed in this method.
  • fin
    The method that is called when the closing tag (i.e., </name>) is found. [Actually, it is when the parser is done parsing all of the children of name and just before returning to parsing the parent of name.] Initialization that depends on children of this tag is done in this method. If this tag cannot have children, then all of the work can be done in either of the init or fin method.
  • event
    The methid that is called when this tag receives an event. This method receives two arguments - the HTML event data structure and the attribute name the event applies to. This method must know how to interpert the event and make the requested modifications to internal data.

All methods are required; however, they need to be defined as null.

This method returns the tag data structure. It needs to be used to define the tag's attributes.