Java Code Examples for com.sun.org.apache.xml.internal.security.utils.ElementProxy#createElementForFamily()

The following examples show how to use com.sun.org.apache.xml.internal.security.utils.ElementProxy#createElementForFamily() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XMLCipher.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @return the XML Element form of that Reference
 */
public Element toElement() {
    String tagName = getType();
    Element result =
        ElementProxy.createElementForFamily(
            contextDocument,
            EncryptionConstants.EncryptionSpecNS,
            tagName
        );
    result.setAttribute(EncryptionConstants._ATT_URI, uri);

    // TODO: Need to martial referenceInformation
    // Figure out how to make this work..
    // <any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>

    return result;
}
 
Example 2
Source File: XMLCipher.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @return the XML Element form of that Reference
 */
public Element toElement() {
    String tagName = getType();
    Element result =
        ElementProxy.createElementForFamily(
            contextDocument,
            EncryptionConstants.EncryptionSpecNS,
            tagName
        );
    result.setAttribute(EncryptionConstants._ATT_URI, uri);

    // TODO: Need to martial referenceInformation
    // Figure out how to make this work..
    // <any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>

    return result;
}
 
Example 3
Source File: XMLCipher.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @return the XML Element form of that Reference
 */
public Element toElement() {
    String tagName = getType();
    Element result =
        ElementProxy.createElementForFamily(
            contextDocument,
            EncryptionConstants.EncryptionSpecNS,
            tagName
        );
    result.setAttribute(EncryptionConstants._ATT_URI, uri);

    // TODO: Need to martial referenceInformation
    // Figure out how to make this work..
    // <any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>

    return result;
}
 
Example 4
Source File: XMLCipher.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @return the XML Element form of that Reference
 */
public Element toElement() {
    String tagName = getType();
    Element result =
        ElementProxy.createElementForFamily(
            contextDocument,
            EncryptionConstants.EncryptionSpecNS,
            tagName
        );
    result.setAttribute(EncryptionConstants._ATT_URI, uri);

    // TODO: Need to martial referenceInformation
    // Figure out how to make this work..
    // <any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>

    return result;
}
 
Example 5
Source File: XMLCipher.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
Element toElement() {
    Element result =
        ElementProxy.createElementForFamily(
            contextDocument, EncryptionConstants.EncryptionSpecNS,
            EncryptionConstants._TAG_ENCRYPTEDDATA
        );

    if (null != super.getId()) {
        result.setAttributeNS(null, EncryptionConstants._ATT_ID, super.getId());
    }
    if (null != super.getType()) {
        result.setAttributeNS(null, EncryptionConstants._ATT_TYPE, super.getType());
    }
    if (null != super.getMimeType()) {
        result.setAttributeNS(
            null, EncryptionConstants._ATT_MIMETYPE, super.getMimeType()
        );
    }
    if (null != super.getEncoding()) {
        result.setAttributeNS(
            null, EncryptionConstants._ATT_ENCODING, super.getEncoding()
        );
    }
    if (null != super.getEncryptionMethod()) {
        result.appendChild(
            ((EncryptionMethodImpl)super.getEncryptionMethod()).toElement()
        );
    }
    if (null != super.getKeyInfo()) {
        result.appendChild(super.getKeyInfo().getElement().cloneNode(true));
    }

    result.appendChild(((CipherDataImpl) super.getCipherData()).toElement());
    if (null != super.getEncryptionProperties()) {
        result.appendChild(((EncryptionPropertiesImpl)
            super.getEncryptionProperties()).toElement());
    }

    return result;
}
 
Example 6
Source File: XMLCipher.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
Element toElement() {
    Element result =
        ElementProxy.createElementForFamily(
            contextDocument,
            EncryptionConstants.EncryptionSpecNS,
            EncryptionConstants._TAG_REFERENCELIST
        );
    Iterator<Reference> eachReference = references.iterator();
    while (eachReference.hasNext()) {
        Reference reference = eachReference.next();
        result.appendChild(((ReferenceImpl) reference).toElement());
    }
    return result;
}
 
