# com.bea.xml
XmlBeans Class

public final class XmlBeans
extends `Object`

Provides an assortment of utilities for managing XML Bean types, type systems, QNames, paths, and queries.

Hierarchy
  `Object`
  `XmlBeans`

## Field Summary

`public static `SchemaType`` | `NO_TYPE` The SchemaType object given to an XmlObject instance when no type can be determined.

## Method Summary

`public static `String`` | `compilePath`(`String` pathExpr) Compiles an XPath, returning a String equal to that which was passed, but whose identity is that of one which has been precompiled and cached.
`public static `String`` | `compilePath`(`String` pathExpr, `XmlOptions` options) Compiles an XPath, returning a String equal to that which was passed, but whose identity is that of one which has been precompiled and cached; takes an option for specifying text that indicates the name of context node.
`public static `String`` | `compileQuery`(`String` queryExpr) Compiles an XQuery, returning a String equal to that which was passed, but whose identity is that of one which has been precompiled and cached.
`public static `String`` | `compileQuery`(`String` queryExpr, `XmlOptions` options) Compiles an XQuery, returning a String equal to that which was passed, but whose identity is that of one which has been precompiled and cached; takes an option for specifying text that indicates the context node.
`public static `SchemaTypeSystem`` | `compileXsd`(`XmlObject`[] schemas, `SchemaTypeLoader` typepath, `XmlOptions` options) Returns the SchemaTypeSystem that results from compiling the XML schema definitions passed.
`public static `SchemaTypeSystem`` | `getBuiltinTypeSystem`() Returns the builtin type system.
`public static `SchemaTypeLoader`` | `getContextTypeLoader`() Gets the SchemaTypeLoader based on the current thread's context ClassLoader.
`public static `QName`` | `getQName`(`String` localPart) Obtains a name from the thread local QNameCache
`public static `QName`` | `getQName`(`String` namespaceUri, `String` localPart) Obtains a name from the thread local QNameCache
`public static `QNameCache`` | `getQNameCache`() Returns a thread local QNameCache
`public static `SchemaTypeLoader`` | `loadXsd`(`XmlObject`[] schemas) Returns the SchemaTypeSystem that results from compiling the XML schema definitions passed.
`public static `SchemaTypeLoader`` | `loadXsd`(`XmlObject`[] schemas, `XmlOptions` options) Returns the SchemaTypeSystem that results from compiling the XML schema definitions passed in schemas.
`public static `SchemaType`` | `typeForClass`(`Class` c) Returns the SchemaType from a corresponding XmlObject subclass, or null if none.
`public static `SchemaTypeLoader`` | `typeLoaderForClassLoader`(`ClassLoader` loader) Returns a SchemaTypeLoader that searches for compiled schema types in the given ClassLoader.
`public static `SchemaTypeLoader`` | `typeLoaderUnion`(`SchemaTypeLoader`[] typeLoaders) Returns the union of a list of typeLoaders.

Methods from class `java.lang.`Object``
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Detail

### NO_TYPE

    public static SchemaType NO_TYPE

  The SchemaType object given to an XmlObject instance when no type can be determined.

  The NO_TYPE is the universal derived type. That is, it is derived from all other schema types, and no instances of the NO_TYPE are valid. (It is not to be confused with the anyType, which is the universal base type from which all other types can be derived, and of which all instances are valid.)

## Method Detail

### compilePath(String) Method

    public static String compilePath(String pathExpr)
         throws XmlException

Compiles an XPath, returning a String equal to that which was passed, but whose identity is that of one which has been precompiled and cached.

#### Exceptions

``XmlException``

### compilePath(String, XmlOptions) Method

    public static String compilePath(String pathExpr,
                                     XmlOptions options)
         throws XmlException

Compiles an XPath, returning a String equal to that which was passed, but whose identity is that of one which has been precompiled and cached; takes an option for specifying text that indicates the name of context node. The default is "this", as in "$this".

#### Parameters

pathExpr
  Options for the path. For example, you can call the `XmlOptions.setXqueryCurrentNodeVar(String)``` method to specify a particular name for the expression variable that indicates the context node.

#### Exceptions

``XmlException``

### compileQuery(String) Method

    public static String compileQuery(String queryExpr)
         throws XmlException

Compiles an XQuery, returning a String equal to that which was passed, but whose identity is that of one which has been precompiled and cached.

#### Exceptions

``XmlException``

### compileQuery(String, XmlOptions) Method

    public static String compileQuery(String queryExpr,
                                      XmlOptions options)
         throws XmlException

Compiles an XQuery, returning a String equal to that which was passed, but whose identity is that of one which has been precompiled and cached; takes an option for specifying text that indicates the context node.

#### Parameters

