net.sf.saxon.evpull

## Class StartElementEvent

- java.lang.Object
- - net.sf.saxon.evpull.StartElementEvent

- All Implemented Interfaces:
    PullEvent

      public class StartElementEvent
      extends Object
      implements PullEvent

  This is a PullEvent representing the start of an element node. It contains (or potentially contains) all the namespace declarations and attributes associated with the element.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `StartElementEvent(PipelineConfiguration pipe)` Create a Start Element Event

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addAttribute(NodeInfo att)` Add an attribute to the element node
    `void` | `addNamespace(NamespaceBinding nscode)` Add a namespace code representing a locally declared namespace
    `NodeInfo` | `getAttribute(int index)` Get the n'th attribute if there is one
    `int` | `getAttributeCount()` Ask how may attributes the element has
    `NodeName` | `getElementName()` Get the nameCode of this element
    `NamespaceBinding[]` | `getLocalNamespaces()` Get the namespaces locally declared on this element
    `int` | `getLocationId()` Get the location associated with the event
    `PipelineConfiguration` | `getPipelineConfiguration()` Get the PipelineConfiguration
    `SchemaType` | `getTypeCode()` Get the typeCode of this element
    `boolean` | `hasAttributes()` Ask whether the element has any attributes
    `Iterator` | `iterateAttributes()` Get an iterator over the attributes of this element
    `void` | `namespaceFixup()` Perform namespace fixup.
    `void` | `setElementName(NodeName elementName)` Set the nameCode of this element
    `void` | `setLocalNamespaces(NamespaceBinding[] nscodes)` Set the namespaces that are locally declared (or undeclared) on this element
    `void` | `setLocationId(int locationId)` Set the location associated with the event
    `void` | `setTypeCode(SchemaType typeCode)` Set the typeCode of this element
    `void` | `stripTypeAnnotations()` Strip type annotations from the element and its attributes

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### StartElementEvent

          public StartElementEvent(PipelineConfiguration pipe)

      Create a Start Element Event
      Parameters:
        `pipe` - the pipeline configuration

  - ### Method Detail

    - #### setElementName

          public void setElementName(NodeName elementName)

      Set the nameCode of this element
      Parameters:
        `elementName` - the namecode of the element (its name as identified in the NamePool)

    - #### getElementName

          public NodeName getElementName()

      Get the nameCode of this element
      Returns:
        the nameCode representing the element's name

    - #### setTypeCode

          public void setTypeCode(SchemaType typeCode)

      Set the typeCode of this element
      Parameters:
        `typeCode` - the element's type annotation

    - #### getTypeCode

          public SchemaType getTypeCode()

      Get the typeCode of this element
      Returns:
        the element's type annotation

    - #### setLocalNamespaces

          public void setLocalNamespaces(NamespaceBinding[] nscodes)

      Set the namespaces that are locally declared (or undeclared) on this element
      Parameters:
        `nscodes` - integer array of namespace codes

    - #### addNamespace

          public void addNamespace(NamespaceBinding nscode)
                            throws XPathException

      Add a namespace code representing a locally declared namespace
      Parameters:
        `nscode` - a namespace code
      Throws:
        `XPathException`

    - #### getLocalNamespaces

          public NamespaceBinding[] getLocalNamespaces()

      Get the namespaces locally declared on this element
      Returns:
        an array of namespace codes

    - #### addAttribute

          public void addAttribute(NodeInfo att)
                            throws XPathException

      Add an attribute to the element node
      Parameters:
        `att` - the attribute to be added
      Throws:
        `XPathException` - in the event of a dynamic error, for example a duplicate attribute in XQuery

    - #### hasAttributes

          public boolean hasAttributes()

      Ask whether the element has any attributes
      Returns:
        true if the element has one or more attributes

    - #### getAttributeCount

          public int getAttributeCount()

      Ask how may attributes the element has
      Returns:
        the number of attributes that the element has

    - #### iterateAttributes

          public Iterator iterateAttributes()

      Get an iterator over the attributes of this element
      Returns:
        an iterator which delivers NodeInfo objects representing the attributes of this element

    - #### getAttribute

          public NodeInfo getAttribute(int index)

      Get the n'th attribute if there is one
      Parameters:
        `index` - the index of the attributes, starting from zero
      Returns:
        a NodeInfo representing the attribute, or null if there is no such attribute

    - #### namespaceFixup

          public void namespaceFixup()

      Perform namespace fixup. This is done after all the attributes and explicit namespaces have been added. Namespace fixup ensures that a namespace declaration is present for the element name and for every attribute name, and that the prefixes of the element and each attribute are consistent with the declared namespaces, changing any prefixes in the event of a conflict.

    - #### stripTypeAnnotations

          public void stripTypeAnnotations()

      Strip type annotations from the element and its attributes

    - #### getPipelineConfiguration

          public PipelineConfiguration getPipelineConfiguration()

      Get the PipelineConfiguration
      Returns:
        the PipelineConfiguration

    - #### setLocationId

          public void setLocationId(int locationId)

      Set the location associated with the event
      Parameters:
        `locationId` - a location identifier, to be interpreted by the locationProvider associated with the PipelineConfiguration

    - #### getLocationId

          public int getLocationId()

      Get the location associated with the event
      Returns:
        a location identifier, to be interpreted by the locationProvider associated with the PipelineConfiguration, or -1 if none is available

Copyright (c) 2004-2013 Saxonica Limited. All rights reserved.