Class DTMNamedNodeMap

  • All Implemented Interfaces:
    org.w3c.dom.NamedNodeMap

    public class DTMNamedNodeMap
    extends java.lang.Object
    implements org.w3c.dom.NamedNodeMap
    DTMNamedNodeMap is a quickie (as opposed to quick) implementation of the DOM's NamedNodeMap interface, intended to support DTMProxy's getAttributes() call.

    ***** Note: this does _not_ current attempt to cache any of the data; if you ask for attribute 27 and then 28, you'll have to rescan the first 27. It should probably at least keep track of the last one retrieved, and possibly buffer the whole array.

    ***** Also note that there's no fastpath for the by-name query; we search linearly until we find it or fail to find it. Again, that could be optimized at some cost in object creation/storage.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  DTMNamedNodeMap.DTMException
      Simple implementation of DOMException.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) DTM dtm
      The DTM for this node.
      (package private) int element
      The DTM element handle.
      (package private) short m_count
      The number of nodes in this map.
    • Constructor Summary

      Constructors 
      Constructor Description
      DTMNamedNodeMap​(DTM dtm, int element)
      Create a getAttributes NamedNodeMap for a given DTM element node
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getLength()
      org.w3c.dom.Node getNamedItem​(java.lang.String name)
      org.w3c.dom.Node getNamedItemNS​(java.lang.String namespaceURI, java.lang.String localName)
      org.w3c.dom.Node item​(int i)
      org.w3c.dom.Node removeNamedItem​(java.lang.String name)
      org.w3c.dom.Node removeNamedItemNS​(java.lang.String namespaceURI, java.lang.String localName)
      org.w3c.dom.Node setNamedItem​(org.w3c.dom.Node newNode)
      org.w3c.dom.Node setNamedItemNS​(org.w3c.dom.Node arg)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • dtm

        final DTM dtm
        The DTM for this node.
      • element

        final int element
        The DTM element handle.
      • m_count

        short m_count
        The number of nodes in this map.
    • Constructor Detail

      • DTMNamedNodeMap

        public DTMNamedNodeMap​(DTM dtm,
                               int element)
        Create a getAttributes NamedNodeMap for a given DTM element node
        Parameters:
        dtm - The DTM Reference, must be non-null.
        element - The DTM element handle.
    • Method Detail

      • getLength

        public int getLength()
        Specified by:
        getLength in interface org.w3c.dom.NamedNodeMap
      • getNamedItem

        public org.w3c.dom.Node getNamedItem​(java.lang.String name)
        Specified by:
        getNamedItem in interface org.w3c.dom.NamedNodeMap
      • item

        public org.w3c.dom.Node item​(int i)
        Specified by:
        item in interface org.w3c.dom.NamedNodeMap
      • setNamedItem

        public org.w3c.dom.Node setNamedItem​(org.w3c.dom.Node newNode)
        Specified by:
        setNamedItem in interface org.w3c.dom.NamedNodeMap
      • removeNamedItem

        public org.w3c.dom.Node removeNamedItem​(java.lang.String name)
        Specified by:
        removeNamedItem in interface org.w3c.dom.NamedNodeMap
      • getNamedItemNS

        public org.w3c.dom.Node getNamedItemNS​(java.lang.String namespaceURI,
                                               java.lang.String localName)
        Specified by:
        getNamedItemNS in interface org.w3c.dom.NamedNodeMap
      • setNamedItemNS

        public org.w3c.dom.Node setNamedItemNS​(org.w3c.dom.Node arg)
                                        throws org.w3c.dom.DOMException
        Specified by:
        setNamedItemNS in interface org.w3c.dom.NamedNodeMap
        Throws:
        org.w3c.dom.DOMException
      • removeNamedItemNS

        public org.w3c.dom.Node removeNamedItemNS​(java.lang.String namespaceURI,
                                                  java.lang.String localName)
                                           throws org.w3c.dom.DOMException
        Specified by:
        removeNamedItemNS in interface org.w3c.dom.NamedNodeMap
        Throws:
        org.w3c.dom.DOMException