Behaviour adding custom schema to document selection in Word 2003.

T

Tim Scarfe

Hello All,

I have an application where I identify fragments of a document as
being a custom object as defined in my respective schema. I
right-click a document selection, go-to "Apply XML Element" and then
click on my schema object context (so far, so good).

The problem is that in some cases, Word will not surround my entire
selection with the schema object tags[1], it will instead break at an
arbitrary point between the start of the selection, and the end of the
selection.

I have tried adding a comment to the same fragment using the "Insert
Comment" facility, and it worked as expected[2].

After some research I found out that having a "Soft Break" before the
start of the selection seemed to be the cause of the problem.
Selecting from "Hard Break" to "Hard Break" seems to work in a
consistent fashion[3]. Judging that the behaviour is inconsistent with
that of inserting a "Comment", I thought that this could possibly be a
bug.

Another interesting thing to point out is that in the case with a
"Soft Break", the background colour of the enclosing XML elements (in
the Word application environment) is of a darker shade than that of
the example preceded with a "Hard Break". This leads me to think that
this behaviour is somehow by design but I don't understand how it
works.

I understand the likelihood of XML such as follows being generated
under the covers (which might explain the strange choice of
behaviour):

<regulation>
<p>this is invalid XML
</regulation>
</p>

I would very much appreciate some further insight on this matter.

Kind Regards,

trs

[1] http://www.developer-x.com/test/word/wordregbug.JPG
[2] http://www.developer-x.com/test/word/wordcomment.JPG
[3] http://www.developer-x.com/test/word/wordcomment.JPG

P.S. I have made a copy of said document available as a test case
located at:

http://www.developer-x.com/ssi2000323.doc (Section 29(5)(b))
 
M

Mary McRae

Hi Tim,

It looks like you have the XML Toolbox installed; if you view the raw XML
for selections where the custom elements are outlined and then where they're
solid you'll see that the difference is in the way the WordML is coded. In
one instance, the custom element name is inside the w:p element (this is
considered a "run-level" element and is solid; the end element tag doesn't
include the element name); in another, the custom element name surrounds the
w:p (this is considered a "block-level" element and is outline). If you're
going to have mixed content, you need to make sure you're inside a
"run-level" element.

I hope this at least clarifies the tag display if nothing else!
 

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