Override vs Default


  • In a DOCX file [Content_Types].xml uses the form:


    <Types xmlns="">
    <Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/> 

     But Open XML is giving me:

    <Types xmlns="">
    <Default Extension="xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/>
    <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>


    What's going on here?

    thanks - dave

    Windward Reports - World's Greatest SharePoint Reporting & DocGen
    Saturday, January 23, 2010 12:02 AM

All replies

  • You could refer to the ECMA spec part 2, section It addresses the content type of OPC:                        Content Types Stream Markup

    The Content Types stream identifies the content type for each package part. The Content Types stream contains XML with a top-level Types element, and one or more Default and Override child elements. Default elements define default mappings from the extensions of part names to content types. Override elements are used to specify content types on parts that are not covered by, or are not consistent with, the default mappings. Package producers can use pre-defined Default elements to reduce the number of Override elements on a part, but are not required to do so. [O2.4]

    The package implementer shall require that the Content Types stream contain one of the following for every part in the package:

    ·        One matching Default element

    ·        One matching Override element

    ·        Both a matching Default element and a matching Override element, in which case the Override element takes precedence. [M2.4]

    The package implementer shall require that there not be more than one Default element for any given extension, and there not be more than one Override element for any given part name. [M2.5]

    The order of Default and Override elements in the Content Types stream is not significant.

    If the package is intended for streaming consumption:

    ·        The package implementer should not allow Default elements; as a consequence, there should be one Override element for each part in the package.

    ·        The format producer should write the Override elements to the package so they appear before the parts to which they correspond, or in close proximity to the part to which they correspond.

    Hope it helps!


    Monday, January 25, 2010 2:26 AM
  • Hi;

    We use the values here to determine if a file is a DOCX, XLSX, or PPTX (we get it as a stream so we can't look at the extension).

    I think what you are saying above is we can get these as either Default or Override and both ways are valid - is that correct?

    And is this the best way to determine if a file is DOCX, XLSX, or PPTX?

    thanks - dave
    Windward Reports - World's Greatest SharePoint Reporting & DocGen
    Monday, January 25, 2010 6:05 PM