List of usage examples for org.dom4j Element clearContent
void clearContent();
Node
instances this branch may contain. From source file:org.apache.poi.openxml4j.opc.internal.marshallers.PackagePropertiesMarshaller.java
License:Apache License
/** * Add content type property element if needed. *///from ww 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. *///from www. jav a2 s .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 w w w.j a v a 2 s. c o m 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 ww w.j a v a 2 s .c om*/ 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. *///from w ww .j a v a 2 s . c o m 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. *//*from w w w . java2 s .c o m*/ 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 w w. j av a2 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. *//*from ww w. j a va2 s . co m*/ 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. * *//*ww w. ja v a2 s .co m*/ 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. *///from ww w. j a v a 2 s .c o m 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()); }