How to spell check the text within particular tags in XML document

N

Nick Miller

I have an XML document which I would like to spell-check. The document is a
bunch of definition of screens for a user interface.

If I spell check the whole thing, I get a lot of false positives. Word tries
to spell check all the xml tags themselves, rather than just the text inside
them.

Does anybody have any ideas about how to spell check the text inside the tags?

Thanks,
Nick
 
J

Jay Freedman

On Wed, 7 Jan 2009 15:40:11 -0800, Nick Miller <Nick
I have an XML document which I would like to spell-check. The document is a
bunch of definition of screens for a user interface.

If I spell check the whole thing, I get a lot of false positives. Word tries
to spell check all the xml tags themselves, rather than just the text inside
them.

Does anybody have any ideas about how to spell check the text inside the tags?

Thanks,
Nick

There are probably other ways, but I think I would do as follows:

Define a character style that consists of Default Paragraph Formatting plus "Do
not check spelling or grammar".

Run a wildcard Replace to find anything within matched angle brackets (on the
assumption that all such items are tags) and apply the character style to it.
Caution: the angle brackets have special meaning in wildcard search expressions,
so they have to be 'escaped' by a backslash -- see
http://www.gmayor.com/replace_using_wildcards.htm.

Then run an ordinary spell check, which will skip everything marked with the
character style.
 
N

Nick Miller

Jay,

Thanks heaps for this. It works pretty well, and has probably saved a few
thousand $ of billable time!

I searched for this:

\</caption\>*\<caption\>

This finds all the text _outside_ the the <caption> tags, except the text
at the beginning and ends of the XML doc (because there is no closing caption
tag).

Nick
 

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