queryExpr
  Options for the query. For example, you can call the `XmlOptions.setXqueryCurrentNodeVar(String)``` method to specify a particular name for the expression variable that indicates the context node and the `XmlOptions.setXqueryVariables(Map)``` method to map external variable names to values.

#### Exceptions

``XmlException``

### compileXsd(XmlObject[], SchemaTypeLoader, XmlOptions) Method

    public static SchemaTypeSystem compileXsd(XmlObject[] schemas,
                                              SchemaTypeLoader typepath,
                                              XmlOptions options)
         throws XmlException

Returns the SchemaTypeSystem that results from compiling the XML schema definitions passed.

The XmlObjects passed in should be w3c <schema> elements whose type is org.w3c.x2001.xmlSchema.Schema. (That is, schema elements in the XML namespace http://www.w3c.org/2001/XMLSchema.) Also org.w3c.x2001.xmlSchema.SchemaDocument is permitted.

The optional second argument is a SchemaTypeLoader which will be consulted for already-compiled schema types which may be linked while processing the given schemas.

The SchemaTypeSystem that is returned should be combined (via `XmlBeans.typeLoaderUnion(SchemaTypeLoader[])```) with the typepath typeloader in order to create a typeloader that can be used for creating and validating instances.

Use the options parameter to specify the following:

- A collection instance that should be used as an error listener during compilation, as described in `XmlOptions.setErrorListener(Collection)```.
- Whether validation should not be done when building the SchemaTypeSystem, as described in `XmlOptions.setCompileNoValidation()```.

#### Parameters

schemas
  The schema definitions from which to build the schema type system.

typepath
  The path to already-compiled schema types for linking while processing.

options
  Options specifying an error listener and/or validation behavior.

#### Exceptions

``XmlException``

### getBuiltinTypeSystem() Method

    public static SchemaTypeSystem getBuiltinTypeSystem()

Returns the builtin type system. This SchemaTypeSystem contains only the 46 builtin types defined by the XML Schema specification.

### getContextTypeLoader() Method

    public static SchemaTypeLoader getContextTypeLoader()

Gets the SchemaTypeLoader based on the current thread's context ClassLoader. This is the SchemaTypeLoader that is used to assign schema types to XML documents by default. The SchemaTypeLoader is also consulted to resolve wildcards and xsi:type attributes.

The "parse" methods of XmlBeans all delegate to the "parseInstance" methods of the context type loader.

### getQName(String) Method

    public static QName getQName(String localPart)

Obtains a name from the thread local QNameCache

### getQName(String, String) Method

    public static QName getQName(String namespaceUri,
                                 String localPart)

Obtains a name from the thread local QNameCache

### getQNameCache() Method

    public static QNameCache getQNameCache()

Returns a thread local QNameCache

### loadXsd(XmlObject[]) Method

    public static SchemaTypeLoader loadXsd(XmlObject[] schemas)
         throws XmlException

Returns the SchemaTypeSystem that results from compiling the XML schema definitions passed.

Just like compileTypeSystem, but uses the context type loader for linking, and returns a unioned typeloader that is suitable for creating instances.

#### Exceptions

``XmlException``

### loadXsd(XmlObject[], XmlOptions) Method

    public static SchemaTypeLoader loadXsd(XmlObject[] schemas,
                                           XmlOptions options)
         throws XmlException

Returns the SchemaTypeSystem that results from compiling the XML schema definitions passed in schemas.

This is just like compileTypeSystem, but uses the context type loader for linking, and returns a unioned typeloader that is suitable for creating instances.

Use the options parameter to specify one or both of the following:

- A collection instance that should be used as an error listener during compilation, as described in `XmlOptions.setErrorListener(Collection)```.
- Whether validation should not be done when building the SchemaTypeSystem, as described in `XmlOptions.setCompileNoValidation()```.

#### Parameters

schemas
  The schema definitions from which to build the schema type system.

options
  Options specifying an error listener and/or validation behavior.

#### Exceptions

``XmlException``

### typeForClass(Class) Method

    public static SchemaType typeForClass(Class c)

Returns the SchemaType from a corresponding XmlObject subclass, or null if none.

### typeLoaderForClassLoader(ClassLoader) Method

    public static SchemaTypeLoader typeLoaderForClassLoader(ClassLoader loader)

Returns a SchemaTypeLoader that searches for compiled schema types in the given ClassLoader.

### typeLoaderUnion(SchemaTypeLoader[]) Method

    public static SchemaTypeLoader typeLoaderUnion(SchemaTypeLoader[] typeLoaders)

Returns the union of a list of typeLoaders. The returned SchemaTypeLoader searches the given list of SchemaTypeLoaders in order from first to last.