jv.rsrc

## Class PsXmlSrc

- java.lang.Object
- - jv.rsrc.PsXmlSrc

- All Implemented Interfaces:
    java.io.Serializable

      public class PsXmlSrc
      extends java.lang.Object
      implements java.io.Serializable

  Resource tree generated from an XML file.
  See Also:
    Serialized Form
  Author:
    Konrad Polthier
  Version:
    20.02.00, 1.10 revised (kp) Extended from PsObject instead from Object.
    04.02.00, 1.00 created (kp)

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PsXmlSrc()` Constructor with no action.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static PsXmlNode` | `assureChild(PsXmlNode parent, java.lang.String type)` Assure existence of a child node of given element type, and create it if necessary.
    `java.lang.String` | `getDocName()` Get name of root element of associated DTD, or null.
    `java.lang.String` | `getDocType()` Get url of associated DTD, or null.
    `java.lang.String` | `getParameter(java.lang.String name)` Get a parameter given by hierarchical name.
    `PsXmlNode` | `getRootNode()` Get root node of resource tree.
    `static java.lang.String` | `getRsrc(PsXmlNode rsrcNode, java.lang.String type)` Get content of node in resource tree with given element type by searching from given node.
    `static boolean` | `getRsrcAsBoolean(PsXmlNode rsrcNode, java.lang.String type)` Get content of node in resource tree with given element type by searching from given node.
    `static double` | `getRsrcAsDouble(PsXmlNode rsrcNode, java.lang.String type)` Get content of node in resource tree with given element type by searching from given node.
    `static int` | `getRsrcAsInteger(PsXmlNode rsrcNode, java.lang.String type)` Get content of node in resource tree with given element type by searching from given node.
    `java.lang.String` | `getRsrcFile()` Get resource file name.
    `static PsXmlNode` | `getRsrcNode(PsXmlNode rsrcNode, java.lang.String type)` Get descendant node in resource tree with given element type.
    `static PsXmlNode[]` | `getRsrcNodes(PsXmlNode rsrcNode)` Get children nodes of a given element.
    `static PsXmlNode[]` | `getRsrcNodes(PsXmlNode rsrcNode, java.lang.String type)` Get nodes in resource tree with given element type by searching from given node.
    `void` | `setDocName(java.lang.String name)` Set name of root element of associated DTD, or null.
    `void` | `setDocType(java.lang.String type)` Set url of associated DTD, or null.
    `void` | `setRootNode(PsXmlNode root)` Set root node of resource tree.
    `void` | `setRsrcFile(java.lang.String rsrcFile)` Set name of resource name.
    `static java.lang.String` | `write(PsXmlSrc src)` Writes an XML tree into a string.
    `static boolean` | `write(java.io.Writer writer, PsXmlSrc src)` Writes an XML tree into a writer.

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

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