Example 7
Source File: XMLCipher.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
Element toElement() {
    Element result =
        ElementProxy.createElementForFamily(
            contextDocument, EncryptionConstants.EncryptionSpecNS,
            EncryptionConstants._TAG_ENCRYPTEDDATA
        );

    if (null != super.getId()) {
        result.setAttributeNS(null, EncryptionConstants._ATT_ID, super.getId());
    }
    if (null != super.getType()) {
        result.setAttributeNS(null, EncryptionConstants._ATT_TYPE, super.getType());
    }
    if (null != super.getMimeType()) {
        result.setAttributeNS(
            null, EncryptionConstants._ATT_MIMETYPE, super.getMimeType()
        );
    }
    if (null != super.getEncoding()) {
        result.setAttributeNS(
            null, EncryptionConstants._ATT_ENCODING, super.getEncoding()
        );
    }
    if (null != super.getEncryptionMethod()) {
        result.appendChild(
            ((EncryptionMethodImpl)super.getEncryptionMethod()).toElement()
        );
    }
    if (null != super.getKeyInfo()) {
        result.appendChild(super.getKeyInfo().getElement().cloneNode(true));
    }

    result.appendChild(((CipherDataImpl) super.getCipherData()).toElement());
    if (null != super.getEncryptionProperties()) {
        result.appendChild(((EncryptionPropertiesImpl)
            super.getEncryptionProperties()).toElement());
    }

    return result;
}
 
Example 8
Source File: XMLCipher.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
Element toElement() {
    Element result =
        ElementProxy.createElementForFamily(
            contextDocument, EncryptionConstants.EncryptionSpecNS,
            EncryptionConstants._TAG_ENCRYPTEDDATA
        );

    if (null != super.getId()) {
        result.setAttributeNS(null, EncryptionConstants._ATT_ID, super.getId());
    }
    if (null != super.getType()) {
        result.setAttributeNS(null, EncryptionConstants._ATT_TYPE, super.getType());
    }
    if (null != super.getMimeType()) {
        result.setAttributeNS(
            null, EncryptionConstants._ATT_MIMETYPE, super.getMimeType()
        );
    }
    if (null != super.getEncoding()) {
        result.setAttributeNS(
            null, EncryptionConstants._ATT_ENCODING, super.getEncoding()
        );
    }
    if (null != super.getEncryptionMethod()) {
        result.appendChild(
            ((EncryptionMethodImpl)super.getEncryptionMethod()).toElement()
        );
    }
    if (null != super.getKeyInfo()) {
        result.appendChild(super.getKeyInfo().getElement().cloneNode(true));
    }

    result.appendChild(((CipherDataImpl) super.getCipherData()).toElement());
    if (null != super.getEncryptionProperties()) {
        result.appendChild(((EncryptionPropertiesImpl)
            super.getEncryptionProperties()).toElement());
    }

    return result;
}
 
Example 9
Source File: XMLCipher.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
Element toElement() {
    Element result =
        ElementProxy.createElementForFamily(
            contextDocument, EncryptionConstants.EncryptionSpecNS,
            EncryptionConstants._TAG_ENCRYPTEDDATA
        );

    if (null != super.getId()) {
        result.setAttributeNS(null, EncryptionConstants._ATT_ID, super.getId());
    }
    if (null != super.getType()) {
        result.setAttributeNS(null, EncryptionConstants._ATT_TYPE, super.getType());
    }
    if (null != super.getMimeType()) {
        result.setAttributeNS(
            null, EncryptionConstants._ATT_MIMETYPE, super.getMimeType()
        );
    }
    if (null != super.getEncoding()) {
        result.setAttributeNS(
            null, EncryptionConstants._ATT_ENCODING, super.getEncoding()
        );
    }
    if (null != super.getEncryptionMethod()) {
        result.appendChild(
            ((EncryptionMethodImpl)super.getEncryptionMethod()).toElement()
        );
    }
    if (null != super.getKeyInfo()) {
        result.appendChild(super.getKeyInfo().getElement().cloneNode(true));
    }

    result.appendChild(((CipherDataImpl) super.getCipherData()).toElement());
    if (null != super.getEncryptionProperties()) {
        result.appendChild(((EncryptionPropertiesImpl)
            super.getEncryptionProperties()).toElement());
    }

    return result;
}
 
Example 10
Source File: XMLCipher.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
Element toElement() {
    Element result =
        ElementProxy.createElementForFamily(
            contextDocument,
            EncryptionConstants.EncryptionSpecNS,
            EncryptionConstants._TAG_REFERENCELIST
        );
    Iterator<Reference> eachReference = references.iterator();
    while (eachReference.hasNext()) {
        Reference reference = eachReference.next();
        result.appendChild(((ReferenceImpl) reference).toElement());
    }
    return result;
}
 
