Class StructureLoader
- java.lang.Object
-
- com.sun.xml.bind.v2.runtime.unmarshaller.Loader
-
- com.sun.xml.bind.v2.runtime.unmarshaller.StructureLoader
-
public final class StructureLoader extends Loader
Loads children of an element.This loader works with a single
JaxBeanInfo
and handles attributes, child elements, or child text.- Author:
- Kohsuke Kawaguchi
-
-
Field Summary
-
Fields inherited from class com.sun.xml.bind.v2.runtime.unmarshaller.Loader
expectText
-
-
Constructor Summary
Constructors Constructor Description StructureLoader(ClassBeanInfoImpl beanInfo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
childElement(UnmarshallingContext.State state, TagName arg)
Called when this loaderis an active loaderand we see a new child start tag.JaxBeanInfo
getBeanInfo()
java.util.Collection<javax.xml.namespace.QName>
getExpectedAttributes()
Returns a set of tag names expected as possible child elements in this context.java.util.Collection<javax.xml.namespace.QName>
getExpectedChildElements()
Returns a set of tag names expected as possible child elements in this context.void
init(JAXBContextImpl context, ClassBeanInfoImpl beanInfo, Accessor<?,java.util.Map<javax.xml.namespace.QName,java.lang.String>> attWildcard)
Completes the initialization.void
leaveElement(UnmarshallingContext.State state, TagName ea)
Called when this loaderis an active loaderand we see an end tag.void
startElement(UnmarshallingContext.State state, TagName ea)
Called when the loader is activated, which is when a new start tag is seen and when the parent designated this loader as the child loader.void
text(UnmarshallingContext.State state, java.lang.CharSequence text)
Called when this loaderis an active loaderand we see a chunk of text.-
Methods inherited from class com.sun.xml.bind.v2.runtime.unmarshaller.Loader
expectText, fireAfterUnmarshal, fireBeforeUnmarshal, handleGenericError, handleGenericException, handleGenericException, handleParseConversionException, reportError, reportError, reportUnexpectedChildElement
-
-
-
-
Constructor Detail
-
StructureLoader
public StructureLoader(ClassBeanInfoImpl beanInfo)
-
-
Method Detail
-
init
public void init(JAXBContextImpl context, ClassBeanInfoImpl beanInfo, Accessor<?,java.util.Map<javax.xml.namespace.QName,java.lang.String>> attWildcard)
Completes the initialization.To fix the cyclic reference issue, the main part of the initialization needs to be done after a
StructureLoader
is set toClassBeanInfoImpl.loader
.
-
startElement
public void startElement(UnmarshallingContext.State state, TagName ea) throws org.xml.sax.SAXException
Description copied from class:Loader
Called when the loader is activated, which is when a new start tag is seen and when the parent designated this loader as the child loader.The callee may change
state.loader
to designate anotherLoader
for the processing. It's the responsibility of the callee to forward the startElement event in such a case.- Overrides:
startElement
in classLoader
ea
- info about the start tag. never null.- Throws:
org.xml.sax.SAXException
-
childElement
public void childElement(UnmarshallingContext.State state, TagName arg) throws org.xml.sax.SAXException
Description copied from class:Loader
Called when this loaderis an active loaderand we see a new child start tag.The callee is expected to designate another loaderas a loaderthat processes this element, then it should also register a
Receiver
. The designated loaderwill become an active loader.The default implementation reports an error saying an element is unexpected.
- Overrides:
childElement
in classLoader
- Throws:
org.xml.sax.SAXException
-
getExpectedChildElements
public java.util.Collection<javax.xml.namespace.QName> getExpectedChildElements()
Description copied from class:Loader
Returns a set of tag names expected as possible child elements in this context.- Overrides:
getExpectedChildElements
in classLoader
-
getExpectedAttributes
public java.util.Collection<javax.xml.namespace.QName> getExpectedAttributes()
Description copied from class:Loader
Returns a set of tag names expected as possible child elements in this context.- Overrides:
getExpectedAttributes
in classLoader
-
text
public void text(UnmarshallingContext.State state, java.lang.CharSequence text) throws org.xml.sax.SAXException
Description copied from class:Loader
Called when this loaderis an active loaderand we see a chunk of text. The runtime makes sure that adjacent characters (even those separated by comments, PIs, etc) are reported as one event. IOW, you won't see two text event calls in a row.
-
leaveElement
public void leaveElement(UnmarshallingContext.State state, TagName ea) throws org.xml.sax.SAXException
Description copied from class:Loader
Called when this loaderis an active loaderand we see an end tag.- Overrides:
leaveElement
in classLoader
- Throws:
org.xml.sax.SAXException
-
getBeanInfo
public JaxBeanInfo getBeanInfo()
-
-