Example usage for org.dom4j QName QName

List of usage examples for org.dom4j QName QName

Introduction

In this page you can find the example usage for org.dom4j QName QName.

Prototype

public QName(String name, Namespace namespace) 

Source Link

Usage

From source file:org.apache.poi.openxml4j.opc.internal.marshallers.PackagePropertiesMarshaller.java

License:Apache License

/**
 * Add content type property element if needed.
 *///from   w w w  .  j  a  v  a 2 s  . c o  m
private void addContentType() {
    if (!propsPart.getContentTypeProperty().hasValue())
        return;

    Element elem = xmlDoc.getRootElement().element(new QName(KEYWORD_CONTENT_TYPE, namespaceCoreProperties));
    if (elem == null) {
        // Missing, we add it
        elem = xmlDoc.getRootElement().addElement(new QName(KEYWORD_CONTENT_TYPE, namespaceCoreProperties));
    } else {
        elem.clearContent();// clear the old value
    }
    elem.addText(propsPart.getContentTypeProperty().getValue());
}

From source file:org.apache.poi.openxml4j.opc.internal.marshallers.PackagePropertiesMarshaller.java

License:Apache License

/**
 * Add created property element if needed.
 *//*  ww w.ja va2s.  co  m*/
private void addCreated() {
    if (!propsPart.getCreatedProperty().hasValue())
        return;

    Element elem = xmlDoc.getRootElement().element(new QName(KEYWORD_CREATED, namespaceDcTerms));
    if (elem == null) {
        // missing, we add it
        elem = xmlDoc.getRootElement().addElement(new QName(KEYWORD_CREATED, namespaceDcTerms));
    } else {
        elem.clearContent();// clear the old value
    }
    elem.addAttribute(new QName("type", namespaceXSI), "dcterms:W3CDTF");
    elem.addText(propsPart.getCreatedPropertyString());
}

From source file:org.apache.poi.openxml4j.opc.internal.marshallers.PackagePropertiesMarshaller.java

License:Apache License

/**
 * Add creator property element if needed.
 *///from www  .  java2  s .c  om
private void addCreator() {
    if (!propsPart.getCreatorProperty().hasValue())
        return;

    Element elem = xmlDoc.getRootElement().element(new QName(KEYWORD_CREATOR, namespaceDC));
    if (elem == null) {
        // missing, we add it
        elem = xmlDoc.getRootElement().addElement(new QName(KEYWORD_CREATOR, namespaceDC));
    } else {
        elem.clearContent();// clear the old value
    }
    elem.addText(propsPart.getCreatorProperty().getValue());
}

From source file:org.apache.poi.openxml4j.opc.internal.marshallers.PackagePropertiesMarshaller.java

License:Apache License

/**
 * Add description property element if needed.
 *///from   w  w w  . ja  va 2 s  .c  o  m
private void addDescription() {
    if (!propsPart.getDescriptionProperty().hasValue())
        return;

    Element elem = xmlDoc.getRootElement().element(new QName(KEYWORD_DESCRIPTION, namespaceDC));
    if (elem == null) {
        // missing, we add it
        elem = xmlDoc.getRootElement().addElement(new QName(KEYWORD_DESCRIPTION, namespaceDC));
    } else {
        elem.clearContent();// clear the old value
    }
    elem.addText(propsPart.getDescriptionProperty().getValue());
}

From source file:org.apache.poi.openxml4j.opc.internal.marshallers.PackagePropertiesMarshaller.java

License:Apache License

/**
 * Add identifier property element if needed.
 */// w w w . ja  v a 2  s  .  c  om
private void addIdentifier() {
    if (!propsPart.getIdentifierProperty().hasValue())
        return;

    Element elem = xmlDoc.getRootElement().element(new QName(KEYWORD_IDENTIFIER, namespaceDC));
    if (elem == null) {
        // missing, we add it
        elem = xmlDoc.getRootElement().addElement(new QName(KEYWORD_IDENTIFIER, namespaceDC));
    } else {
        elem.clearContent();// clear the old value
    }
    elem.addText(propsPart.getIdentifierProperty().getValue());
}