- - ### Constructor Detail

    - #### PsXmlSrc

          public PsXmlSrc()

      Constructor with no action.

  - ### Method Detail

    - #### write

          public static java.lang.String write(PsXmlSrc src)

      Writes an XML tree into a string.
      Parameters:
        `src` - an XML source with XML tree
      Returns:
        a string with formatted XML data
      Author:
        Konrad Polthier
      Version:
        09.01.01, 2.10 revised (kp) Method move to PsXmlSrc from jv.loader.PsXmlLoader.
        16.04.00, 1.10 revised (kp) Method argument changed to to PsXmlSrc.
        05.02.00, 1.00 created (kp)

    - #### write

          public static boolean write(java.io.Writer writer,
                                      PsXmlSrc src)
                               throws java.io.IOException

      Writes an XML tree into a writer.
      Parameters:
        `writer` - Write all data to this stream
        `src` - an XML source with XML tree
      Returns:
        `true` on success.
      Throws:
        `java.io.IOException`
      Author:
        Konrad Polthier
      Version:
        18.02.01, 1.00 revised (kp)
        18.02.01, 1.00 created (kp)

    - #### getParameter

          public java.lang.String getParameter(java.lang.String name)

      Get a parameter given by hierarchical name. For example, javaview/license/usage would be a valid hierarchical name. The first component need not be the root node of the JavaView XML resource but it must uniquely identify a node in the XML tree. The parameter may refer to an element or an element attribute. If it refers to an attribute then the element must be given.
      Parameters:
        `name` - (incomplete) hierarchical name of an element or attribute.
      Returns:
        content resp. value of the requested element resp. attribute, or null.

    - #### getRsrcFile

          public java.lang.String getRsrcFile()

      Get resource file name. Only assigned if file has already been read or a file name has been given by explicit call of `setRsrcFile(String)`.
      Returns:
        name of a XML file

    - #### setRsrcFile

          public void setRsrcFile(java.lang.String rsrcFile)

      Set name of resource name.
      Parameters:
        `rsrcFile` - name of a XML file

    - #### getDocName

          public java.lang.String getDocName()

      Get name of root element of associated DTD, or null.

    - #### setDocName

          public void setDocName(java.lang.String name)

      Set name of root element of associated DTD, or null.

    - #### getDocType

          public java.lang.String getDocType()

      Get url of associated DTD, or null.

    - #### setDocType

          public void setDocType(java.lang.String type)

      Set url of associated DTD, or null.

    - #### getRootNode

          public PsXmlNode getRootNode()

      Get root node of resource tree.

    - #### setRootNode

          public void setRootNode(PsXmlNode root)

      Set root node of resource tree.
      Parameters:
        `root` - new root node

    - #### assureChild

          public static PsXmlNode assureChild(PsXmlNode parent,
                                              java.lang.String type)

      Assure existence of a child node of given element type, and create it if necessary.
      Parameters:
        `parent` - to be checked whether it has a decendent node of given element type.
        `type` - element type of node to be assured
      Returns:
        argument node if it exists, else newly created instance.

    - #### getRsrcNode

          public static PsXmlNode getRsrcNode(PsXmlNode rsrcNode,
                                              java.lang.String type)

      Get descendant node in resource tree with given element type.
      Parameters:
        `rsrcNode` - node whose descendants are searched including itself
        `type` - element type of node to be searched
      Returns:
        node if found, else `null`

    - #### getRsrcNodes

          public static PsXmlNode[] getRsrcNodes(PsXmlNode rsrcNode,
                                                 java.lang.String type)

      Get nodes in resource tree with given element type by searching from given node.
      Parameters:
        `rsrcNode` - node whose descendants are searched including itself
        `type` - element type of node to be searched
      Returns:
        node array if found, else array of length 0.

    - #### getRsrcNodes

          public static PsXmlNode[] getRsrcNodes(PsXmlNode rsrcNode)

      Get children nodes of a given element.
      Parameters:
        `rsrcNode` - node whose descendants are searched including itself
      Returns:
        node array if found, else array of length 0.

    - #### getRsrc

          public static java.lang.String getRsrc(PsXmlNode rsrcNode,
                                                 java.lang.String type)

      Get content of node in resource tree with given element type by searching from given node.
      Parameters:
        `rsrcNode` - node whose descendants are searched including itself
        `type` - element type of node to be searched
      Returns:
        content of resource if resource is found, else `null`.

    - #### getRsrcAsDouble

          public static double getRsrcAsDouble(PsXmlNode rsrcNode,
                                               java.lang.String type)

      Get content of node in resource tree with given element type by searching from given node. Method assumes that content is formated as double and does some checking.
      Parameters:
        `rsrcNode` - node whose descendants are searched including itself
        `type` - element type of node to be searched
      Returns:
        content of resource if resource is found, else default value 0.

    - #### getRsrcAsInteger

          public static int getRsrcAsInteger(PsXmlNode rsrcNode,
                                             java.lang.String type)

      Get content of node in resource tree with given element type by searching from given node. Method assumes that content is formated as double and does some checking.
      Parameters:
        `rsrcNode` - node whose descendants are searched including itself
        `type` - element type of node to be searched
      Returns:
        content of resource if resource is found, else default value 0.

    - #### getRsrcAsBoolean

          public static boolean getRsrcAsBoolean(PsXmlNode rsrcNode,
                                                 java.lang.String type)

      Get content of node in resource tree with given element type by searching from given node. Method assumes that content is formated as double and does some checking.
      Parameters:
        `rsrcNode` - node whose descendants are searched including itself
        `type` - element type of node to be searched
      Returns:
        content of resource if resource is found, else default value `false`.

"

The software JavaView? is copyright protected. All Rights Reserved.
"