Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Office Content Control Schema Violations

From: "Greg Maxey" <gmaxey@--------------------.-------------->
To: NULL
Date: 11/9/2009 8:16:00 AM
The links to the images appear broken.  Please see:

http://gregmaxey.mvps.org/images/Schema_violations.png

http://gregmaxey.mvps.org/images/No_schema_violations.png

http://gregmaxey.mvps.org/images/Problem_validation.png

Sorry.


Greg Maxey wrote:
> Hi,
>
> Taking a shot in the dark here in hopes someone may have a solution.
>
> I attempting to validate the data entered in Microsoft Word Content
> Controls (CC)  using an attached schema.  I can map a CC to a
> CustomXMLPart, attach a schema and detect violations.  CC schema
> violations are flagged in the document with a red dashed box outline.
>
> Does anyone know how to count those boxes programmatically or
> otherwise determine if one or more CC schema violations exist in a
> document?
> My real objective is to create functional, robust CC validation
> process. The schema validation method works great, but it has no
> teeth so to speak. All it does
> is flag the violations.  If I could somehow count those violations
> then I could prevent a user from doing things like save, print, etc
> until valid entries are present.
>
> There is a property:
>
> ActiveDocument.XMLSchemaViolations that I could use for this purpose.
> For example, I could prevent saving the document using:
>
> Sub FileSave()
> If ActiveDocument.XMLSchemaViolations.Count > 0 Then
>  MsgBox "Please correct errors before attempting to save or print this
> document."
>  Exit Sub
> Else
>  ActiveDocument.Save
> End If
> End Sub
>
> This counts document schema violation (i.e., XML tags applied
> directly to plain text in the document), but this doesn't detect
> violations in Content Controls.
>
> I have also tried applying the XML tags directly to the CC range.  But
> again, the violations are not detected. I don't know that much about
> XML so I could be applying the tags incorrectly.
>
> I have posted some pictures on my website to illustrate the problem.
>
>
> http://gregmaxey.mvps.org/images/Schema violations.png
>
>
>
> Sub CountViolaion()
> MsgBox ActiveDocument.XMLSchemaViolations.Count
> End Sub
>
>
> Returns 1. There are clearly 2 violations present.
>
>
>
> http://gregmaxey.mvps.org/images/No schema violations.png
>
>
>
> Sub CountViolaion()
> MsgBox ActiveDocument.XMLSchemaViolations.Count
> End Sub
>
>
>
>
> Returns 0. Actual conditions.
>
>
>
> http://gregmaxey.mvps.org/images/Problem validation.png
>
>
> Sub CountViolaion()
> MsgBox ActiveDocument.XMLSchemaViolations.Count
> End Sub
>
>
>
>
> Returns 0. Now it doesn't even detect the direct XML tags.
>
>
>
> If I could somehow detect programmatically the schema violation shown
> in the last illustration then I could add some teeth to my validation
> process.
>
>
> Thanks for your interest and replies.

-- 
Greg Maxey

See my web site http://gregmaxey.mvps.org
for an eclectic collection of Word Tips.

Arrogance is a weed that grows mostly on a dunghill (Arabic proverb)





transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent