Class Namespacing


  • public abstract class Namespacing
    extends java.lang.Object
    Determines how namespaces are handled in VOTable documents. The static getInstance() method provides an object which encapsulates the default namespacing policy.
    Since:
    1 Sep 2009
    Author:
    Mark Taylor
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static Namespacing LAX
      Interpret likely-looking elements in any namespace as VOTable ones.
      static Namespacing NONE
      No namespace awareness; any namespacing will probably confuse parser.
      static java.lang.String POLICY_PROP
      Name of system property which determines namespacing policy used.
      static Namespacing STRICT
      Only elements in namespaces with VOTable URIs are significant.
    • Constructor Summary

      Constructors 
      Constructor Description
      Namespacing​(java.lang.String name)
      Constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract void configureSAXParserFactory​(javax.xml.parsers.SAXParserFactory spfact)
      Performs any necessary configuration of the namespacing capabilities of a given parser factory for use with this namespacing policy.
      static Namespacing getInstance()
      Returns the default Namespacing instance.
      abstract java.lang.String getVOTagName​(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
      Returns the VOTable tagname for an XML element as encountered by a SAX parser.
      java.lang.String getVOTagName​(org.w3c.dom.Element el)
      Returns the VOTable tagname for an XML element as present in a DOM.
      void setInstance​(Namespacing instance)
      Sets the default instance.
      java.lang.String toString()
      Returns the name of this namespacing policy.
      • Methods inherited from class java.lang.Object

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

      • POLICY_PROP

        public static final java.lang.String POLICY_PROP
        Name of system property which determines namespacing policy used. Property name is "votable.namespacing". Possible values are "none", "lax", "strict" or the classname of a Namespacing implementation which has a no-arg constructor.
        See Also:
        Constant Field Values
      • NONE

        public static final Namespacing NONE
        No namespace awareness; any namespacing will probably confuse parser.
      • LAX

        public static final Namespacing LAX
        Interpret likely-looking elements in any namespace as VOTable ones.
      • STRICT

        public static final Namespacing STRICT
        Only elements in namespaces with VOTable URIs are significant.
    • Constructor Detail

      • Namespacing

        public Namespacing​(java.lang.String name)
        Constructor.
        Parameters:
        name - concise human-readable name describing this policy
    • Method Detail

      • configureSAXParserFactory

        public abstract void configureSAXParserFactory​(javax.xml.parsers.SAXParserFactory spfact)
        Performs any necessary configuration of the namespacing capabilities of a given parser factory for use with this namespacing policy.
        Parameters:
        spfact - factory to configure
      • getVOTagName

        public abstract java.lang.String getVOTagName​(java.lang.String namespaceURI,
                                                      java.lang.String localName,
                                                      java.lang.String qName)
        Returns the VOTable tagname for an XML element as encountered by a SAX parser. The return value is a bare string which may be compared to one of the VOTable element names ignoring namespaces; for instance a return value of "TABLE" indicates that this is a VOTable TABLE element.

        The parameters have the same meanings, and may or may not be present as for, those in ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes).

        Parameters:
        namespaceURI - namespace URI
        localName - local name
        qName - qualified name
        Returns:
        element name in VOTable namespace
      • getVOTagName

        public java.lang.String getVOTagName​(org.w3c.dom.Element el)
        Returns the VOTable tagname for an XML element as present in a DOM. The return value is a bare string which may be compared to one of the VOTable element names ignoring namespaces; for instance a return value of "TABLE" indicates that this is a VOTable TABLE element.
        Parameters:
        el - element
        Returns:
        element name in VOTable namespace
      • toString

        public java.lang.String toString()
        Returns the name of this namespacing policy.
        Overrides:
        toString in class java.lang.Object
        Returns:
        name
      • getInstance

        public static Namespacing getInstance()
        Returns the default Namespacing instance. The default value is determined by examining the POLICY_PROP system property. If not otherwise set the default is currently LAX.
        Returns:
        namespacing instance
      • setInstance

        public void setInstance​(Namespacing instance)
        Sets the default instance.
        Parameters:
        instance - new default instance