Example 11
Source File: XMLCipher.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
Element toElement() {
    Element result =
        ElementProxy.createElementForFamily(
            contextDocument, EncryptionConstants.EncryptionSpecNS,
            EncryptionConstants._TAG_ENCRYPTEDDATA
        );

    if (null != super.getId()) {
        result.setAttributeNS(null, EncryptionConstants._ATT_ID, super.getId());
    }
    if (null != super.getType()) {
        result.setAttributeNS(null, EncryptionConstants._ATT_TYPE, super.getType());
    }
    if (null != super.getMimeType()) {
        result.setAttributeNS(
            null, EncryptionConstants._ATT_MIMETYPE, super.getMimeType()
        );
    }
    if (null != super.getEncoding()) {
        result.setAttributeNS(
            null, EncryptionConstants._ATT_ENCODING, super.getEncoding()
        );
    }
    if (null != super.getEncryptionMethod()) {
        result.appendChild(
            ((EncryptionMethodImpl)super.getEncryptionMethod()).toElement()
        );
    }
    if (null != super.getKeyInfo()) {
        result.appendChild(super.getKeyInfo().getElement().cloneNode(true));
    }

    result.appendChild(((CipherDataImpl) super.getCipherData()).toElement());
    if (null != super.getEncryptionProperties()) {
        result.appendChild(((EncryptionPropertiesImpl)
            super.getEncryptionProperties()).toElement());
    }

    return result;
}
 
Example 12
Source File: XMLCipher.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
Element toElement() {
    Element result =
        ElementProxy.createElementForFamily(
            contextDocument,
            EncryptionConstants.EncryptionSpecNS,
            EncryptionConstants._TAG_REFERENCELIST
        );
    Iterator<Reference> eachReference = references.iterator();
    while (eachReference.hasNext()) {
        Reference reference = eachReference.next();
        result.appendChild(((ReferenceImpl) reference).toElement());
    }
    return result;
}
 
Example 13
Source File: XMLCipher.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
Element toElement() {
    Element result =
        ElementProxy.createElementForFamily(
            contextDocument, EncryptionConstants.EncryptionSpecNS,
            EncryptionConstants._TAG_ENCRYPTEDDATA
        );

    if (null != super.getId()) {
        result.setAttributeNS(null, EncryptionConstants._ATT_ID, super.getId());
    }
    if (null != super.getType()) {
        result.setAttributeNS(null, EncryptionConstants._ATT_TYPE, super.getType());
    }
    if (null != super.getMimeType()) {
        result.setAttributeNS(
            null, EncryptionConstants._ATT_MIMETYPE, super.getMimeType()
        );
    }
    if (null != super.getEncoding()) {
        result.setAttributeNS(
            null, EncryptionConstants._ATT_ENCODING, super.getEncoding()
        );
    }
    if (null != super.getEncryptionMethod()) {
        result.appendChild(
            ((EncryptionMethodImpl)super.getEncryptionMethod()).toElement()
        );
    }
    if (null != super.getKeyInfo()) {
        result.appendChild(super.getKeyInfo().getElement().cloneNode(true));
    }

    result.appendChild(((CipherDataImpl) super.getCipherData()).toElement());
    if (null != super.getEncryptionProperties()) {
        result.appendChild(((EncryptionPropertiesImpl)
            super.getEncryptionProperties()).toElement());
    }

    return result;
}
 
Example 14
Source File: XMLCipher.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
Element toElement() {
    Element result =
        ElementProxy.createElementForFamily(
            contextDocument,
            EncryptionConstants.EncryptionSpecNS,
            EncryptionConstants._TAG_REFERENCELIST
        );
    Iterator<Reference> eachReference = references.iterator();
    while (eachReference.hasNext()) {
        Reference reference = eachReference.next();
        result.appendChild(((ReferenceImpl) reference).toElement());
    }
    return result;
}
 
Example 15
Source File: XPathFilterCHGPContainer.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructor XPathFilterCHGPContainer
 *
 * @param doc
 * @param includeSlashPolicy
 * @param includeButSearch
 * @param excludeButSearch
 * @param exclude
 */
