Package org.odftoolkit.odfdom.dom.element.meta

Examples of org.odftoolkit.odfdom.dom.element.meta.MetaUserDefinedElement


   *
   * @param name  the name of the user-defined metadata
   * @see org.odftoolkit.odfdom.dom.element.meta.MetaUserDefinedElement.
   */
  public void removeUserDefinedDataByName(String name) {
    MetaUserDefinedElement definedElement = getUserDefinedElementByAttributeName(name);
    if (definedElement != null) {
      mOfficeMetaElement.removeChild(definedElement);
    }

  }
View Full Code Here


   * @param name  the name need to set for the user-defined metadata
   * @param value  the value need to set for the user-defined metadata
   * @see org.odftoolkit.odfdom.dom.element.meta.MetaUserDefinedElement.
   */
  public void setUserDefinedDataValue(String name, String value) {
    MetaUserDefinedElement definedElement = getUserDefinedElementByAttributeName(name);
    if (definedElement != null) {
      definedElement.setTextContent(value);
    }

  }
View Full Code Here

   * @param name  the name need to set for the user-defined metadata
   * @param value  the value need to set for the user-defined metadata
   * @see org.odftoolkit.odfdom.dom.element.meta.MetaUserDefinedElement.
   */
  public void setUserDefinedDataType(String name, String value) {
    MetaUserDefinedElement definedElement = getUserDefinedElementByAttributeName(name);
    if (definedElement != null) {
      definedElement.setMetaValueTypeAttribute(value);
    }

  }
View Full Code Here

   * @param value  the value need to set for the user-defined metadata
   * @see org.odftoolkit.odfdom.dom.element.meta.MetaUserDefinedElement.
   */
  public void setUserDefinedData(String name, String type, String value) {
    // test if name exists
    MetaUserDefinedElement definedElement = getUserDefinedElementByAttributeName(name);
    // if exists, then update,if parameter is null, then don't change
    if (definedElement != null) {
      if (type != null) {
        definedElement.setMetaValueTypeAttribute(type);
      }
      if (value != null) {
        definedElement.setTextContent(value);
      }
    } else {
      // if not exists, add
      definedElement = mOfficeMetaElement.newMetaUserDefinedElement(name,
          type);
      definedElement.setTextContent(value);

    }

  }
View Full Code Here

   * Child element is new in Odf 1.2
   *
   * @return the element {@odf.element meta:user-defined}
   */
   public MetaUserDefinedElement newMetaUserDefinedElement(String metaNameValue, String metaValueTypeValue) {
    MetaUserDefinedElement metaUserDefined = ((OdfFileDom) this.ownerDocument).newOdfElement(MetaUserDefinedElement.class);
    metaUserDefined.setMetaNameAttribute(metaNameValue);
    metaUserDefined.setMetaValueTypeAttribute(metaValueTypeValue);
    this.appendChild(metaUserDefined);
    return metaUserDefined;
  }
