Class XmlTree

    • Constructor Summary

      Constructors 
      Constructor Description
      XmlTree()
      Make an empty tree.
      XmlTree​(java.lang.String src)
      Given an XML string, build the tree.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Enumeration elements()  
      static void elements​(XmlTree.Node n, java.util.Vector v)  
      java.lang.Object get​(java.lang.Object k)
      Given a node description, return the value, if any.
      static java.lang.String getFile​(java.io.InputStream in)  
      static java.lang.String getFile​(java.lang.String s)  
      java.lang.String getPart​(java.lang.String s)
      Given a node descriptor, return the result.
      XmlTree.Node getRoot()  
      java.util.Hashtable getTags()  
      boolean isEmpty()
      The current object state is the "default"; "save" does not need to write out any state.
      java.util.Enumeration keys()  
      void keys​(XmlTree.Node n, java.lang.String prefix, java.lang.String delim, java.util.Vector v)  
      void load​(java.io.InputStream in)
      Recreate the object from the ascii representation stored as a Properties format file.
      static void main​(java.lang.String[] args)  
      java.util.Vector match​(java.lang.String pattern)
      Find all nodes that match a glob pattern, starting at the root.
      void match​(XmlTree.Node node, java.util.StringTokenizer st, java.util.Vector results)
      Find all nodes that match a glob pattern, starting at any node.
      java.lang.Object put​(java.lang.Object k, java.lang.Object v)  
      java.lang.Object remove​(java.lang.Object o)  
      void replace​(java.lang.String src)
      Replace the XmlTree with new markup.
      void save​(java.io.OutputStream out, java.lang.String header)
      Create an ascii representation of this object in a Java Properties format.
      XmlTree.Node search​(java.lang.String s)
      Find a node in the tree by name, starting at the root.
      XmlTree.Node search​(XmlTree.Node node, java.util.StringTokenizer st)
      Find a node in the tree by name, starting under any node.
      boolean setAttribute​(java.lang.String name, java.lang.String key, java.lang.String value)  
      boolean setCdata​(java.lang.String name, java.lang.String data)  
      void setComparator​(XmlTree.NodeName nodeName)
      Set the class that determines a node's name.
      void setDelim​(java.lang.String delim)
      set the node delimiter.
      boolean setDflt​(java.lang.String dflt)  
      void setIdent​(java.lang.String ident)  
      void setPrefix​(java.lang.String prefix)
      set the name of this tree
      void setTag​(java.lang.String tag)
      Add an element to the tag process list.
      void setTags​(java.util.Hashtable tags)
      Set the list of tags to process
      int size()  
      java.lang.String toString()
      Print a tree
      void toString​(XmlTree.Node node, java.lang.StringBuffer sb, int level)  
      • Methods inherited from class java.lang.Object

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

      • XmlTree

        public XmlTree()
        Make an empty tree.
      • XmlTree

        public XmlTree​(java.lang.String src)
                throws java.lang.IllegalArgumentException
        Given an XML string, build the tree.
        Throws:
        java.lang.IllegalArgumentException
    • Method Detail

      • setIdent

        public void setIdent​(java.lang.String ident)
      • setTag

        public void setTag​(java.lang.String tag)
        Add an element to the tag process list. Once a Process tag is defined, only tags defined are processed. All other tags are treated as singletons
      • setTags

        public void setTags​(java.util.Hashtable tags)
        Set the list of tags to process
      • getTags

        public java.util.Hashtable getTags()
      • setPrefix

        public void setPrefix​(java.lang.String prefix)
        set the name of this tree
      • setDelim

        public void setDelim​(java.lang.String delim)
        set the node delimiter.
      • setDflt

        public boolean setDflt​(java.lang.String dflt)
      • setComparator

        public void setComparator​(XmlTree.NodeName nodeName)
        Set the class that determines a node's name. This may be used to change the way nodes are named in an arbitrary fashion.
      • toString

        public java.lang.String toString()
        Print a tree
        Overrides:
        toString in class java.lang.Object
        Parameters:
        node - : The starting node
        sb - : where to append the results to
        level - : the nesting level
      • toString

        public void toString​(XmlTree.Node node,
                             java.lang.StringBuffer sb,
                             int level)
      • setAttribute

        public boolean setAttribute​(java.lang.String name,
                                    java.lang.String key,
                                    java.lang.String value)
      • setCdata

        public boolean setCdata​(java.lang.String name,
                                java.lang.String data)
      • search

        public XmlTree.Node search​(java.lang.String s)
        Find a node in the tree by name, starting at the root.
        Parameters:
        s - The node pathname
        Returns:
        The node, if found, or null
      • search

        public XmlTree.Node search​(XmlTree.Node node,
                                   java.util.StringTokenizer st)
        Find a node in the tree by name, starting under any node.
      • match

        public java.util.Vector match​(java.lang.String pattern)
        Find all nodes that match a glob pattern, starting at the root.
      • match

        public void match​(XmlTree.Node node,
                          java.util.StringTokenizer st,
                          java.util.Vector results)
        Find all nodes that match a glob pattern, starting at any node.
      • elements

        public java.util.Enumeration elements()
        Specified by:
        elements in class java.util.Dictionary
      • elements

        public static void elements​(XmlTree.Node n,
                                    java.util.Vector v)
      • keys

        public java.util.Enumeration keys()
        Specified by:
        keys in class java.util.Dictionary
      • keys

        public void keys​(XmlTree.Node n,
                         java.lang.String prefix,
                         java.lang.String delim,
                         java.util.Vector v)
      • get

        public java.lang.Object get​(java.lang.Object k)
        Given a node description, return the value, if any. Descriptions are of the form: [prefix].name.[suffix] where : [prefix] is the name of the tree "." is the current delimiter, name is the path name of a node in the tree [suffix] specifies which part of the node to return as a string. See getpart() for the list of valid suffixes.
        Specified by:
        get in class java.util.Dictionary
      • getPart

        public java.lang.String getPart​(java.lang.String s)
        Given a node descriptor, return the result. XXX not done modifiers: cdata: return cdata tag: the name index: which tag within whis parent attributes: the list of attribute names children: the list of children childCount: the number of children .value the value for attribute glob nodes matching the glob pattern all all nodes under this one
      • put

        public java.lang.Object put​(java.lang.Object k,
                                    java.lang.Object v)
        Specified by:
        put in class java.util.Dictionary
      • remove

        public java.lang.Object remove​(java.lang.Object o)
        Specified by:
        remove in class java.util.Dictionary
      • size

        public int size()
        Specified by:
        size in class java.util.Dictionary
      • save

        public void save​(java.io.OutputStream out,
                         java.lang.String header)
                  throws java.io.IOException
        Description copied from interface: PropertiesCacheManager.Saveable
        Create an ascii representation of this object in a Java Properties format.
        Specified by:
        save in interface PropertiesCacheManager.Saveable
        Throws:
        java.io.IOException
      • main

        public static void main​(java.lang.String[] args)
      • getFile

        public static java.lang.String getFile​(java.lang.String s)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • getFile

        public static java.lang.String getFile​(java.io.InputStream in)
                                        throws java.io.IOException
        Throws:
        java.io.IOException