private XPathFilterCHGPContainer(
    Document doc, boolean includeSlashPolicy, String includeButSearch,
    String excludeButSearch, String exclude
) {
    super(doc);

    if (includeSlashPolicy) {
        this.constructionElement.setAttributeNS(
            null, XPathFilterCHGPContainer._ATT_INCLUDESLASH, "true"
        );
    } else {
        this.constructionElement.setAttributeNS(
            null, XPathFilterCHGPContainer._ATT_INCLUDESLASH, "false"
        );
    }

    if ((includeButSearch != null) && (includeButSearch.trim().length() > 0)) {
        Element includeButSearchElem =
            ElementProxy.createElementForFamily(
                doc, this.getBaseNamespace(), XPathFilterCHGPContainer._TAG_INCLUDE_BUT_SEARCH
            );

        includeButSearchElem.appendChild(
            this.doc.createTextNode(indentXPathText(includeButSearch))
        );
        XMLUtils.addReturnToElement(this.constructionElement);
        this.constructionElement.appendChild(includeButSearchElem);
    }

    if ((excludeButSearch != null) && (excludeButSearch.trim().length() > 0)) {
        Element excludeButSearchElem =
            ElementProxy.createElementForFamily(
                doc, this.getBaseNamespace(), XPathFilterCHGPContainer._TAG_EXCLUDE_BUT_SEARCH
            );

        excludeButSearchElem.appendChild(
            this.doc.createTextNode(indentXPathText(excludeButSearch)));

        XMLUtils.addReturnToElement(this.constructionElement);
        this.constructionElement.appendChild(excludeButSearchElem);
    }

    if ((exclude != null) && (exclude.trim().length() > 0)) {
        Element excludeElem =
            ElementProxy.createElementForFamily(
               doc, this.getBaseNamespace(), XPathFilterCHGPContainer._TAG_EXCLUDE);

        excludeElem.appendChild(this.doc.createTextNode(indentXPathText(exclude)));
        XMLUtils.addReturnToElement(this.constructionElement);
        this.constructionElement.appendChild(excludeElem);
    }

    XMLUtils.addReturnToElement(this.constructionElement);
}
 
Example 16
Source File: XPathFilterCHGPContainer.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructor XPathFilterCHGPContainer
 *
 * @param doc
 * @param includeSlashPolicy
 * @param includeButSearch
 * @param excludeButSearch
 * @param exclude
 */
private XPathFilterCHGPContainer(
    Document doc, boolean includeSlashPolicy, String includeButSearch,
    String excludeButSearch, String exclude
) {
    super(doc);

    if (includeSlashPolicy) {
        this.constructionElement.setAttributeNS(
            null, XPathFilterCHGPContainer._ATT_INCLUDESLASH, "true"
        );
    } else {
        this.constructionElement.setAttributeNS(
            null, XPathFilterCHGPContainer._ATT_INCLUDESLASH, "false"
        );
    }

    if ((includeButSearch != null) && (includeButSearch.trim().length() > 0)) {
        Element includeButSearchElem =
            ElementProxy.createElementForFamily(
                doc, this.getBaseNamespace(), XPathFilterCHGPContainer._TAG_INCLUDE_BUT_SEARCH
            );

        includeButSearchElem.appendChild(
            this.doc.createTextNode(indentXPathText(includeButSearch))
        );
        XMLUtils.addReturnToElement(this.constructionElement);
        this.constructionElement.appendChild(includeButSearchElem);
    }

    if ((excludeButSearch != null) && (excludeButSearch.trim().length() > 0)) {
        Element excludeButSearchElem =
            ElementProxy.createElementForFamily(
                doc, this.getBaseNamespace(), XPathFilterCHGPContainer._TAG_EXCLUDE_BUT_SEARCH
            );

        excludeButSearchElem.appendChild(
            this.doc.createTextNode(indentXPathText(excludeButSearch)));

        XMLUtils.addReturnToElement(this.constructionElement);
        this.constructionElement.appendChild(excludeButSearchElem);
    }

    if ((exclude != null) && (exclude.trim().length() > 0)) {
        Element excludeElem =
            ElementProxy.createElementForFamily(
               doc, this.getBaseNamespace(), XPathFilterCHGPContainer._TAG_EXCLUDE);

        excludeElem.appendChild(this.doc.createTextNode(indentXPathText(exclude)));
        XMLUtils.addReturnToElement(this.constructionElement);
        this.constructionElement.appendChild(excludeElem);
    }

    XMLUtils.addReturnToElement(this.constructionElement);
}
 
