/** * Constructor ElementProxy * * @param doc */ public ElementProxy(Document doc) { if (doc == null) { throw new RuntimeException("Document is null"); } this.wrappedDoc = doc; this.wrappedElement = createElementForFamilyLocal(this.getBaseNamespace(), this.getBaseLocalName()); }
/** * Method guaranteeThatElementInCorrectSpace * * @throws XMLSecurityException */ void guaranteeThatElementInCorrectSpace() throws XMLSecurityException { String expectedLocalName = this.getBaseLocalName(); String expectedNamespaceUri = this.getBaseNamespace(); String actualLocalName = getElement().getLocalName(); String actualNamespaceUri = getElement().getNamespaceURI(); if(!expectedNamespaceUri.equals(actualNamespaceUri) && !expectedLocalName.equals(actualLocalName)) { Object exArgs[] = { actualNamespaceUri + ":" + actualLocalName, expectedNamespaceUri + ":" + expectedLocalName}; throw new XMLSecurityException("xml.WrongElement", exArgs); } }