org.apache.myfaces.trinidadinternal.share.xml
Class XMLUtils

java.lang.Object
  extended by org.apache.myfaces.trinidadinternal.share.xml.XMLUtils

public class XMLUtils
extends java.lang.Object

Utility class for XML parsing.

Version:
$Name: $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/share/xml/XMLUtils.java#0 $) $Date: 10-nov-2005.18:59:17 $
Author:
The Oracle ADF Faces Team

Method Summary
static InputStreamProvider getInputStreamProvider(ParseContext context)
          Gets the InputStreamProvider stored on the ParseContext.
static java.lang.Object getLocalProperty(ParseContext context, java.lang.String namespace, java.lang.Object key)
          Gets a "local" ParseContext property.
static NameResolver getResolver(ParseContext context)
          Gets the NameResolver stored on the ParseContext.
static XMLProvider getXMLProvider(Configuration config)
          Convenience object for getting an XML provider off a Configuration object.
static java.lang.Object parseInclude(ParseContext context, java.lang.String sourceName, java.lang.Class<?> expectedType)
          Parses an include of an XML file.
static java.lang.String[] parseNameTokens(java.lang.String stringValue)
          Parses a whitespace separated series of name tokens.
static java.lang.Object parseSource(ParseContext context, XMLProvider xmlProvider, ParserManager manager, NameResolver resolver, java.lang.String sourceName, java.lang.Class<?> expectedType)
          Parses an XML file.
static void registerFunctions(ParserManager manager, java.lang.String namespace, java.lang.Class<?> klass)
          add the methods of a class to the list of available EL functions.
static void setInputStreamProvider(ParseContext context, InputStreamProvider provider)
          Stores a InputStreamProvider on a ParseContext.
static void setLocalProperty(ParseContext context, java.lang.String namespace, java.lang.Object key, java.lang.Object value)
          Sets a "local" ParseContext property.
static void setResolver(ParseContext context, NameResolver source)
          Stores a NameResolver on a ParseContext.
static void setXMLProvider(ConfigurationImpl config, java.lang.String providerClassName)
          Convenience function for setting an XML provider on a configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

parseSource

public static java.lang.Object parseSource(ParseContext context,
                                           XMLProvider xmlProvider,
                                           ParserManager manager,
                                           NameResolver resolver,
                                           java.lang.String sourceName,
                                           java.lang.Class<?> expectedType)
                                    throws java.io.IOException,
                                           org.xml.sax.SAXException
Parses an XML file. For includes, see parseInclude().

Parameters:
context - the current ParseContext, which will be cloned
xmlProvider - an XML provider
manager - a ParserManager
resolver - a NameResolver to locate the target
sourceName - the name of the target, relative to the current file
expectedType - the expected Java type of the target.
Throws:
java.io.IOException
org.xml.sax.SAXException

parseInclude

public static java.lang.Object parseInclude(ParseContext context,
                                            java.lang.String sourceName,
                                            java.lang.Class<?> expectedType)
                                     throws java.io.IOException,
                                            org.xml.sax.SAXException
Parses an include of an XML file. The include will be located using an already-stored NameResolver object.

Parameters:
context - the current ParseContext, which will be cloned
sourceName - the name of the target, relative to the current file
expectedType - the expected Java type of the target.
Throws:
java.io.IOException
org.xml.sax.SAXException
See Also:
getResolver(org.apache.myfaces.trinidadinternal.share.xml.ParseContext), setResolver(org.apache.myfaces.trinidadinternal.share.xml.ParseContext, org.apache.myfaces.trinidadinternal.share.io.NameResolver)

getResolver

public static NameResolver getResolver(ParseContext context)
Gets the NameResolver stored on the ParseContext.


setResolver

public static void setResolver(ParseContext context,
                               NameResolver source)
Stores a NameResolver on a ParseContext.


getInputStreamProvider

public static InputStreamProvider getInputStreamProvider(ParseContext context)
Gets the InputStreamProvider stored on the ParseContext.


setInputStreamProvider

public static void setInputStreamProvider(ParseContext context,
                                          InputStreamProvider provider)
Stores a InputStreamProvider on a ParseContext.


setXMLProvider

public static void setXMLProvider(ConfigurationImpl config,
                                  java.lang.String providerClassName)
Convenience function for setting an XML provider on a configuration.


setLocalProperty

public static void setLocalProperty(ParseContext context,
                                    java.lang.String namespace,
                                    java.lang.Object key,
                                    java.lang.Object value)
Sets a "local" ParseContext property. ParseContext properties set with the standard setProperty() method will still be available in included files, and if set inside an included file will be available to the parent file. Local properties are available to this document only.

See Also:
getLocalProperty(org.apache.myfaces.trinidadinternal.share.xml.ParseContext, java.lang.String, java.lang.Object)

getLocalProperty

public static java.lang.Object getLocalProperty(ParseContext context,
                                                java.lang.String namespace,
                                                java.lang.Object key)
Gets a "local" ParseContext property. ParseContext properties set with the standard setProperty() method will still be available in included files, and if set inside an included file will be available to the parent file. Local properties are available to this document only.

See Also:
setLocalProperty(org.apache.myfaces.trinidadinternal.share.xml.ParseContext, java.lang.String, java.lang.Object, java.lang.Object)

getXMLProvider

public static XMLProvider getXMLProvider(Configuration config)
Convenience object for getting an XML provider off a Configuration object.

Parameters:
config - the configuration object
log - an (optional) error log
Returns:
an XMLProvider implementation

parseNameTokens

public static java.lang.String[] parseNameTokens(java.lang.String stringValue)
Parses a whitespace separated series of name tokens.

Parameters:
stringValue - the full string
Returns:
an array of each constituent value, or null if there are no tokens (that is, the string is empty or all whitespace)

registerFunctions

public static void registerFunctions(ParserManager manager,
                                     java.lang.String namespace,
                                     java.lang.Class<?> klass)
add the methods of a class to the list of available EL functions.

Parameters:
namespace - the namespace to register the methods under
klass - only the public static methods declared on this class are inspected


Copyright © 2001-2007 Apache Software Foundation. All Rights Reserved.