From source file:org.apache.poi.openxml4j.opc.internal.marshallers.PackagePropertiesMarshaller.java

License:Apache License

/**
 * Add keywords property element if needed.
 *///ww  w.j  av a 2 s  .  c  om
private void addKeywords() {
    if (!propsPart.getKeywordsProperty().hasValue())
        return;

    Element elem = xmlDoc.getRootElement().element(new QName(KEYWORD_KEYWORDS, namespaceCoreProperties));
    if (elem == null) {
        // missing, we add it
        elem = xmlDoc.getRootElement().addElement(new QName(KEYWORD_KEYWORDS, namespaceCoreProperties));
    } else {
        elem.clearContent();// clear the old value
    }
    elem.addText(propsPart.getKeywordsProperty().getValue());
}

From source file:org.apache.poi.openxml4j.opc.internal.marshallers.PackagePropertiesMarshaller.java

License:Apache License

/**
 * Add language property element if needed.
 */// w ww.  j a v a  2  s.c  o m
private void addLanguage() {
    if (!propsPart.getLanguageProperty().hasValue())
        return;

    Element elem = xmlDoc.getRootElement().element(new QName(KEYWORD_LANGUAGE, namespaceDC));
    if (elem == null) {
        // missing, we add it
        elem = xmlDoc.getRootElement().addElement(new QName(KEYWORD_LANGUAGE, namespaceDC));
    } else {
        elem.clearContent();// clear the old value
    }
    elem.addText(propsPart.getLanguageProperty().getValue());
}

From source file:org.apache.poi.openxml4j.opc.internal.marshallers.PackagePropertiesMarshaller.java

License:Apache License

/**
 * Add 'last modified by' property if needed.
 *///  w  w  w. j a v a 2  s.  c om
private void addLastModifiedBy() {
    if (!propsPart.getLastModifiedByProperty().hasValue())
        return;

    Element elem = xmlDoc.getRootElement()
            .element(new QName(KEYWORD_LAST_MODIFIED_BY, namespaceCoreProperties));
    if (elem == null) {
        // missing, we add it
        elem = xmlDoc.getRootElement().addElement(new QName(KEYWORD_LAST_MODIFIED_BY, namespaceCoreProperties));
    } else {
        elem.clearContent();// clear the old value
    }
    elem.addText(propsPart.getLastModifiedByProperty().getValue());
}

From source file:org.apache.poi.openxml4j.opc.internal.marshallers.PackagePropertiesMarshaller.java

License:Apache License

/**
 * Add 'last printed' property if needed.
 *
 *///from  w  w w  . j  av  a 2  s. com
private void addLastPrinted() {
    if (!propsPart.getLastPrintedProperty().hasValue())
        return;

    Element elem = xmlDoc.getRootElement().element(new QName(KEYWORD_LAST_PRINTED, namespaceCoreProperties));
    if (elem == null) {
        // missing, we add it
        elem = xmlDoc.getRootElement().addElement(new QName(KEYWORD_LAST_PRINTED, namespaceCoreProperties));
    } else {
        elem.clearContent();// clear the old value
    }
    elem.addText(propsPart.getLastPrintedPropertyString());
}

From source file:org.apache.poi.openxml4j.opc.internal.marshallers.PackagePropertiesMarshaller.java

License:Apache License

/**
 * Add modified property element if needed.
 *///  w  w  w .  j  av  a 2s. com
private void addModified() {
    if (!propsPart.getModifiedProperty().hasValue())
        return;

    Element elem = xmlDoc.getRootElement().element(new QName(KEYWORD_MODIFIED, namespaceDcTerms));
    if (elem == null) {
        // missing, we add it
        elem = xmlDoc.getRootElement().addElement(new QName(KEYWORD_MODIFIED, namespaceDcTerms));
    } else {
        elem.clearContent();// clear the old value
    }
    elem.addAttribute(new QName("type", namespaceXSI), "dcterms:W3CDTF");
    elem.addText(propsPart.getModifiedPropertyString());
}