Package org.apache.xmlbeans
Interface XmlFactoryHook
-
public interface XmlFactoryHook
A hook for the XML Bean Factory mechanism. Provided for advanced users who wish to provide their own implementation of the Factory.parse methods. This is used, for example, to defer reading XML streams until needed.To use the hook, call XmlFactoryHook.ThreadContext.setHook(), passing your own XmlFactoryHook implementation. Then every call to a Factory method will be delgated to your hook.
MyHook hook = new MyHook(); XmlFactoryHook.ThreadContext.setHook(hook); // this results in a call to hook.parse(...) XmlObject.Factory.parse(new File("test.xml"));
If the hook needs to turn around and invoke the built-in parsers, then it should do so by calling the appropriate method on the passed SchemaTypeLoader. Since SchemaTypeLoader.parse() methods delegate to the registered hook, a hook that wishes to actually invoke the default parser without having itself called back again should unregister itself before calling loader.parse(), and then re-register itself again after the call.void parse(SchemaTypeLoader loader, ...) { XmlFactoryHook remember = XmlFactoryHook.ThreadContext.getHook(); XmlFactoryHook.ThreadContext.setHook(null); loader.parse(...); // isn't hooked. XmlFactoryHook.ThreadContext.setHook(remember); }
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
XmlFactoryHook.ThreadContext
Used to manage the XmlFactoryHook for the current thread.
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description org.w3c.dom.DOMImplementation
newDomImplementation(SchemaTypeLoader loader, XmlOptions options)
Hooks Factory.newDomImplementation callsXmlObject
newInstance(SchemaTypeLoader loader, SchemaType type, XmlOptions options)
Hooks Factory.newInstance callsXmlSaxHandler
newXmlSaxHandler(SchemaTypeLoader loader, SchemaType type, XmlOptions options)
Hooks Factory.newXmlSaxHandler callsXmlObject
parse(SchemaTypeLoader loader, java.io.InputStream jiois, SchemaType type, XmlOptions options)
Hooks Factory.parse callsXmlObject
parse(SchemaTypeLoader loader, java.io.Reader jior, SchemaType type, XmlOptions options)
Hooks Factory.parse callsXmlObject
parse(SchemaTypeLoader loader, java.lang.String xmlText, SchemaType type, XmlOptions options)
Hooks Factory.parse callsXmlObject
parse(SchemaTypeLoader loader, javax.xml.stream.XMLStreamReader xsr, SchemaType type, XmlOptions options)
Hooks Factory.parse callsXmlObject
parse(SchemaTypeLoader loader, XMLInputStream xis, SchemaType type, XmlOptions options)
Deprecated.XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API.XmlObject
parse(SchemaTypeLoader loader, org.w3c.dom.Node node, SchemaType type, XmlOptions options)
Hooks Factory.parse calls
-
-
-
Method Detail
-
newInstance
XmlObject newInstance(SchemaTypeLoader loader, SchemaType type, XmlOptions options)
Hooks Factory.newInstance calls
-
parse
XmlObject parse(SchemaTypeLoader loader, java.lang.String xmlText, SchemaType type, XmlOptions options) throws XmlException
Hooks Factory.parse calls- Throws:
XmlException
-
parse
XmlObject parse(SchemaTypeLoader loader, java.io.InputStream jiois, SchemaType type, XmlOptions options) throws XmlException, java.io.IOException
Hooks Factory.parse calls- Throws:
XmlException
java.io.IOException
-
parse
XmlObject parse(SchemaTypeLoader loader, javax.xml.stream.XMLStreamReader xsr, SchemaType type, XmlOptions options) throws XmlException
Hooks Factory.parse calls- Throws:
XmlException
-
parse
XmlObject parse(SchemaTypeLoader loader, java.io.Reader jior, SchemaType type, XmlOptions options) throws XmlException, java.io.IOException
Hooks Factory.parse calls- Throws:
XmlException
java.io.IOException
-
parse
XmlObject parse(SchemaTypeLoader loader, org.w3c.dom.Node node, SchemaType type, XmlOptions options) throws XmlException
Hooks Factory.parse calls- Throws:
XmlException
-
parse
XmlObject parse(SchemaTypeLoader loader, XMLInputStream xis, SchemaType type, XmlOptions options) throws XmlException, XMLStreamException
Deprecated.XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API.Hooks Factory.parse calls- Throws:
XmlException
XMLStreamException
-
newXmlSaxHandler
XmlSaxHandler newXmlSaxHandler(SchemaTypeLoader loader, SchemaType type, XmlOptions options)
Hooks Factory.newXmlSaxHandler calls
-
newDomImplementation
org.w3c.dom.DOMImplementation newDomImplementation(SchemaTypeLoader loader, XmlOptions options)
Hooks Factory.newDomImplementation calls
-
-