org.drools.xml
Class ExtensibleXmlParser

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.drools.xml.ExtensibleXmlParser
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class ExtensibleXmlParser
extends DefaultHandler

RuleSet loader. Note you can override the default entity resolver by setting the System property of: org.drools.io.EntityResolve to your own custom entity resolver. This can be done using -Dorg.drools.io.EntityResolver=YourClassHere on the command line, for instance.


Nested Class Summary
static class ExtensibleXmlParser.Null
           
 
Field Summary
static String ENTITY_RESOLVER_PROPERTY_NAME
           
static String RULES_NAMESPACE_URI
          Namespace URI for the general tags.
 
Constructor Summary
ExtensibleXmlParser()
          Construct.
ExtensibleXmlParser(SAXParser parser)
          Construct.
 
Method Summary
 void characters(char[] chars, int start, int len)
           
 void endElement(String uri, String localName, String qname)
           
 Element endElementBuilder()
          End a configuration node.
 void endPrefixMapping(String prefix)
           
 void error(SAXParseException x)
           
 void fatalError(SAXParseException x)
           
 ClassLoader getClassLoader()
           
 Object getCurrent()
           
 Object getData()
           
 Locator getLocator()
          Get the Locator.
 Map getMetaData()
           
 Object getParent()
           
 Object getParent(Class parent)
           
 Object getParent(int index)
           
 LinkedList getParents()
           
 Object getPeer()
           
 int getTimeout()
          Timeout for retrieving remote resources
 Object read(InputSource in)
          Read a RuleSet from an InputSource.
 Object read(InputStream inputStream)
          Read a RuleSet from an InputStream.
 Object read(Reader reader)
          Read a RuleSet from a Reader.
 Object removeParent()
           
 InputSource resolveEntity(String publicId, String systemId)
           
 void setClassLoader(ClassLoader classLoader)
           
 void setData(Object data)
           
 void setDocumentLocator(Locator locator)
           
 void setSemanticModules(SemanticModules modules)
           
 void setTimeout(int timeout)
          Sets the timeout for retrieving remote resources, e.g. xsd schemas
 void startDocument()
           
 void startElement(String uri, String localName, String qname, Attributes attrs)
           
 void startElementBuilder(String tagName, Attributes attrs)
          Start a configuration node.
 void startPrefixMapping(String prefix, String uri)
           
 void warning(SAXParseException x)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, ignorableWhitespace, notationDecl, processingInstruction, skippedEntity, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENTITY_RESOLVER_PROPERTY_NAME

public static final String ENTITY_RESOLVER_PROPERTY_NAME
See Also:
Constant Field Values

RULES_NAMESPACE_URI

public static final String RULES_NAMESPACE_URI
Namespace URI for the general tags.

See Also:
Constant Field Values
Constructor Detail

ExtensibleXmlParser

public ExtensibleXmlParser()
Construct.

Uses the default JAXP SAX parser and the default classpath-based DefaultSemanticModule.


ExtensibleXmlParser

public ExtensibleXmlParser(SAXParser parser)
Construct.

Uses the default classpath-based DefaultSemanticModule.

Parameters:
parser - The SAX parser.
Method Detail

setSemanticModules

public void setSemanticModules(SemanticModules modules)

read

public Object read(Reader reader)
            throws SAXException,
                   IOException
Read a RuleSet from a Reader.

Parameters:
reader - The reader containing the rule-set.
Returns:
The rule-set.
Throws:
ParserConfigurationException
SAXException
IOException

read

public Object read(InputStream inputStream)
            throws SAXException,
                   IOException
Read a RuleSet from an InputStream.

Parameters:
inputStream - The input-stream containing the rule-set.
Returns:
The rule-set.
Throws:
ParserConfigurationException
SAXException
IOException

read

public Object read(InputSource in)
            throws SAXException,
                   IOException
Read a RuleSet from an InputSource.

Parameters:
in - The rule-set input-source.
Returns:
The rule-set.
Throws:
ParserConfigurationException
SAXException
IOException

setData

public void setData(Object data)

getData

public Object getData()

getClassLoader

public ClassLoader getClassLoader()

setClassLoader

public void setClassLoader(ClassLoader classLoader)

getMetaData

public Map getMetaData()

setDocumentLocator

public void setDocumentLocator(Locator locator)
Specified by:
setDocumentLocator in interface ContentHandler
Overrides:
setDocumentLocator in class DefaultHandler
See Also:
ContentHandler

getLocator

public Locator getLocator()
Get the Locator.

Returns:
The locator.

startDocument

public void startDocument()
Specified by:
startDocument in interface ContentHandler
Overrides:
startDocument in class DefaultHandler

startElement

public void startElement(String uri,
                         String localName,
                         String qname,
                         Attributes attrs)
                  throws SAXException
Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class DefaultHandler
Parameters:
uri -
localName -
qname -
attrs -
Throws:
SAXException
See Also:
ContentHandler

endElement

public void endElement(String uri,
                       String localName,
                       String qname)
                throws SAXException
Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class DefaultHandler
Parameters:
uri -
localName -
qname -
Throws:
SAXException
See Also:
ContentHandler

startElementBuilder

public void startElementBuilder(String tagName,
                                Attributes attrs)
Start a configuration node.

Parameters:
tagName - Tag name.
attrs - Tag attributes.

characters

public void characters(char[] chars,
                       int start,
                       int len)
Specified by:
characters in interface ContentHandler
Overrides:
characters in class DefaultHandler
Parameters:
chars -
start -
len -
See Also:
ContentHandler

endElementBuilder

public Element endElementBuilder()
End a configuration node.

Returns:
The configuration.

getParent

public Object getParent()

getParent

public Object getParent(int index)

removeParent

public Object removeParent()

getParents

public LinkedList getParents()

getParent

public Object getParent(Class parent)

getPeer

public Object getPeer()

getCurrent

public Object getCurrent()

resolveEntity

public InputSource resolveEntity(String publicId,
                                 String systemId)
                          throws SAXException
Specified by:
resolveEntity in interface EntityResolver
Overrides:
resolveEntity in class DefaultHandler
Throws:
SAXException

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
                        throws SAXException
Specified by:
startPrefixMapping in interface ContentHandler
Overrides:
startPrefixMapping in class DefaultHandler
Throws:
SAXException

endPrefixMapping

public void endPrefixMapping(String prefix)
                      throws SAXException
Specified by:
endPrefixMapping in interface ContentHandler
Overrides:
endPrefixMapping in class DefaultHandler
Throws:
SAXException

warning

public void warning(SAXParseException x)
Specified by:
warning in interface ErrorHandler
Overrides:
warning in class DefaultHandler

error

public void error(SAXParseException x)
Specified by:
error in interface ErrorHandler
Overrides:
error in class DefaultHandler

fatalError

public void fatalError(SAXParseException x)
                throws SAXParseException
Specified by:
fatalError in interface ErrorHandler
Overrides:
fatalError in class DefaultHandler
Throws:
SAXParseException

getTimeout

public int getTimeout()
Timeout for retrieving remote resources

Returns:

setTimeout

public void setTimeout(int timeout)
Sets the timeout for retrieving remote resources, e.g. xsd schemas

Parameters:
timeout -


Copyright © 2001-2012 JBoss by Red Hat. All Rights Reserved.