Package org.eigenbase.xom

## Class XOMUtil

- java.lang.Object
- - org.eigenbase.xom.XMLUtil
  - - org.eigenbase.xom.XOMUtil

    public abstract class XOMUtil
    extends XMLUtil

Utility functions for the `org.eigenbase.xom` and `org.eigenbase.xom.wrappers` packages.

Since:
  3 October, 2001
Version:
  $Id: //open/util/resgen/src/org/eigenbase/xom/XOMUtil.java#5 $
Author:
  jhyde

### Field Summary

Fields
`(package private) static NodeDef[]` `emptyNodeArray`
`(package private) static int` `MSXML`
`(package private) static int` `XERCES`

### Constructor Summary

Constructors
`XOMUtil()`

### Method Summary

All Methods Static Methods Concrete Methods
`static void` `addChild​(ElementDef parent, ElementDef child)`
`static void` `addChild​(ElementDef parent, NodeDef child)`
`static void` `addChildren​(ElementDef parent, NodeDef[] children)` Adds a set of children to an object, using its best guess as to where to put them.
`static java.lang.Object[]` `addElement​(java.lang.Object[] a, java.lang.Object o)` Adds an object to the end of an array.
`(package private) static java.lang.String` `capitalize​(java.lang.String name)` Converts the first letter of `name` to upper-case.
`static java.lang.Object[]` `concatenate​(java.lang.Object[] a0, java.lang.Object[] a1)` Concatenates two arrays.
`static Parser` `createDefaultParser()` Creates a `Parser` of the default parser type.
`static void` `discard​(boolean b)` When the compiler is complaining that you are not using a variable, just call one of these routines with it.
`static void` `discard​(byte b)`
`static void` `discard​(char c)`
`static void` `discard​(double d)`
`static void` `discard​(float d)`
`static void` `discard​(int i)`
`static void` `discard​(long l)`
`static void` `discard​(short s)`
`static void` `discard​(java.lang.Object o)`
`static java.lang.Object` `getFirstInstance​(java.lang.Object[] a, java.lang.Class clazz)` Returns the first member of an array of objects which is an instance of a given class, or null if there is no such.
`(package private) static Parser` `makeParser​(int parserType, boolean usesPlugins, java.lang.String fileDirectory, java.lang.String dtdName, java.lang.String docType)` Creates a parser of given type.
`static java.lang.String` `wrapperToXml​(DOMWrapper wrapper, boolean ignorePcdata)`

### Methods inherited from class org.eigenbase.xom.XMLUtil

`getFirstTagName, printAtt, printAtt, printAtt, printAtt, printPCDATA, printPCDATA, printPCDATA, quoteAtt, quoteAtt, quoteAtt, quoteAtt, quotePCDATA, stringEncodeXML, stringHasXMLSpecials`

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

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

### Field Detail

#### emptyNodeArray

    static final NodeDef[] emptyNodeArray

#### MSXML

    static final int MSXML

See Also:
  `makeParser(int, boolean, java.lang.String, java.lang.String, java.lang.String)`, Constant Field Values

#### XERCES

    static final int XERCES

See Also:
  `makeParser(int, boolean, java.lang.String, java.lang.String, java.lang.String)`, Constant Field Values

### Constructor Detail

#### XOMUtil

    public XOMUtil()

### Method Detail

#### discard

    public static void discard​(boolean b)

When the compiler is complaining that you are not using a variable, just call one of these routines with it.

#### discard

    public static void discard​(byte b)

#### discard

    public static void discard​(char c)

#### discard

    public static void discard​(double d)

#### discard

    public static void discard​(float d)

#### discard

    public static void discard​(int i)

#### discard

    public static void discard​(long l)

#### discard

    public static void discard​(java.lang.Object o)

#### discard

    public static void discard​(short s)

#### capitalize

    static java.lang.String capitalize​(java.lang.String name)

Converts the first letter of `name` to upper-case.

#### addElement

    public static java.lang.Object[] addElement​(java.lang.Object[] a,
                                                java.lang.Object o)

Adds an object to the end of an array. The resulting array is of the same type (e.g. `String[]`) as the input array.

#### concatenate

    public static java.lang.Object[] concatenate​(java.lang.Object[] a0,
                                                 java.lang.Object[] a1)

Concatenates two arrays. The resulting array is of the same type (e.g. `String[]`) as the first array.

#### addChildren

    public static void addChildren​(ElementDef parent,
                                   NodeDef[] children)
                            throws XOMException

Adds a set of children to an object, using its best guess as to where to put them.

Throws:
  `XOMException`

#### addChild

    public static void addChild​(ElementDef parent,
                                ElementDef child)
                         throws XOMException

Throws:
  `XOMException`

#### addChild

    public static void addChild​(ElementDef parent,
                                NodeDef child)
                         throws XOMException

Throws:
  `XOMException`

#### createDefaultParser

    public static Parser createDefaultParser()
                                      throws XOMException

Creates a `Parser` of the default parser type.

Throws:
  `XOMException`

#### makeParser

    static Parser makeParser​(int parserType,
                             boolean usesPlugins,
                             java.lang.String fileDirectory,
                             java.lang.String dtdName,
                             java.lang.String docType)
                      throws XOMException

Creates a parser of given type.

Parameters:
  `parserType` - valid values are `MSXML` and `XERCES`.
Throws:
  `XOMException`

#### getFirstInstance

    public static java.lang.Object getFirstInstance​(java.lang.Object[] a,
                                                    java.lang.Class clazz)

Returns the first member of an array of objects which is an instance of a given class, or null if there is no such.

#### wrapperToXml

    public static java.lang.String wrapperToXml​(DOMWrapper wrapper,
                                                boolean ignorePcdata)