Package org.apache.poi.openxml4j.opc.internal

Examples of org.apache.poi.openxml4j.opc.internal.ContentType


   *            The unmarshaller to register with the specified content type.
   */
  public void addUnmarshaller(String contentType,
      PartUnmarshaller unmarshaller) {
    try {
      partUnmarshallers.put(new ContentType(contentType), unmarshaller);
    } catch (InvalidFormatException e) {
      logger.log(POILogger.WARN, "The specified content type is not valid: '"
          + e.getMessage()
          + "'. The unmarshaller will not be added !");
    }
View Full Code Here


  public void testContentTypeValidation() throws InvalidFormatException {
    String[] contentTypesToTest = new String[] { "text/xml",
        "application/pgp-key", "application/vnd.hp-PCLXL",
        "application/vnd.lotus-1-2-3" };
    for (int i = 0; i < contentTypesToTest.length; ++i) {
      new ContentType(contentTypesToTest[i]);
    }
  }
View Full Code Here

        "text[/xml", "text]/xml", "text?/xml", "tex=t/xml",
        "te{xt/xml", "tex}t/xml", "te xt/xml",
        "text" + (char) 9 + "/xml", "text xml", " text/xml " };
    for (int i = 0; i < contentTypesToTest.length; ++i) {
      try {
        new ContentType(contentTypesToTest[i]);
      } catch (InvalidFormatException e) {
        continue;
      }
      fail("Must have fail for content type: '" + contentTypesToTest[i]
          + "' !");
View Full Code Here

  public void testContentTypeParameterFailure() {
    String[] contentTypesToTest = new String[] { "mail/toto;titi=tata",
        "text/xml;a=b;c=d", "mail/toto;\"titi=tata\"" };
    for (int i = 0; i < contentTypesToTest.length; ++i) {
      try {
        new ContentType(contentTypesToTest[i]);
      } catch (InvalidFormatException e) {
        continue;
      }
      fail("Must have fail for content type: '" + contentTypesToTest[i]
          + "' !");
View Full Code Here

   */
  public void testContentTypeCommentFailure() {
    String[] contentTypesToTest = new String[] { "text/xml(comment)" };
    for (int i = 0; i < contentTypesToTest.length; ++i) {
      try {
        new ContentType(contentTypesToTest[i]);
      } catch (InvalidFormatException e) {
        continue;
      }
      fail("Must have fail for content type: '" + contentTypesToTest[i]
          + "' !");
View Full Code Here

    this.partMarshallers = new Hashtable<ContentType, PartMarshaller>(5);
    this.partUnmarshallers = new Hashtable<ContentType, PartUnmarshaller>(2);

    try {
      // Add 'default' unmarshaller
      this.partUnmarshallers.put(new ContentType(
          ContentTypes.CORE_PROPERTIES_PART),
          new PackagePropertiesUnmarshaller());

      // Add default marshaller
      this.defaultPartMarshaller = new DefaultMarshaller();
      // TODO Delocalize specialized marshallers
      this.partMarshallers.put(new ContentType(
          ContentTypes.CORE_PROPERTIES_PART),
          new ZipPackagePropertiesMarshaller());
    } catch (InvalidFormatException e) {
      // Should never happen
      throw new OpenXML4JRuntimeException(
View Full Code Here

   * @param marshaller
   *            The marshaller to register with the specified content type.
   */
  public void addMarshaller(String contentType, PartMarshaller marshaller) {
    try {
      partMarshallers.put(new ContentType(contentType), marshaller);
    } catch (InvalidFormatException e) {
      logger.log(POILogger.WARN, "The specified content type is not valid: '"
          + e.getMessage() + "'. The marshaller will not be added !");
    }
  }
View Full Code Here

   *            The unmarshaller to register with the specified content type.
   */
  public void addUnmarshaller(String contentType,
      PartUnmarshaller unmarshaller) {
    try {
      partUnmarshallers.put(new ContentType(contentType), unmarshaller);
    } catch (InvalidFormatException e) {
      logger.log(POILogger.WARN, "The specified content type is not valid: '"
          + e.getMessage()
          + "'. The unmarshaller will not be added !");
    }
View Full Code Here

  public void testContentTypeValidation() throws InvalidFormatException {
    String[] contentTypesToTest = new String[] { "text/xml",
        "application/pgp-key", "application/vnd.hp-PCLXL",
        "application/vnd.lotus-1-2-3" };
    for (int i = 0; i < contentTypesToTest.length; ++i) {
      new ContentType(contentTypesToTest[i]);
    }
  }
View Full Code Here

        "text[/xml", "text]/xml", "text?/xml", "tex=t/xml",
        "te{xt/xml", "tex}t/xml", "te xt/xml",
        "text" + (char) 9 + "/xml", "text xml", " text/xml " };
    for (int i = 0; i < contentTypesToTest.length; ++i) {
      try {
        new ContentType(contentTypesToTest[i]);
      } catch (InvalidFormatException e) {
        continue;
      }
      fail("Must have fail for content type: '" + contentTypesToTest[i]
          + "' !");
View Full Code Here

TOP

Related Classes of org.apache.poi.openxml4j.opc.internal.ContentType

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.