Example 17
Source File: XMLCipher.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
Element toElement() {
    Element result =
        ElementProxy.createElementForFamily(
            contextDocument, EncryptionConstants.EncryptionSpecNS,
            EncryptionConstants._TAG_ENCRYPTEDKEY
        );

    if (null != super.getId()) {
        result.setAttributeNS(null, EncryptionConstants._ATT_ID, super.getId());
    }
    if (null != super.getType()) {
        result.setAttributeNS(null, EncryptionConstants._ATT_TYPE, super.getType());
    }
    if (null != super.getMimeType()) {
        result.setAttributeNS(
            null, EncryptionConstants._ATT_MIMETYPE, super.getMimeType()
        );
    }
    if (null != super.getEncoding()) {
        result.setAttributeNS(null, Constants._ATT_ENCODING, super.getEncoding());
    }
    if (null != getRecipient()) {
        result.setAttributeNS(
            null, EncryptionConstants._ATT_RECIPIENT, getRecipient()
        );
    }
    if (null != super.getEncryptionMethod()) {
        result.appendChild(((EncryptionMethodImpl)
            super.getEncryptionMethod()).toElement());
    }
    if (null != super.getKeyInfo()) {
        result.appendChild(super.getKeyInfo().getElement().cloneNode(true));
    }
    result.appendChild(((CipherDataImpl) super.getCipherData()).toElement());
    if (null != super.getEncryptionProperties()) {
        result.appendChild(((EncryptionPropertiesImpl)
            super.getEncryptionProperties()).toElement());
    }
    if (referenceList != null && !referenceList.isEmpty()) {
        result.appendChild(((ReferenceListImpl)getReferenceList()).toElement());
    }
    if (null != carriedName) {
        Element element =
            ElementProxy.createElementForFamily(
                contextDocument,
                EncryptionConstants.EncryptionSpecNS,
                EncryptionConstants._TAG_CARRIEDKEYNAME
            );
        Node node = contextDocument.createTextNode(carriedName);
        element.appendChild(node);
        result.appendChild(element);
    }

    return result;
}
 
Example 18
Source File: XMLCipher.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
Element toElement() {
    Element result =
        ElementProxy.createElementForFamily(
            contextDocument, EncryptionConstants.EncryptionSpecNS,
            EncryptionConstants._TAG_ENCRYPTEDKEY
        );

    if (null != super.getId()) {
        result.setAttributeNS(null, EncryptionConstants._ATT_ID, super.getId());
    }
    if (null != super.getType()) {
        result.setAttributeNS(null, EncryptionConstants._ATT_TYPE, super.getType());
    }
    if (null != super.getMimeType()) {
        result.setAttributeNS(
            null, EncryptionConstants._ATT_MIMETYPE, super.getMimeType()
        );
    }
    if (null != super.getEncoding()) {
        result.setAttributeNS(null, Constants._ATT_ENCODING, super.getEncoding());
    }
    if (null != getRecipient()) {
        result.setAttributeNS(
            null, EncryptionConstants._ATT_RECIPIENT, getRecipient()
        );
    }
    if (null != super.getEncryptionMethod()) {
        result.appendChild(((EncryptionMethodImpl)
            super.getEncryptionMethod()).toElement());
    }
    if (null != super.getKeyInfo()) {
        result.appendChild(super.getKeyInfo().getElement().cloneNode(true));
    }
    result.appendChild(((CipherDataImpl) super.getCipherData()).toElement());
    if (null != super.getEncryptionProperties()) {
        result.appendChild(((EncryptionPropertiesImpl)
            super.getEncryptionProperties()).toElement());
    }
    if (referenceList != null && !referenceList.isEmpty()) {
        result.appendChild(((ReferenceListImpl)getReferenceList()).toElement());
    }
    if (null != carriedName) {
        Element element =
            ElementProxy.createElementForFamily(
                contextDocument,
                EncryptionConstants.EncryptionSpecNS,
                EncryptionConstants._TAG_CARRIEDKEYNAME
            );
        Node node = contextDocument.createTextNode(carriedName);
        element.appendChild(node);
        result.appendChild(element);
    }

    return result;
}
 
