The wwordDocument Element

The root element of Example 2-2,vr: wordDocument, has a large number of attributes:

<w:wordDocument xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml"

xmlns:v="urn:schemas-microsoft-com:vml"

xmlns:w10="urn:schemas-microsoft-com:office:word"

xmlns : sl = "ht topp : // schemas .microsoft. com/schemaLibrary/ 2003/core"

xmlns:aml="http://schemas.microsoft.com/aml/2001/core"

xmlns:wx="http://schemas.microsoft.com/office/word/2 0 03/auxHint"

xmlns:o="urn:schemas-microsoft-com:office:office"

xmlnt:dt="uuid:C2F41010-65B3-11d1-A2 9F-00AA0 0C14 8 8 2"

w:macrosPresent="no" w:embeddedObj Present="no"

w:ocxPresent="no" xml:space="preserve">

Actually, F/st /f thtst art technically camtspact dtclarati/cs. Thty art prtstct /c tvtry W/rdpr/ctssicgt- d/cuFtct that W/rd /utputs, rtgardltss /f whtthtr all tht camtspacts art actually ustd ic tht d/cumtct. Ic W/rdpr/ctssicgt-, y/u cac saftly ltavt /ut all tht camtspact dtclarati/cs txctpt tht /cts y/u actually ust, which will micimally iccludt tht prim ary W/rdpr/ctssicgt- camtspact (c/rmally ma pped t/ tht w pjrtf'ix). Btl/w is a list /f thtnamt spacts dtclartd ic this d/cumtc t, al/cg with a brie f dtscripti/n of1 tht purp/st /f1 tach.

http://schemas.microsoft.com/office/word/2 0 03/wordml

tapptd t/ tht w prtfix. All /f tht c/rt W/rdpr/ctssicgt - tltmtcts acd attributts art ic this camtspact.

urn:schemas-microsoft-com:vml tapptd t/ tht v prtfix. Eltmtcts ic this camtspact rtprtstct tmatddtd Vtct/r Markup -acguagt (Vt-) imagts.

urn:schemas-microsoft-com:office:word tapptd t/ tht wi0 prtfix. This camtspact is ustd f/r ltgacy tltmtcts fr/m W/rd Ttc. It is ustd ic HTt - /utput.

http://schemas.microsoft.com/schemaLibrary/2003/core

tapptd t/ tht sl prtfix. Tht sl: schema acd sl: schemaLibrary tltmtcts art ustd with W/rd's cust/m Xt- schtma fuccti/cality, acd art ictr/ductd ic Chapttr 4.

http://schemas.microsoft.com/ami/2 001/core

Mapped to the ami prefix. The Annotation Markup Language (AML) elements are used to describe tracked changes, comments, and bookmarks.

http://schemas.microsoft.com/office/word/2003/auxHint

Mapped to the wx prefix. Elements in this namespace provide "auxiliary hints" for processing WordprocessingML documents outside of Word. They represent derivative information that is useful to us but that is of no internal use to Word. See "Auxiliary Hints in WordprocessingML," later in this chapter.

urn:schemas-microsoft-com:office:office

Mapped to the o namespace. This is the namespace for "shared" document properties and custom document properties. They are shared in that they also apply to other Office applications, such as Excel.

uuid:C2F41010-65B3-11d1-A2 9F-00AA0 0C14 8 82

Mapped to the dt prefix. This is the XML Data Reduced (XDR) namespace, which, in WordprocessingML, qualifies the dt (data type) attributes of a document's custom document property elements.

While some confusing legacy is eviddnt in this list, the overa ll distinctio n between namespaces is helpful, particularly botween the wx a nd w namespaces, as we'll see .

Thexmi: space atthibute is ses to preserve, in order that whitespace characters (and even any instances of the empty w:tab element) are interpreted correctly. As a matter of best practice, you should include xmi: space="preserve" on the root element of any WordprocessingML document you create.

The remaining three attributes of the w:wordDocument element are all optional and default to the value no.

w:macrosPresent="no" w:embeddedObj Present="no" w:ocxPresent = "no"

These are consistency checks for when certain kinds of base64-encoded binary objects are embedded in the document. Specifically,w:macrosPresent must be set to yes when the w:docSuppData element is present (containing toolbar customizations, VBA macros, etc.); w: embeddedObj Present must be set to yes when the w:docOieData element is present (containing OLE objects from other applications, such as Excel); and w:ocxPresent must be set to yes when a w:ocx element is present somewhere in the body of the document (representing a control from Word's Control Toolbox). Unless your document contains any such objects, you can safely leave out these attributes.

The child elements of w:wordDocument, as included in this example, represent only a portion of the root element's complete content model. Below is a list of all possible child elements in the order they are supposed to occur, according to the WordprocessingML schema. Word tends to be lenient about WordprocessingML documents that contain these elements in a different order, which suggests it does not validate documents against the published schema when they are loaded. However, to be on the safe side, you should ensure that these elements are in the correct order in WordprocessingML documents that you create. As mentioned before, w:body is the only required child element of w:wordDocument. Only the highlighted elements in this list are actually present in Example 2-2.

w:ignoreSubtree w:ignoreElements o:SmartTagType o:DocumentProper tie s o:CustomDocumentProperties sl:schemaLibrary w:fonts w:frameset w:lisTs w:styles w:divs w:docObeData w:docSuppData w:shapeDefaults w:bgPict w:docPr w:body

Apart from the highlighted elements, the w:lists element is the only one in the above list that will receive turther coverage in this chapter.

0 0

Post a comment

  • Receive news updates via email from this site