Class AbstractXMLObjectUnmarshaller

    • Field Detail

      • log

        @Nonnull
        private final org.slf4j.Logger log
        Class logger.
      • xmlObjectBuilderFactory

        @Nonnull
        private final XMLObjectBuilderFactory xmlObjectBuilderFactory
        Factory for XMLObjectBuilders.
      • unmarshallerFactory

        @Nonnull
        private final UnmarshallerFactory unmarshallerFactory
        Factory for creating unmarshallers for child elements.
    • Constructor Detail

      • AbstractXMLObjectUnmarshaller

        protected AbstractXMLObjectUnmarshaller()
        Constructor.
    • Method Detail

      • buildXMLObject

        @Nonnull
        protected XMLObject buildXMLObject​(@Nonnull
                                           Element domElement)
                                    throws UnmarshallingException
        Constructs the XMLObject that the given DOM Element will be unmarshalled into. If the DOM element has an XML Schema type defined this method will attempt to retrieve an XMLObjectBuilder, from the factory given at construction time, using the schema type. If no schema type is present or no builder is registered with the factory for the schema type, the elements QName is used. Once the builder is found the XMLObject is create by invoking XMLObjectBuilder.buildObject(String, String, String). Extending classes may wish to override this logic if more than just schema type or element name (e.g. element attributes or content) need to be used to determine which XMLObjectBuilder should be used to create the XMLObject.
        Parameters:
        domElement - the DOM Element the created XMLObject will represent
        Returns:
        the empty XMLObject that DOM Element can be unmarshalled into
        Throws:
        UnmarshallingException - thrown if there is now XMLObjectBuilder registered for the given DOM Element
      • unmarshallNamespaceAttribute

        protected void unmarshallNamespaceAttribute​(@Nonnull
                                                    XMLObject xmlObject,
                                                    @Nonnull
                                                    Attr attribute)
        Unmarshalls a namespace declaration attribute.
        Parameters:
        xmlObject - the xmlObject to receive the namespace declaration
        attribute - the namespace declaration attribute
      • unmarshallSchemaInstanceAttributes

        protected void unmarshallSchemaInstanceAttributes​(@Nonnull
                                                          XMLObject xmlObject,
                                                          @Nonnull
                                                          Attr attribute)
        Unmarshalls the XSI type, schemaLocation, and noNamespaceSchemaLocation attributes.
        Parameters:
        xmlObject - the xmlObject to recieve the namespace declaration
        attribute - the namespace declaration attribute
      • checkIDAttribute

        protected void checkIDAttribute​(@Nonnull
                                        Attr attribute)
        Check whether the attribute's QName is registered in the global ID attribute registry. If it is, and the specified attribute's DOM Level 3 Attr.isId() is false (due to lack of schema validation, for example), then declare the attribute as an ID type in the DOM on the attribute's owning element. This is to handle cases where the underlying DOM needs to accurately reflect an attribute's ID-ness, for example ID reference resolution within the Apache XML Security library.
        Parameters:
        attribute - the DOM attribute to be checked
      • processChildElement

        protected void processChildElement​(@Nonnull
                                           XMLObject parentXMLObject,
                                           @Nonnull
                                           XMLObject childXMLObject)
                                    throws UnmarshallingException
        Called after a child element has been unmarshalled so that it can be added to the parent XMLObject. The default implementation of this method is a no-op.
        Parameters:
        parentXMLObject - the parent XMLObject
        childXMLObject - the child XMLObject
        Throws:
        UnmarshallingException - thrown if there is a problem adding the child to the parent
      • processAttribute

        protected void processAttribute​(@Nonnull
                                        XMLObject xmlObject,
                                        @Nonnull
                                        Attr attribute)
                                 throws UnmarshallingException
        Called after an attribute has been unmarshalled so that it can be added to the XMLObject. The default implementation of this method is a no-op
        Parameters:
        xmlObject - the XMLObject
        attribute - the attribute
        Throws:
        UnmarshallingException - thrown if there is a problem adding the attribute to the XMLObject
      • processElementContent

        protected void processElementContent​(@Nonnull
                                             XMLObject xmlObject,
                                             @Nonnull
                                             String elementContent)
        Called if the element being unmarshalled contained textual content so that it can be added to the XMLObject. The default implementation of this method is a no-op
        Parameters:
        xmlObject - XMLObject the content will be given to
        elementContent - the Element's content
      • processUnknownAttribute

        protected void processUnknownAttribute​(@Nonnull
                                               AttributeExtensibleXMLObject xmlObject,
                                               @Nonnull
                                               Attr attribute)
        Called to store wildcard attributes, if the object supports that. It is expected that the object's unmarshaller will have checked and dealt with known attributes before calling this.
        Parameters:
        xmlObject - The object which support anyAttribute.
        attribute - The attribute in question.