Announcing the Release of the Open XML SDK Version 2 April 2009 CTP

I’m really happy to announce the release of the second CTP for version 2 of the Open XML SDK! Back in October 2008 I showed you guys an architecture diagram of the Open XML SDK. Let’s take another look at this diagram:

In version 1 of the Open XML SDK we released the Open XML Packaging API, which allows you to create, open and manipulate Open XML files at the package and part level. In the first CTP of version 2 we released the Open XML Low Level DOM and Stream Reading/Writing components, which allow you to create and manipulate objects within xml parts contained in an Open XML package. In the second CTP of version 2 we are providing schema level validation functionality:

More information about the SDK and all of its components can be found here:

Download Details

You can download the latest CTP for version 2 here:

Importance of Validation

If you’ve played around with the Open XML SDK there is a good chance at one point in time your solution has created an invalid or corrupt Open XML file. Manipulating Open XML Formats by using the Open XML Base layer makes it much easier for you to work on the Open XML files, but doing so does not guarantee the production of valid Open XML files.

The new Schema Level Validation component provides a mechanism to help you discover Open XML errors within files and in your code. This component assists you in debugging and validating Open XML files based on the schemas.

An Example

Let’s say I want to create a simple document with the text “hello world.” The XML snippet necessary to create this text is the following:




<w:t>hello world</w:t>




What happens if I forget to include the run element:



<w:t>hello world</w:t>



If I try to open the generated document in Word I will get the following error:

Not super helpful, right. Validating this file with .NET I get the following error message:


The element ‘p’ in namespace ‘’ has invalid child element ‘t’ in namespace ‘’. List of possible elements expected: ‘pPr, customXml, smartTag, sdt, dir, bdo, r, proofErr, permStart, permEnd, bookmarkStart, bookmarkEnd, moveFromRangeStart, moveFromRangeEnd, moveToRangeStart, moveToRangeEnd, commentRangeStart, commentRangeEnd, customXmlInsRangeStart, customXmlInsRangeEnd, customXmlDelRangeStart, customXmlDelRangeEnd, customXmlMoveFromRangeStart, customXmlMoveFromRangeEnd, customXmlMoveToRangeStart, customXmlMoveToRangeEnd, ins, del, moveFrom, moveTo’ in namespace ‘’ as well as ‘oMathPara, oMath’ in namespace ‘’ as well as ‘fldSimple, hyperlink, subDoc’ in namespace ‘’. (line 1, col 703)

Yes this error message is pretty useful, but the Open XML SDK schema validation component provides a bit more useful information. Here is the error message as described by the Open XML SDK:

The element has invalid child element ““. List of possible elements expected: <>. Path: /word/document.xml:/w:document[1]/w:body[1]/w:p[1] OuterXml: <w:p w:rsidR=”00900A7A” w:rsidRDefault=”00E0086A” xmlns:w=”“><w:t>test</w:t></w:p>

Notice that the error gives you the exact XPath to the element and XML snippet that triggered this validation error. There are more advantages, but I will leave talking about those advantages for a future post.


Feel free to post any questions here or on the Open XML SDK MSDN forum: You can also post questions on the Open XML SDK Connect site:

Zeyad Rajabi

Comments (4)

  1. Erika Ehrli says:

    For all of those fans of Open XML and followers of updates done to the Open XML Format SDK 2.0, one more

  2. Erika Ehrli says:

    For all of those fans of Open XML and followers of updates done to the Open XML Format SDK 2.0, one more

  3. Doug Mahugh says:

    Catching up on links to blog posts I’ve found interesting this month … I was on vacation the first week

  4. One of the big changes we made in the Open XML SDK v2 April 2009 CTP was improving the Low Level DOM

Skip to main content