Example 19
Source File: XMLCipher.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
Element toElement() {
    Element result =
        ElementProxy.createElementForFamily(
            contextDocument, EncryptionConstants.EncryptionSpecNS,
            EncryptionConstants._TAG_ENCRYPTEDKEY
        );

    if (null != super.getId()) {
        result.setAttributeNS(null, EncryptionConstants._ATT_ID, super.getId());
    }
    if (null != super.getType()) {
        result.setAttributeNS(null, EncryptionConstants._ATT_TYPE, super.getType());
    }
    if (null != super.getMimeType()) {
        result.setAttributeNS(
            null, EncryptionConstants._ATT_MIMETYPE, super.getMimeType()
        );
    }
    if (null != super.getEncoding()) {
        result.setAttributeNS(null, Constants._ATT_ENCODING, super.getEncoding());
    }
    if (null != getRecipient()) {
        result.setAttributeNS(
            null, EncryptionConstants._ATT_RECIPIENT, getRecipient()
        );
    }
    if (null != super.getEncryptionMethod()) {
        result.appendChild(((EncryptionMethodImpl)
            super.getEncryptionMethod()).toElement());
    }
    if (null != super.getKeyInfo()) {
        result.appendChild(super.getKeyInfo().getElement().cloneNode(true));
    }
    result.appendChild(((CipherDataImpl) super.getCipherData()).toElement());
    if (null != super.getEncryptionProperties()) {
        result.appendChild(((EncryptionPropertiesImpl)
            super.getEncryptionProperties()).toElement());
    }
    if (referenceList != null && !referenceList.isEmpty()) {
        result.appendChild(((ReferenceListImpl)getReferenceList()).toElement());
    }
    if (null != carriedName) {
        Element element =
            ElementProxy.createElementForFamily(
                contextDocument,
                EncryptionConstants.EncryptionSpecNS,
                EncryptionConstants._TAG_CARRIEDKEYNAME
            );
        Node node = contextDocument.createTextNode(carriedName);
        element.appendChild(node);
        result.appendChild(element);
    }

    return result;
}
 
Example 20
Source File: XPathFilterCHGPContainer.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructor XPathFilterCHGPContainer
 *
 * @param doc
 * @param includeSlashPolicy
 * @param includeButSearch
 * @param excludeButSearch
 * @param exclude
 */
private XPathFilterCHGPContainer(
    Document doc, boolean includeSlashPolicy, String includeButSearch,
    String excludeButSearch, String exclude
) {
    super(doc);

    if (includeSlashPolicy) {
        this.constructionElement.setAttributeNS(
            null, XPathFilterCHGPContainer._ATT_INCLUDESLASH, "true"
        );
    } else {
        this.constructionElement.setAttributeNS(
            null, XPathFilterCHGPContainer._ATT_INCLUDESLASH, "false"
        );
    }

    if ((includeButSearch != null) && (includeButSearch.trim().length() > 0)) {
        Element includeButSearchElem =
            ElementProxy.createElementForFamily(
                doc, this.getBaseNamespace(), XPathFilterCHGPContainer._TAG_INCLUDE_BUT_SEARCH
            );

        includeButSearchElem.appendChild(
            this.doc.createTextNode(indentXPathText(includeButSearch))
        );
        XMLUtils.addReturnToElement(this.constructionElement);
        this.constructionElement.appendChild(includeButSearchElem);
    }

    if ((excludeButSearch != null) && (excludeButSearch.trim().length() > 0)) {
        Element excludeButSearchElem =
            ElementProxy.createElementForFamily(
                doc, this.getBaseNamespace(), XPathFilterCHGPContainer._TAG_EXCLUDE_BUT_SEARCH
            );

        excludeButSearchElem.appendChild(
            this.doc.createTextNode(indentXPathText(excludeButSearch)));

        XMLUtils.addReturnToElement(this.constructionElement);
        this.constructionElement.appendChild(excludeButSearchElem);
    }

    if ((exclude != null) && (exclude.trim().length() > 0)) {
        Element excludeElem =
            ElementProxy.createElementForFamily(
               doc, this.getBaseNamespace(), XPathFilterCHGPContainer._TAG_EXCLUDE);

        excludeElem.appendChild(this.doc.createTextNode(indentXPathText(exclude)));
        XMLUtils.addReturnToElement(this.constructionElement);
        this.constructionElement.appendChild(excludeElem);
    }

    XMLUtils.addReturnToElement(this.constructionElement);
}