Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.6.0)

E13403-07

oracle.ide.xml
Class XMLRecognizer

java.lang.Object
  extended by oracle.ide.model.Recognizer
      extended by oracle.ide.xml.XMLRecognizer

public final class XMLRecognizer
extends Recognizer

The XMLRecognizer is the default Recognizer implementation used in the IDE. It contains support for recognizing an XML document through a variety of mechanisms.


Method Summary
 Node create(java.net.URL url, java.lang.Class nodeType)
          This method creates a Node instance of the specified type with the specified URL.
static NodeInfo findNodeInfo(java.lang.Class dataClass)
          This method finds a NodeInfo instance that is associated with a particular data Class.
static XMLRecognizer getInstance()
           
static void mapDoctypeToClass(java.lang.String publicId, java.lang.String systemId, java.lang.Class cls)
          Maps the specified public ID and system ID (from the XML doctype) to the specified data class.
static void mapNamespaceElemToClass(java.lang.String namespaceURI, java.lang.String localElemName, java.lang.Class cls)
          Maps the specified namespace element (a combination of the XML namespace URI with local element name) to the specified data class.
static void mapRootElementToClass(java.lang.String rootElem, java.lang.Class cls)
          Maps the specified file extension to the specified data class.
static void mapSchemaInstanceToClass(java.lang.String schemaLocationURI, java.lang.String rootElemLocalName, java.lang.Class nodeType)
          Maps the specified schema location URI and root element's local name to the specified data class.
 java.lang.Class recognize(java.net.URL url)
          This method implements the fundamental responsibility of a Recognizer -- to map a URL to a Node type.
static void registerNodeInfo(NodeInfo info)
          Uses the specified NodeInfo to register recognizer behavior.
static void treatExtensionAsXML(java.lang.String extension)
          Registers the specified extension as one that corresponds to an XML file.
static void treatExtensionAsXML(java.lang.String extension, NodeInfoLoader loader)
          Registers the specified extension as one that corresponds to an XML file.
 java.net.URL validate(java.net.URL newURL, java.net.URL oldURL)
          Validate the specified new name.
 
Methods inherited from class oracle.ide.model.Recognizer
canConvert, findRecognizer, getClassForExtension, getContentTypeForExtension, getDefaultNodeType, getDefaultRecognizer, getDocumentInfo, getExtensionToClassMap, getExtensionToContentTypeMap, isXmlExtension, mapExtensionToClass, mapExtensionToContentType, mapExtensionToXML, recognizeURL, recognizeURL, registerConversion, registerDocumentInfo, registerLowPriorityRecognizer, registerRecognizer, registerRecognizer, sanitizeExtension, setDefaultRecognizer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static XMLRecognizer getInstance()

treatExtensionAsXML

public static void treatExtensionAsXML(java.lang.String extension)
Registers the specified extension as one that corresponds to an XML file. The XMLRecognizer only attempts to find a data class for an XML file if the URL for the file has an extension that is treated as XML.

The extension passed in is allowed to contain or omit the leading "."; if it is omitted, it will be added automatically.


treatExtensionAsXML

public static void treatExtensionAsXML(java.lang.String extension,
                                       NodeInfoLoader loader)
Registers the specified extension as one that corresponds to an XML file. The NodeInfoLoader will be used to trigger the lazy loading of NodeInfo objects if an URL with the specified extension is recognized by XMLRecognizer.

The loader can be null, which means that there is no NodeInfoLoader that needs to be invoked for the specified extension.


mapNamespaceElemToClass

public static void mapNamespaceElemToClass(java.lang.String namespaceURI,
                                           java.lang.String localElemName,
                                           java.lang.Class cls)
Maps the specified namespace element (a combination of the XML namespace URI with local element name) to the specified data class. This is the preferred recognition mechanism for objects that are marshalled by Object2Dom.


mapSchemaInstanceToClass

public static void mapSchemaInstanceToClass(java.lang.String schemaLocationURI,
                                            java.lang.String rootElemLocalName,
                                            java.lang.Class nodeType)
Maps the specified schema location URI and root element's local name to the specified data class. If the root element has a namespace, then the XMLRecognizer will search for a schema location URI associated with that namespace. Otherwise, the XMLRecognizer will look for an xsi:noNamespaceSchemaLocation attribute on the root element that identifies the schema location.


mapDoctypeToClass

public static void mapDoctypeToClass(java.lang.String publicId,
                                     java.lang.String systemId,
                                     java.lang.Class cls)
Maps the specified public ID and system ID (from the XML doctype) to the specified data class. One of public ID or system ID must be non-null; if both IDs are null, this method has no effect.


mapRootElementToClass

public static void mapRootElementToClass(java.lang.String rootElem,
                                         java.lang.Class cls)
Maps the specified file extension to the specified data class.

The specified extension is allowed to contain or omit the leading "."; if omitted, it will be added automatically.


registerNodeInfo

public static void registerNodeInfo(NodeInfo info)
Uses the specified NodeInfo to register recognizer behavior.

See Also:
NodeInfo

findNodeInfo

public static NodeInfo findNodeInfo(java.lang.Class dataClass)
This method finds a NodeInfo instance that is associated with a particular data Class.

Parameters:
dataClass - The data Class.
Returns:
the NodeInfo associated with the data class or null if no NodeInfo is found.

recognize

public java.lang.Class recognize(java.net.URL url)
Description copied from class: Recognizer
This method implements the fundamental responsibility of a Recognizer -- to map a URL to a Node type. Efficient implementation of this method is essential for the IDE's performance. In particular, I/O operations should be avoided or deferred as much as possible. If a Recognizer does not recognize a particular URL, this method must return null. The returned Class representing the Node type is later passed to the Recognizer.create(URL,Class) method which creates the Node instance.

Specified by:
recognize in class Recognizer
Parameters:
url - unique URL identifying the document.
Returns:
the Node type as a Class object.

create

public Node create(java.net.URL url,
                   java.lang.Class nodeType)
            throws java.lang.IllegalAccessException,
                   java.lang.InstantiationException
Description copied from class: Recognizer
This method creates a Node instance of the specified type with the specified URL. If the type is null, then the returned Node is also null.

Overrides:
create in class Recognizer
Parameters:
url - unique URL identifying the document.
nodeType - the type of the Node. The specified Class object must represent a type of Node, or else a ClassCastException will occur.
Returns:
The design-time Node.
Throws:
java.lang.IllegalAccessException
java.lang.InstantiationException

validate

public java.net.URL validate(java.net.URL newURL,
                             java.net.URL oldURL)
                      throws RecognizerException
Description copied from class: Recognizer
Validate the specified new name. Returns null if the name does not validate. This method may modify the URL to make it valid, such as adding a file extension. The old URL is used as the validation base. For example, if the new URL does not have the correct file extension, the old URL extension may be added to the new URL during the validation process.

Overrides:
validate in class Recognizer
Parameters:
newURL - the new URL to validate.
oldURL - the old URL used as the validation base.
Returns:
the validated URL or null if the name does not validate.
Throws:
RecognizerException - if validation fails. The reason why validation failed is in the exception's message. The message should be suitably formatted so that it can be displayed to the user.

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.6.0)

E13403-07

Copyright © 1997, 2011, Oracle. All rights reserved.