| Method from org.apache.xmlbeans.XmlBeans Detail: |
public static String compilePath(String pathExpr) throws XmlException {
return compilePath( pathExpr, null );
}
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) throws XmlException {
return getContextTypeLoader().compilePath( pathExpr, 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.
The default is "this", as in "$this". |
public static String compileQuery(String queryExpr) throws XmlException {
return compileQuery( queryExpr, null );
}
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) throws XmlException {
return getContextTypeLoader().compileQuery( queryExpr, 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 compileXmlBeans(String name,
SchemaTypeSystem system,
XmlObject[] schemas,
BindingConfig config,
SchemaTypeLoader typepath,
Filer filer,
XmlOptions options) throws XmlException {
try
{
return (SchemaTypeSystem)_compilationMethod.invoke(null, new Object[] { name, system, schemas, config, typepath != null ? typepath : getContextTypeLoader(), filer, options });
}
catch (IllegalAccessException e)
{
throw new IllegalStateException("No access to SchemaTypeLoaderImpl.forSchemaXml(): verify that version of xbean.jar is correct");
}
catch (InvocationTargetException e)
{
throw wrappedException(e.getCause());
}
}
Returns the SchemaTypeSystem that results from augumenting the
SchemaTypeSystem passed in by incrementally adding the given XML
schema definitions.
These could be new definitions (if the Schema document is not recorded into
the existing SchemaTypeSystem), modifications to the already existing
definitions (if the Schema document is already recorded in the existing
SchemaTypeSystem), or deletions (if the Schema document is already recorded
in the existing SchemaTypeSystem and the new definitions are empty).
The identity of documents is established using
XmlDocumentProperties#getSourceName , so if the caller choses to
construct the Schema definitions using other methods than parsing an
XML document, they should make sure that the names returned by that
method are consistent with the caller's intent (add/modify).
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 name argument is used to name the compiled schema type system.
A randomly generated name will be used if the name is null.
The optional BindingConfig argument is used to control the shape
of the generated code. A BindingConfig isn't used if Filer
is null.
The optional SchemaTypeLoader argument will be
consulted for already-compiled schema types which may be linked
while processing the given schemas. If not specified, the context
typeloader (as returned by #getContextTypeLoader ) will be used.
The optional Filer argument is used to create new binary or source
files which are the product of the compilation. If the Filer is null, the
schema binaries (.xsb) files and source files won't be generated.
The SchemaTypeSystem that is returned should be combined
(via #typeLoaderUnion ) 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:
|
public static SchemaTypeSystem compileXsd(XmlObject[] schemas,
SchemaTypeLoader typepath,
XmlOptions options) throws XmlException {
return compileXmlBeans(null, null, schemas, null, typepath, null, options);
}
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 #typeLoaderUnion ) 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:
|
public static SchemaTypeSystem compileXsd(SchemaTypeSystem system,
XmlObject[] schemas,
SchemaTypeLoader typepath,
XmlOptions options) throws XmlException {
return compileXmlBeans(null, system, schemas, null, typepath, null, options);
}
Returns the SchemaTypeSystem that results from augumenting the
SchemaTypeSystem passed in by incrementally adding the given XML
schema definitions.
These could be new definitions (if the Schema document is not recorded into
the existing SchemaTypeSystem), modifications to the already existing
definitions (if the Schema document is already recorded in the existing
SchemaTypeSystem), or deletions (if the Schema document is already recorded
in the existing SchemaTypeSystem and the new definitions are empty).
The identity of documents is established using
XmlDocumentProperties#getSourceName , so if the caller choses to
construct the Schema definitions using other methods than parsing an
XML document, they should make sure that the names returned by that
method are consistent with the caller's intent (add/modify).
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 #typeLoaderUnion ) 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:
|
public static SchemaTypeSystem getBuiltinTypeSystem() {
try
{
return (SchemaTypeSystem)_getBuiltinSchemaTypeSystemMethod.invoke(null, null);
}
catch (IllegalAccessException e)
{
throw causedException(new IllegalStateException("No access to BuiltinSchemaTypeSystem.get(): verify that version of xbean.jar is correct"), e);
}
catch (InvocationTargetException e)
{
Throwable t = e.getCause();
IllegalStateException ise = new IllegalStateException(t.getMessage());
ise.initCause(t); // use initCause() to support Java 1.4
throw ise;
}
}
Returns the builtin type system. This SchemaTypeSystem contains
only the 46 builtin types defined by the XML Schema specification. |
public static SchemaTypeLoader getContextTypeLoader() {
try
{
return (SchemaTypeLoader)_getContextTypeLoaderMethod.invoke(null, null);
}
catch (IllegalAccessException e)
{
throw causedException(new IllegalStateException("No access to SchemaTypeLoaderImpl.getContextTypeLoader(): verify that version of xbean.jar is correct"), e);
}
catch (InvocationTargetException e)
{
Throwable t = e.getCause();
IllegalStateException ise = new IllegalStateException(t.getMessage());
ise.initCause(t); // use initCause() to support Java 1.4
throw ise;
}
}
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. |
public static QName getQName(String localPart) {
return getQNameCache().getName( "", localPart );
}
Obtains a name from the thread local QNameCache |
public static QName getQName(String namespaceUri,
String localPart) {
return getQNameCache().getName( namespaceUri, localPart );
}
Obtains a name from the thread local QNameCache |
public static QNameCache getQNameCache() {
SoftReference softRef = (SoftReference)_threadLocalLoaderQNameCache.get();
QNameCache qnameCache = (QNameCache) (softRef).get();
if (qnameCache==null)
{
qnameCache = new QNameCache( 32 );
_threadLocalLoaderQNameCache.set(new SoftReference(qnameCache));
}
return qnameCache;
}
Returns a thread local QNameCache |
public static final String getTitle() {
Package pkg = XmlBeans.class.getPackage();
if (pkg != null)
{
XMLBEANS_TITLE = pkg.getImplementationTitle();
XMLBEANS_VERSION = pkg.getImplementationVersion();
XMLBEANS_VENDOR = pkg.getImplementationVendor();
}
return XMLBEANS_TITLE;
}
|
public static final String getVendor() {
return XMLBEANS_VENDOR;
}
|
public static final String getVersion() {
return XMLBEANS_VERSION;
}
|
public static SchemaTypeLoader loadXsd(XmlObject[] schemas) throws XmlException {
return loadXsd(schemas, null);
}
Returns the SchemaTypeSystem that results from compiling the XML
schema definitions passed.
Just like compileXsd, but uses the context type loader for
linking, and returns a unioned typeloader that is suitable for
creating instances. |
public static SchemaTypeLoader loadXsd(XmlObject[] schemas,
XmlOptions options) throws XmlException {
try
{
SchemaTypeSystem sts =
(SchemaTypeSystem)
_compilationMethod.invoke(
null, new Object[] { null, null, schemas, null, getContextTypeLoader(), null, options });
if (sts == null)
return null;
return
typeLoaderUnion(
new SchemaTypeLoader[] { sts, getContextTypeLoader() } );
}
catch (IllegalAccessException e)
{
throw causedException(new IllegalStateException("No access to SchemaTypeLoaderImpl.forSchemaXml(): verify that version of xbean.jar is correct"), e);
}
catch (InvocationTargetException e)
{
throw wrappedException(e.getCause());
}
}
Returns the SchemaTypeSystem that results from compiling the XML
schema definitions passed in schemas.
This is just like compileXsd, 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:
|
public static XmlCursor nodeToCursor(Node n) {
try
{
return (XmlCursor) _nodeToCursorMethod.invoke( null, new Object[] { n } );
}
catch ( IllegalAccessException e )
{
throw causedException(
new IllegalStateException(
"No access to nodeToCursor verify that version of xbean.jar is correct" ), e );
}
catch ( InvocationTargetException e )
{
Throwable t = e.getCause();
IllegalStateException ise = new IllegalStateException(t.getMessage());
ise.initCause(t); // use initCause() to support Java 1.4
throw ise;
}
}
Creates an XmlCursor for a DOM node which is implemented by XmlBwans |
public static XmlObject nodeToXmlObject(Node n) {
try
{
return (XmlObject) _nodeToXmlObjectMethod.invoke( null, new Object[] { n } );
}
catch ( IllegalAccessException e )
{
throw causedException(
new IllegalStateException(
"No access to nodeToXmlObject verify that version of xbean.jar is correct" ), e );
}
catch ( InvocationTargetException e )
{
Throwable t = e.getCause();
IllegalStateException ise = new IllegalStateException(t.getMessage());
ise.initCause(t); // use initCause() to support Java 1.4
throw ise;
}
}
Creates an XmlObject for a DOM node which is implemented by XmlBwans |
public static XMLStreamReader nodeToXmlStreamReader(Node n) {
try
{
return (XMLStreamReader) _nodeToXmlStreamMethod.invoke( null, new Object[] { n } );
}
catch ( IllegalAccessException e )
{
throw causedException(
new IllegalStateException(
"No access to nodeToXmlStreamReader verify that version of xbean.jar is correct" ), e );
}
catch ( InvocationTargetException e )
{
Throwable t = e.getCause();
IllegalStateException ise = new IllegalStateException(t.getMessage());
ise.initCause(t); // use initCause() to support Java 1.4
throw ise;
}
}
Creates an XmlObject for a DOM node which is implemented by XmlBwans |
public static ResourceLoader resourceLoaderForPath(File[] path) {
try
{
return (ResourceLoader)_pathResourceLoaderConstructor.newInstance(new Object[] {path});
}
catch (IllegalAccessException e)
{
throw causedException(new IllegalStateException("No access to SchemaTypeLoaderImpl: verify that version of xbean.jar is correct"), e);
}
catch (InstantiationException e)
{
throw causedException(new IllegalStateException(e.getMessage()), e);
}
catch (InvocationTargetException e)
{
Throwable t = e.getCause();
IllegalStateException ise = new IllegalStateException(t.getMessage());
ise.initCause(t); // use initCause() to support Java 1.4
throw ise;
}
}
Returns a new ResourceLoader for a search path where each component of
the path is either a directory or a compiled xbean jar. |
public static Node streamToNode(XMLStreamReader xs) {
try
{
return (Node) _streamToNodeMethod.invoke( null, new Object[] { xs } );
}
catch ( IllegalAccessException e )
{
throw causedException(
new IllegalStateException(
"No access to streamToNode verify that version of xbean.jar is correct" ), e );
}
catch ( InvocationTargetException e )
{
Throwable t = e.getCause();
IllegalStateException ise = new IllegalStateException(t.getMessage());
ise.initCause(t); // use initCause() to support Java 1.4
throw ise;
}
}
Returns the XmlObject for a DOM node which is implemented by XmlBwans |
public static SchemaType typeForClass(Class c) {
if (c == null || !XmlObject.class.isAssignableFrom(c))
return null;
try
{
Field typeField = c.getField("type");
if (typeField == null)
return null;
return (SchemaType)typeField.get(null);
}
catch (Exception e)
{
return null;
}
}
Returns the SchemaType from a corresponding XmlObject subclass,
or null if none. |
public static SchemaTypeLoader typeLoaderForClassLoader(ClassLoader loader) {
try
{
return (SchemaTypeLoader)_typeLoaderBuilderMethod.invoke(null, new Object[] {null, null, loader});
}
catch (IllegalAccessException e)
{
throw causedException(new IllegalStateException("No access to SchemaTypeLoaderImpl: verify that version of xbean.jar is correct"), e);
}
catch (InvocationTargetException e)
{
Throwable t = e.getCause();
IllegalStateException ise = new IllegalStateException(t.getMessage());
ise.initCause(t); // use initCause() to support Java 1.4
throw ise;
}
}
Returns a SchemaTypeLoader that searches for compiled schema types
in the given ClassLoader. |
public static SchemaTypeLoader typeLoaderForResource(ResourceLoader resourceLoader) {
try
{
return (SchemaTypeLoader)_typeLoaderBuilderMethod.invoke(null, new Object[] {null, resourceLoader, null});
}
catch (IllegalAccessException e)
{
throw causedException(new IllegalStateException("No access to SchemaTypeLoaderImpl: verify that version of xbean.jar is correct"), e);
}
catch (InvocationTargetException e)
{
Throwable t = e.getCause();
IllegalStateException ise = new IllegalStateException(t.getMessage());
ise.initCause(t); // use initCause() to support Java 1.4
throw ise;
}
}
Returns a SchemaTypeLoader that searches for compiled schema types
in the given ResourceLoader. |
public static SchemaTypeLoader typeLoaderUnion(SchemaTypeLoader[] typeLoaders) {
try
{
if (typeLoaders.length == 1)
return typeLoaders[0];
return (SchemaTypeLoader)_typeLoaderBuilderMethod.invoke(null, new Object[] {typeLoaders, null, null});
}
catch (IllegalAccessException e)
{
throw causedException(new IllegalStateException("No access to SchemaTypeLoaderImpl: verify that version of xbean.jar is correct"), e);
}
catch (InvocationTargetException e)
{
Throwable t = e.getCause();
IllegalStateException ise = new IllegalStateException(t.getMessage());
ise.initCause(t); // use initCause() to support Java 1.4
throw ise;
}
}
Returns the union of a list of typeLoaders. The returned
SchemaTypeLoader searches the given list of SchemaTypeLoaders
in order from first to last. |
public static SchemaTypeSystem typeSystemForClassLoader(ClassLoader loader,
String stsName) {
try
{
Class clazz = loader.loadClass(stsName + "." + HOLDER_CLASS_NAME);
SchemaTypeSystem sts = (SchemaTypeSystem)
(clazz.getDeclaredField(TYPE_SYSTEM_FIELD).get(null));
if (sts == null)
{
throw new RuntimeException("SchemaTypeSystem is null for field " +
TYPE_SYSTEM_FIELD + " on class with name " + stsName +
"." + HOLDER_CLASS_NAME +
". Please verify the version of xbean.jar is correct.");
}
return sts;
}
catch (ClassNotFoundException e)
{
throw causedException(new RuntimeException("Cannot load SchemaTypeSystem. " +
"Unable to load class with name " + stsName + "." + HOLDER_CLASS_NAME +
". Make sure the generated binary files are on the classpath."), e);
}
catch (NoSuchFieldException e)
{
throw causedException(new RuntimeException("Cannot find field " +
TYPE_SYSTEM_FIELD + " on class " + stsName + "." + HOLDER_CLASS_NAME +
". Please verify the version of xbean.jar is correct."), e);
}
catch (IllegalAccessException e)
{
throw causedException(new RuntimeException("Field " +
TYPE_SYSTEM_FIELD + " on class " + stsName + "." + HOLDER_CLASS_NAME +
"is not accessible. Please verify the version of xbean.jar is correct."), e);
}
}
|