public void validateName()

in mixins/om-mixins/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSourcedElementMixin.java [273:315]


    public void validateName(String staxPrefix, String staxLocalName, String staxNamespaceURI) {
        if (internalGetLocalName() == null) {
            // The local name was not known in advance; initialize it from the reader
            internalSetLocalName(staxLocalName);
        } else {
            // Make sure element local name and namespace matches what was expected
            if (!staxLocalName.equals(internalGetLocalName())) {
                throw new OMException(
                        "Element name from data source is "
                                + staxLocalName
                                + ", not the expected "
                                + internalGetLocalName());
            }
        }
        if (definedNamespaceSet) {
            if (staxNamespaceURI == null) {
                staxNamespaceURI = "";
            }
            String namespaceURI =
                    definedNamespace == null ? "" : definedNamespace.getNamespaceURI();
            if (!staxNamespaceURI.equals(namespaceURI)) {
                throw new OMException(
                        "Element namespace from data source is "
                                + staxNamespaceURI
                                + ", not the expected "
                                + namespaceURI);
            }
            if (!(definedNamespace instanceof DeferredNamespace)) {
                if (staxPrefix == null) {
                    staxPrefix = "";
                }
                String prefix = definedNamespace == null ? "" : definedNamespace.getPrefix();
                if (!staxPrefix.equals(prefix)) {
                    throw new OMException(
                            "Element prefix from data source is '"
                                    + staxPrefix
                                    + "', not the expected '"
                                    + prefix
                                    + "'");
                }
            }
        }
    }