Bind Word document to an XML schema

A

Angus

Hello

We are a software house and want to store application options in an
xml file. Eg application name, version, description, etc. I have
developed a schema and someone had the bright idea of binding a Word
document to this schema? Then we can use Word as a front end and
enter values and save as an individual xml file.

Is this possible?

How about creating separate xml files for each application? how would
that work?

Any help would be much appreciated.

Angus
 
P

Peter Jamieson

It's possible to do this in Word 2003 (not sure about the most basic
version) and Word 2007.

However, to get you started, your schema will need to be an XML Schema
type schema (not, e.g., a Relax-NG schema), typically a .xsd file. In
Word 2003, you then need to...
a. go to Tools->Templates and Addins->XML Schema
b. Add Schema
c. locate the schema you want to use, and type in a URI and an alias
(used locally by Word). Ensure that the new schema is checked in the list
d. You should then see the XML Structure task pane, which lets you
insert "tags" that correspond to the elements in your Schema (Word isn't
so hot when it comes to maintaining XML Attributes, which is a factor
you may need to take into consideration). Insert the tags needed to
conform to your schema - Word should flag errors where the structure
and/or content do not match.
e. save your document - assuming you want to create "tear-off" copies,
save it as a Word template, e.g. in .doc format. If yu want to see what
it looks like in WordProcessingML, save it as XML document format, but
uncheck the Save Data Only option.
f. You should now be able to create new documents based on that
template. However, when you save the document, choose XML Document formt
(*.xml) and ensure the Save Data Only option is checked. The saved
document /should/ then be an XML document, containing no
WordProcessingML, that complies with your XML schema.

In Word 2007 the process is similar, but you start with the Developer
tab (you can enable this in Word Office Button->Word
options->Popular->"Show Developer tab in the ribbon" if you do not see
it) and click Structure to see the structure pane.

That's the basic approach. It is possible to "add value" to XML
documents by developing "Smart Documents" - that's really a developer
activity and you should start looking around MSDN for further info. on
that. Smart Documents can be developed in VBA but on the whole you'll
probably be better off using VB.NET or Csharp.NET to do it.

Peter Jamieson

http://tips.pjmsn.me.uk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top