View Full Code Here

         *
         */
        seeker.setNamespaceContext(OdtEPUBlisher.XPATH_ODT_NS_CTX);
        SMapImpl attrs = new SMapImpl();
        // AUTHOR
        MetaUserDefinedElement metaInfo = (MetaUserDefinedElement) seeker.evaluate("//meta:user-defined[@meta:name='"
                + JotexConstants.META_AUTHOR_KEY + "']", odtMeta, XPathConstants.NODE);
        if (metaInfo == null) {
            metaInfo = (MetaUserDefinedElement) seeker.evaluate("//meta:user-defined[@meta:name='w2e_"
                    + JotexConstants.META_AUTHOR_KEY + "']", odtMeta, XPathConstants.NODE);
        }
        // opf:role="aut"

        if (metaInfo != null) {
            attrs.put(OPFResource.opfns, "role", "aut");
            epub.addDCMetadata("creator", metaInfo.getTextContent(), attrs);
        }

        // TITLE
        metaInfo = (MetaUserDefinedElement) seeker.evaluate("//meta:user-defined[@meta:name='"
                + JotexConstants.META_TILTE_KEY + "']", odtMeta, XPathConstants.NODE);
        if (metaInfo == null) {
            metaInfo = (MetaUserDefinedElement) seeker.evaluate("//meta:user-defined[@meta:name='w2e_"
                    + JotexConstants.META_TILTE_KEY + "']", odtMeta, XPathConstants.NODE);
        }
        if (metaInfo != null) {
            epub.addDCMetadata("title", metaInfo.getTextContent(), null);
        }

        // LANGUAGE
        metaInfo = (MetaUserDefinedElement) seeker.evaluate("//meta:user-defined[@meta:name='"
                + JotexConstants.META_LANGUAGE_KEY + "']", odtMeta, XPathConstants.NODE);
        if (metaInfo == null) {
            metaInfo = (MetaUserDefinedElement) seeker.evaluate("//meta:user-defined[@meta:name='w2e_"
                    + JotexConstants.META_LANGUAGE_KEY + "']", odtMeta, XPathConstants.NODE);
        }
        if (metaInfo != null) {
            epub.addDCMetadata("language", metaInfo.getTextContent(), null);
        }

        // PUBLISHER
        metaInfo = (MetaUserDefinedElement) seeker.evaluate("//meta:user-defined[@meta:name='"
                + JotexConstants.META_PUBLISHER_KEY + "']", odtMeta, XPathConstants.NODE);
        if (metaInfo == null) {
            metaInfo = (MetaUserDefinedElement) seeker.evaluate("//meta:user-defined[@meta:name='w2e_"
                    + JotexConstants.META_PUBLISHER_KEY + "']", odtMeta, XPathConstants.NODE);
        }
        if (metaInfo != null) {
            epub.addDCMetadata("publisher", metaInfo.getTextContent(), null);
        }
        // PUBISHING DATE
        metaInfo = (MetaUserDefinedElement) seeker.evaluate("//meta:user-defined[@meta:name='"
                + JotexConstants.META_PUBLISHING_DATE_KEY + "']", odtMeta, XPathConstants.NODE);
        if (metaInfo == null) {
            metaInfo = (MetaUserDefinedElement) seeker.evaluate("//meta:user-defined[@meta:name='w2e_"
                    + JotexConstants.META_PUBLISHING_DATE_KEY + "']", odtMeta, XPathConstants.NODE);
        }
        if (metaInfo != null) {
            attrs = new SMapImpl();
            attrs.put(OPFResource.opfns, "event", "publication");
            epub.addDCMetadata("date", metaInfo.getTextContent(), attrs);
        }
        // DESCRIPTION
        metaInfo = (MetaUserDefinedElement) seeker.evaluate("//meta:user-defined[@meta:name='"
                + JotexConstants.META_DESCRITPION_KEY + "']", odtMeta, XPathConstants.NODE);
        if (metaInfo == null) {
            metaInfo = (MetaUserDefinedElement) seeker.evaluate("//meta:user-defined[@meta:name='w2e_"
                    + JotexConstants.META_DESCRITPION_KEY + "']", odtMeta, XPathConstants.NODE);
        }
        if (metaInfo != null) {
            epub.addDCMetadata("description", "<![CDATA[" + metaInfo.getTextContent() + "]]>", null);
        }
        // ISBN
        metaInfo = (MetaUserDefinedElement) seeker.evaluate("//meta:user-defined[@meta:name='"
                + JotexConstants.META_ISBN_KEY + "']", odtMeta, XPathConstants.NODE);
        if (metaInfo == null) {
            metaInfo = (MetaUserDefinedElement) seeker.evaluate("//meta:user-defined[@meta:name='w2e_"
                    + JotexConstants.META_ISBN_KEY + "']", odtMeta, XPathConstants.NODE);
        }
        if (metaInfo != null) {
            attrs = new SMapImpl();
            attrs.put(OPFResource.opfns, "scheme", "ISBN");
            epub.addDCMetadata("identifier", metaInfo.getTextContent(), attrs);
        }
        // ORIGINAL TITLE
        metaInfo = (MetaUserDefinedElement) seeker.evaluate("//meta:user-defined[@meta:name='"
                + JotexConstants.META_ORIGINAL_TITLE_KEY + "']", odtMeta, XPathConstants.NODE);
        if (metaInfo == null) {
            metaInfo = (MetaUserDefinedElement) seeker.evaluate("//meta:user-defined[@meta:name='w2e_"
                    + JotexConstants.META_ORIGINAL_TITLE_KEY + "']", odtMeta, XPathConstants.NODE);
        }
        if (metaInfo != null) {
            epub.addDCMetadata("source", metaInfo.getTextContent(), null);
        }
        // TAGS
        metaInfo = (MetaUserDefinedElement) seeker.evaluate("//meta:user-defined[@meta:name='"
                + JotexConstants.META_TAGS_KEY + "']", odtMeta, XPathConstants.NODE);
        if (metaInfo == null) {
            metaInfo = (MetaUserDefinedElement) seeker.evaluate("//meta:user-defined[@meta:name='w2e_"
                    + JotexConstants.META_TAGS_KEY + "']", odtMeta, XPathConstants.NODE);
        }
        if (metaInfo != null) {
            epub.addDCMetadata("subject", metaInfo.getTextContent(), null);
        }
       
    
    }
View Full Code Here

TOP

Related Classes of org.odftoolkit.odfdom.dom.element.meta.MetaUserDefinedElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.