Some colleagues and I would like to put together a grammar compendium to teach English grammar and would like to record the rules and examples in XML so as to increase the kinds of ways it can be utilized.

As with any XML, much of the work is defining the schema, what to leave out and what to leave in. Here is an example of the kind of XML we are looking to create:

    <title>Present Perfect</title>
        <rule title="Past actions with results/consequences in the present">
                <example answer="has eaten">Paul _____ all the cookies.</example>
                <example answer="has gone">Paul _____ to the basketball game.</example>

Does anyone know of an XML like this that represents grammar rules for the purpose of teaching grammar to people learning the language? (It's hard to search Google for this since XML is itself a kind of grammar which brings up many unwanted hits.)

  • 2
    I don't know of any such schema, and I don't think it possible to come up with a good one without defining the target uses more specifically. I suppose you need to give some thought to how you think your grammar could possibly be used and come back with some examples.
    – kamil-s
    Commented Mar 3, 2012 at 15:28
  • 2
    You say "I'm not looking for an XML that represents the grammar of the English language, but an XML that represents grammar rules". You should understand that in linguistics, 'grammar' and 'grammar rules' are the same thing, making your question a bit confusing. I think that what you mean is XML for the description and instruction of English grammar? Commented Mar 3, 2012 at 19:07
  • 1
    Yes, Mark, you are right, I am looking for an XML for "English grammar instruction". Commented Mar 4, 2012 at 7:40
  • Hi, Kamil, you are right, the group originally wanted to just write a grammar instruction text but we realized if we wrote it in XML instead of just typing it into a word processor, then it would have more uses, and wanted to get ideas some others who have developed this kind of XML already. Commented Mar 4, 2012 at 8:45

1 Answer 1


The Text Encoding Initiative (TEI) guidelines are probably the best choice.

The Text Encoding Initiative (TEI) is a consortium which collectively develops and maintains a standard for the representation of texts in digital form. Its chief deliverable is a set of Guidelines which specify encoding methods for machine-readable texts, chiefly in the humanities, social sciences and linguistics.

They define a modular XML schema to encode texts for a large number of use-cases, and I would guess it's the most widely used standard. There is no subset for grammar writing (there is one for dictionaries), but you could see if TEI Lite, or one of the other customizations meets your needs, and adapt that if needed. Some XML editors also come with built-in TEI schema support, which may be useful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.