opcContainerFlatExport and opening a stream from a part.

Jun 6, 2013 at 5:10 AM
Edited Jun 6, 2013 at 5:11 AM
Firstly, I came across this:
 Exports the OPC container to "Flat OPC" (http://blogs.msdn.com/b/ericwhite/archive/2008/09/29/the-flat-opc-format.aspx).
 The flat versions of an OPC file are very important when dealing with e.g XSL(T)-based or Javascript-based transformations.
 \see opcContainerFlatImport.
 \todo Implementation needed.
Would be damn handy for me. Are there any plans to implement this in the near future?

Secondly, is there no way to create a mce reader stream given a part? Everything seems to take the part name?! The "proper" way to get a part is to look at the root relationships and follow that, ie:
   if (container != nullptr) {
         opcRelation projectRelation = opcRelationFind(container, OPC_PART_INVALID, NULL, _X(OpcTags::rootProjectRelationshipType));
         if (projectRelation != OPC_RELATION_INVALID) {
            opcPart projectPart = opcRelationGetInternalTarget(container, OPC_PART_INVALID, projectRelation);
            if (projectPart != OPC_PART_INVALID) {
But then if I want to actually read it the only way to create a stream seems to be via opcXmlReaderOpen which takes a part name. I can't even see how I to get from a part to the partName.... any help appreciated.
Jun 6, 2013 at 5:30 AM
Edited Jun 6, 2013 at 5:31 AM
Ok I worked out the second part of the question. The opcPart is just a char* (or xmlChar*) which represents the text of the part. So printf("%s", projectPart) in the above actually prints the part's name. So

opcXmlReaderOpen(container, &reader, projectPart, NULL, 0, 0)

Also works.
Jun 6, 2013 at 9:14 AM

yes --- internally there is a fine line between an opcPart and just a xmlChar*: the opcPart is managed by the opcContainer (i.e. xmlFree'd). So never free an opcPart. But all opcPart's can be used as a "normal" name.

Wrt. opcContainerFlatImport: It is there because I thought I need it for one of my projects. However it turned out I don't need it. So there are not plans to implement it yet..



Jun 6, 2013 at 10:22 AM
Thanks for the clarification.