jv.loader

## Class PsXmlLoader

- java.lang.Object
- - jv.loader.PsXmlLoader

-     public final class PsXmlLoader
      extends java.lang.Object

  Loader for Xml files fills a tree structure.
  Author:
    Konrad Polthier
  Version:
    26.05.08, 2.20 revised (kp) In parse(), parsing of xml-tag changed since first line may not be terminated by newline.
    14.12.04, 2.10 revised (kp) Parsing of multiline attributes implemented.
    13.08.03, 2.00 revised (kp) Parsing of enclosed `<![CDATA[ .... ]]>` blocks implemented.
    13.08.03, 1.80 revised (kp) Return value added to methods which create a new subnode.
    10.02.03, 1.70 revised (kp) Blanks in element content now a word character, speed ups.
    20.05.01, 1.60 revised (kp) Two methods parseLabelAtt and parseFunList moved to PgJvxLoader.
    09.01.01, 1.50 revised (kp) Methods to write PsXmlSrc and PsXmlNode moved to individual classes.
    07.01.01, 1.20 revised (kp) Method writeNode made public.
    16.04.00, 1.10 revised (kp) All methods made static.
    16.01.00, 1.00 created (kp)

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PsXmlLoader()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static PsXmlNode` | `addColor(PsXmlNode parentNode, java.lang.String colorLabel, java.awt.Color color)` Create a new node containing the given argument color.
    `static PsXmlNode` | `addColor(PsXmlNode parentNode, java.lang.String typeLabel, java.lang.String colorLabel, java.awt.Color color)` Create a new node with a child node containing the given argument color.
    `static PsXmlNode` | `addMatrix(PsXmlNode parentNode, java.lang.String type, PdMatrix matrix)` Write matrix whose element type is passed as argument.
    `static PsXmlNode` | `addVector(PsXmlNode parentNode, java.lang.String type, PdVector vector, boolean bAttr)` Create a new node with the content of the given argument vector.
    `static PsXmlNode` | `addVector(PsXmlNode parentNode, java.lang.String type, PiVector vector, boolean bAttr)` Create a new node with the content of the given argument vector.
    `static void` | `addVectorList(PsXmlNode parentNode, java.lang.String type, java.awt.Color[] vector, int length)`
    `static void` | `addVectorList(PsXmlNode parentNode, java.lang.String type, PdVector[][] vector, int length)`
    `static void` | `addVectorList(PsXmlNode parentNode, java.lang.String type, PdVector[] vector, int length)`
    `static void` | `addVectorList(PsXmlNode parentNode, java.lang.String type, PdVector vector, int length)`
    `static void` | `addVectorList(PsXmlNode parentNode, java.lang.String type, PiVector[] vector, int length)`
    `static java.awt.Color` | `parseColorContent(PsXmlNode p)` Parse a PsXmlNode whose content consists of rgb color components.
    `static java.awt.Color[]` | `parseColorList(PsXmlNode parentNode, java.lang.String type)` Parse an array of PsXmlNodes of same element type, where each element has data consisting of a blank separated list of integers.
    `static java.awt.Color` | `parseColorRGB(PsXmlNode parentNode, java.lang.String type)` Parse a PsXmlNode whose child has a set of rgb color components.
    `static PdVector[]` | `parseDoubleList(PsXmlNode parentNode, java.lang.String type, java.lang.String[] attr)` Parse an array of PsXmlNodes of same element type, where each element has data consisting of a blank separated list of doubles.
    `static PiVector[]` | `parseIntegerList(PsXmlNode parentNode, java.lang.String type, java.lang.String[] attr)` Parse an array of PsXmlNodes of same element type, where each element has data consisting of a blank separated list of integers.
    `static PdMatrix` | `parsePdMatrix(PsXmlNode parentNode, java.lang.String type)` Parse a double matrix from a blank separated string of doubles.
    `static PdVector` | `parsePdVector(PsXmlNode p, java.lang.String[] attr)` Parse element content consisting of blank separated list of doubles.
    `static PdVector` | `parsePdVector(PsXmlNode parentNode, java.lang.String type, java.lang.String[] attr)` Parse a PsXmlNode whose child has a set of double values.
    `static PdVector` | `parsePdVector(java.lang.String string)` Parse a double vector from a blank separated string of doubles.
    `static PiVector` | `parsePiVector(PsXmlNode p, java.lang.String[] attr)` Parse element content consisting of a blank separated list of integers.
    `static PiVector` | `parsePiVector(PsXmlNode parentNode, java.lang.String type, java.lang.String[] attr)` Parse a PsXmlNode whose child has a set of integer values.
    `static PiVector` | `parsePiVector(java.lang.String string)` Parse an integer vector from a blank separated string of integers.
    `static void` | `parseVectorAttr(P_Vector vec, PsXmlNode p, java.lang.String[] attr)` Parse vector attributes of PdVector and PiVector.
    `static PsXmlSrc` | `read(java.io.BufferedReader in)` Read XML file and fill a new PsXmlSrc class.
    `static PsXmlSrc` | `read(java.lang.String fileName)` Read XML file and fill a new PsXmlSrc class.

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

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

- - ### Constructor Detail

    - #### PsXmlLoader

          public PsXmlLoader()

  - ### Method Detail

    - #### read

          public static PsXmlSrc read(java.lang.String fileName)

      Read XML file and fill a new PsXmlSrc class. Stream is closed after parsing the data.
      Parameters:
        `fileName` - File or URL to read data from.
      Author:
        Konrad Polthier
      Version:
        12.12.00, 1.00 revised (kp)
        12.12.00, 1.00 created (kp)

    - #### read

          public static PsXmlSrc read(java.io.BufferedReader in)

      Read XML file and fill a new PsXmlSrc class.
      Parameters:
        `in` - BufferedReader to read textual data from.
      Author:
        Konrad Polthier
      Version:
        16.04.00, 1.10 revised (kp) Return type changed from PsXmlNode to PsXmlsrc.
        16.01.00, 1.00 created (kp)

    - #### parseDoubleList

          public static PdVector[] parseDoubleList(PsXmlNode parentNode,
                                                   java.lang.String type,
                                                   java.lang.String[] attr)

      Parse an array of PsXmlNodes of same element type, where each element has data consisting of a blank separated list of doubles.
      Parameters:
        `parentNode` - parent node containing a set of PdVector nodes as children
        `type` - type of elements in array
        `attr` - array of attributes the vector might have, may be null.
      Returns:
        parsed vector array, or null if failed

    - #### parsePdVector

          public static PdVector parsePdVector(PsXmlNode parentNode,
                                               java.lang.String type,
                                               java.lang.String[] attr)

      Parse a PsXmlNode whose child has a set of double values.
      Parameters:
        `parentNode` - node whose child has a set of double values.
      Returns:
        parsed vector, or null if failed
      Version:
        04.11.00, 1.00 created (kp)

    - #### parsePdVector

          public static PdVector parsePdVector(PsXmlNode p,
                                               java.lang.String[] attr)

      Parse element content consisting of blank separated list of doubles.
      Parameters:
        `p` - node whose content is a list of double values.
        `attr` - array of attributes the vector might have, may be null.
      Returns:
        parsed vector, or null if failed
      Version:
        04.11.00, 1.10 revised (kp) Argument 'type' removed.

    - #### parseVectorAttr

          public static void parseVectorAttr(P_Vector vec,
                                             PsXmlNode p,
                                             java.lang.String[] attr)

      Parse vector attributes of PdVector and PiVector.
      Parameters:
        `vec` - vector whose attributes will be set.
        `p` - node with attribute values.
        `attr` - array of attribute keys the node might have, may be null.
      Version:
        09.12.00, 1.10 revised (kp)
        09.12.00, 1.00 created (kp) Extracted from two other methods.

    - #### parsePdVector

          public static PdVector parsePdVector(java.lang.String string)

      Parse a double vector from a blank separated string of doubles.
      Parameters:
        `string` - string with double components
      Returns:
        vector with components, vector has length zero if no doubles available.
      Version:
        30.05.03, 1.50 revised (kp) Allow vectors of length zero.
        08.11.00, 1.00 created (kp)

    - #### parsePdMatrix

          public static PdMatrix parsePdMatrix(PsXmlNode parentNode,
                                               java.lang.String type)

      Parse a double matrix from a blank separated string of doubles.
      Parameters:
        `parentNode` - parent node containing a matrix.
        `type` - type of the matrix element in parent node.
      Returns:
        PdMatrix instance with double components, `null` if no doubles available.
      Version:
        06.03.02, 1.00 created (kp)

    - #### parsePiVector

          public static PiVector parsePiVector(java.lang.String string)

      Parse an integer vector from a blank separated string of integers.
      Parameters:
        `string` - string with integer components
      Returns:
        vector with components, vector has length zero if no doubles available.
      Version:
        30.05.03, 1.50 revised (kp) Allow vectors of length zero.
        08.11.00, 1.00 created (kp)

    - #### parseIntegerList

          public static PiVector[] parseIntegerList(PsXmlNode parentNode,
                                                    java.lang.String type,
                                                    java.lang.String[] attr)

      Parse an array of PsXmlNodes of same element type, where each element has data consisting of a blank separated list of integers.
      Parameters:
        `parentNode` - parent node containing a set of PiVector nodes as children
        `type` - type of elements in array
        `attr` - array of attributes the vector might have, may be null.
      Returns:
        parsed vector array, or null if failed
      Version:
        04.11.00, 1.10 revised (kp) Method body replaced with call to parsePiVector().

    - #### parsePiVector

          public static PiVector parsePiVector(PsXmlNode parentNode,
                                               java.lang.String type,
                                               java.lang.String[] attr)

      Parse a PsXmlNode whose child has a set of integer values.
      Parameters:
        `parentNode` - node whose child has a set of integer values.
      Returns:
        parsed vector, or null if failed
      Version:
        04.11.00, 1.00 created (kp)

    - #### parsePiVector

          public static PiVector parsePiVector(PsXmlNode p,
                                               java.lang.String[] attr)

      Parse element content consisting of a blank separated list of integers.
      Parameters:
        `p` - node whose content is a set of integer values.
        `attr` - array of attributes the vector might have, may be null.
      Returns:
        parsed vector, or null if failed
      Version:
        04.11.00, 1.10 revised (kp) Argument 'type' removed.

    - #### parseColorList

          public static java.awt.Color[] parseColorList(PsXmlNode parentNode,
                                                        java.lang.String type)

      Parse an array of PsXmlNodes of same element type, where each element has data consisting of a blank separated list of integers.
      Parameters:
        `parentNode` - parent node containing a set of color nodes as children
        `type` - type of elements in array
      Returns:
        parsed color array, or null if failed

    - #### parseColorRGB

          public static java.awt.Color parseColorRGB(PsXmlNode parentNode,
                                                     java.lang.String type)

      Parse a PsXmlNode whose child has a set of rgb color components.
      Parameters:
        `parentNode` - node whose child has a set of rgb colors values.
      Returns:
        parsed color, or null if failed
      Version:
        04.11.00, 1.00 created (kp)

    - #### parseColorContent

          public static java.awt.Color parseColorContent(PsXmlNode p)

      Parse a PsXmlNode whose content consists of rgb color components.
      Parameters:
        `p` - node whose content is a set of rgb colors values.
      Returns:
        parsed color, or null if failed
      Version:
        04.11.00, 1.10 revised (kp) Argument 'type' removed.

    - #### addMatrix

          public static PsXmlNode addMatrix(PsXmlNode parentNode,
                                            java.lang.String type,
                                            PdMatrix matrix)

      Write matrix whose element type is passed as argument. Matrix components are converted to non-exponential form.
      Returns:
        child node if created.
      Version:
        13.08.03, 1.10 revised (kp) Return child node.
        06.03.02, 1.00 created (kp)

    - #### addVectorList

          public static void addVectorList(PsXmlNode parentNode,
                                           java.lang.String type,
                                           PdVector vector,
                                           int length)

      Since:
        JavaView 2.43
      Version:
        17.10.02, 1.00 revised (kp)
        17.10.02, 1.00 created (kp)

    - #### addVectorList

          public static void addVectorList(PsXmlNode parentNode,
                                           java.lang.String type,
                                           PdVector[] vector,
                                           int length)

      Version:
        15.10.00, 1.20 revised (kp) Method moved from PgJvxSrc to this class.
        09.07.00, 1.10 revised (kp) Print length of list as informal attribute.

    - #### addVectorList

          public static void addVectorList(PsXmlNode parentNode,
                                           java.lang.String type,
                                           PiVector[] vector,
                                           int length)

      Version:
        15.10.00, 1.20 revised (kp) Method moved from PgJvxSrc to this class.
        09.07.00, 1.10 revised (kp) Print length of list as informal attribute.

    - #### addVector

          public static PsXmlNode addVector(PsXmlNode parentNode,
                                            java.lang.String type,
                                            PdVector vector,
                                            boolean bAttr)

      Create a new node with the content of the given argument vector.
      Returns:
        child node if created.
      Version:
        13.08.03, 1.10 revised (kp) Return child node.
        15.10.00, 1.00 created (kp)

    - #### addVector

          public static PsXmlNode addVector(PsXmlNode parentNode,
                                            java.lang.String type,
                                            PiVector vector,
                                            boolean bAttr)

      Create a new node with the content of the given argument vector.
      Returns:
        child node if created.
      Version:
        13.08.03, 1.10 revised (kp) Return child node.
        15.10.00, 1.00 created (kp)

    - #### addVectorList

          public static void addVectorList(PsXmlNode parentNode,
                                           java.lang.String type,
                                           PdVector[][] vector,
                                           int length)

      Version:
        16.12.00, 1.20 revised (kp) New parameter length specifies size of used entries in vector.
        09.07.00, 1.10 revised (kp) Print length of list as informal attribute.

    - #### addVectorList

          public static void addVectorList(PsXmlNode parentNode,
                                           java.lang.String type,
                                           java.awt.Color[] vector,
                                           int length)

      Version:
        09.07.00, 1.10 revised (kp) Print length of list as informal attribute.

    - #### addColor

          public static PsXmlNode addColor(PsXmlNode parentNode,
                                           java.lang.String typeLabel,
                                           java.lang.String colorLabel,
                                           java.awt.Color color)

      Create a new node with a child node containing the given argument color.
      Parameters:
        `parentNode` - existing parent node
        `typeLabel` - element type of the node
        `colorLabel` - element type of the child node containing the color
        `color` - color to be written to the child node.
      Returns:
        new node containing the color node

    - #### addColor

          public static PsXmlNode addColor(PsXmlNode parentNode,
                                           java.lang.String colorLabel,
                                           java.awt.Color color)

      Create a new node containing the given argument color.
      Parameters:
        `parentNode` - existing parent node
        `colorLabel` - element type of the new color node
        `color` - color to be written to the child node.
      Returns:
        new color node

"

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