locked
Validate document against attached schemas option is missing in word 2013. RRS feed

  • Question

  • Hi Guys,

    I am working document generation using different version of word like 2007,2013,etc.

    In word 2007,

    Developers tab-> Templates and Add-ins ->XML Schema tab

    we have a "Validate document against attached schemas" check box, so in this way I can validate the word document XML.

    In Word 2013,

    we don't have any options like this to validate the word 2013 xml.

    Do we have any other approach to validate the word 2013 document with attached schema? 

    Thanks in Advance!


    Friday, October 14, 2016 7:07 AM

Answers

  • I believe that the feature you are looking for was removed at some point because of a legal judgment in the U.S. around 2009/2010.

    I forget the timing exactly and I may well have some of the details wrong, but...

    In the 2007 version, there used to be a facility for mapping parts of a document to elements in an XML schema that you installed in the "Office Schema Library". Microsoft used to refer to this as "Custom XML". There was a special mapping task pane that allowed you to map parts of the document to an attached schema.Mapping resulted in the insertion of tags that look a little bit like the tags that surround content controls in Design Mode, but these were not actually content controls. However, that mapping process forced you (more or less) to conform to the schema - i.e. Word checked the values of the tagged text against the schema and also checked the sequence of tags and so on.

    As a consequence of the legal judgment, Microsoft removed part of this feature - originally the ruling was that Microsoft could not sell Word "with the feature" in the U.S.A. so I *think* Word 2007 was modified at some point, at least for U.S. purchasers, then most of the feature was ditched in all copies of Word 2010. If you attempt this mapping in 2010 you will get a message when you try to close the document that Word will remove all the custom XML (or some such).

    The XML mapping feature in the Developer tab (since Word 2013 I think) does something different. It lets you map content controls to elements/attributes in a Custom XML Part. *If* you place a schema for that part in the Office Schema Library and attach it to the document, then Word will do some validation on each content control - basically, it will check that the content of a control conforms to the schema definition for the mapped Element. However, it doesn't really do much if validation fails - it puts a dashed line around the element and you can see a tip as to what is wrong, but that is about it. You could do this in 2007 and 2010 as well.

    However, in this case none of the XML Structure is enforced, e.g. if your schema species that element b is a child of element a, nothing in Word verifies that a content control mapped to element b has to be inside a content control mapped to element a. (And in fact, such mapping was not possible in Word 2007 or 2010 because you could not nest mapped content controls inside any kind of content control that could also be mapped. That only became possible in Word 2013 when mappable repeating content controls came along and rich text controls became mappable. But there is still no enforcement of the XML structure, only some checking of the values of individual Elements.

    The properties related to the schema validation feature you describe are still there, in "hidden members" of the XMLSchemaReferences object, but as far as I can tell they can no longer be used (e.g. you cannot set
    ActiveDocument.XMLSchemaReferences.AutomaticValidation = True

    or

    ActiveDocument.XMLSchemaReferences.AllowSaveAsXMLWithoutValidation = False

    - you just get a "That property is not available on that object" error (5891). That's in Word 2016, anyway.



    Peter Jamieson

    Wednesday, March 14, 2018 11:12 PM

All replies

  • Hi Iyappan Nagarajan,

    This is the forum to discuss questions and feedback for Word for Developers, I'll move your question to the Technet forum for Word IT Pro Discussions

    https://social.technet.microsoft.com/Forums/office/en-US/home?forum=word

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, 
    and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.
     
    Thanks for your understanding.
    Monday, October 17, 2016 2:05 AM
  • Thanks David.
    Monday, October 17, 2016 4:55 AM
  • Hi,

    You validate XML data against an XML schema to ensure that any XML data that you import to or export from one or more cells in a mapped range in a worksheet conforms to the XML schema in the XML Source task pane.

    I tested in Word and 2013 and I also missed schema validation options in my environment.

    I suggest refer to my first paragraph and confirm if it will work for you.

    If your issue still exists, I suggest you give a feedback to Word user voice forum:

    https://word.uservoice.com/forums/304924-word-for-windows-desktop-application


    Regards,
    Emi Zhang
    TechNet Community Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Tuesday, October 18, 2016 7:06 AM
  • Hi Guys,

    Anyone knows fix for the above mentioned issue?

    does microsoft removed word 2013 validate against attached schema option?

    Wednesday, March 14, 2018 11:10 AM
  • Sorry, I couldn't solve this problem. 

    Problem Statement:

    Step1: 

    I have attached the xml in XML Mapping pane

    e.g:

    -a (parent)

      -b (child)

    Step2:

    I have added Schema file (.xsd) in add schema pane

    E.g: Something like this

    <a>

    <b></b>

    </a>

    Step 3: 

    I have added content control from xml mapping pane to word 2013.

    when ever user try to add <b> content from xml mapping directly its invalid as per my schema

    it should always comes inside <a> parent.

    Note:

    This kind of validation was possible since word 2007, in new word this feature is missing.

    Wednesday, March 14, 2018 11:18 AM
  • I believe that the feature you are looking for was removed at some point because of a legal judgment in the U.S. around 2009/2010.

    I forget the timing exactly and I may well have some of the details wrong, but...

    In the 2007 version, there used to be a facility for mapping parts of a document to elements in an XML schema that you installed in the "Office Schema Library". Microsoft used to refer to this as "Custom XML". There was a special mapping task pane that allowed you to map parts of the document to an attached schema.Mapping resulted in the insertion of tags that look a little bit like the tags that surround content controls in Design Mode, but these were not actually content controls. However, that mapping process forced you (more or less) to conform to the schema - i.e. Word checked the values of the tagged text against the schema and also checked the sequence of tags and so on.

    As a consequence of the legal judgment, Microsoft removed part of this feature - originally the ruling was that Microsoft could not sell Word "with the feature" in the U.S.A. so I *think* Word 2007 was modified at some point, at least for U.S. purchasers, then most of the feature was ditched in all copies of Word 2010. If you attempt this mapping in 2010 you will get a message when you try to close the document that Word will remove all the custom XML (or some such).

    The XML mapping feature in the Developer tab (since Word 2013 I think) does something different. It lets you map content controls to elements/attributes in a Custom XML Part. *If* you place a schema for that part in the Office Schema Library and attach it to the document, then Word will do some validation on each content control - basically, it will check that the content of a control conforms to the schema definition for the mapped Element. However, it doesn't really do much if validation fails - it puts a dashed line around the element and you can see a tip as to what is wrong, but that is about it. You could do this in 2007 and 2010 as well.

    However, in this case none of the XML Structure is enforced, e.g. if your schema species that element b is a child of element a, nothing in Word verifies that a content control mapped to element b has to be inside a content control mapped to element a. (And in fact, such mapping was not possible in Word 2007 or 2010 because you could not nest mapped content controls inside any kind of content control that could also be mapped. That only became possible in Word 2013 when mappable repeating content controls came along and rich text controls became mappable. But there is still no enforcement of the XML structure, only some checking of the values of individual Elements.

    The properties related to the schema validation feature you describe are still there, in "hidden members" of the XMLSchemaReferences object, but as far as I can tell they can no longer be used (e.g. you cannot set
    ActiveDocument.XMLSchemaReferences.AutomaticValidation = True

    or

    ActiveDocument.XMLSchemaReferences.AllowSaveAsXMLWithoutValidation = False

    - you just get a "That property is not available on that object" error (5891). That's in Word 2016, anyway.



    Peter Jamieson

    Wednesday, March 14, 2018 11:12 PM
  • Hi Peter,

    Do you mean even word 2016 or office 365 this feature wont work?


    Friday, March 16, 2018 6:27 AM
  • Yes, that is what I mean.

    Peter Jamieson

    Friday, March 16, 2018 8:35 AM