KnitML is an XML-based standard for hand knitting. Original development is mostly driven by Jonathan Whitall, but it's intended as an open, community-supported specification.
In his KnitML blog post Jonathan formulated his vision of what KnitML should be able to accomplish:
What resulted from this KnitML initiative is not an XML standard in the strict sense but rather a reference implementation that aims to achieve all of the envisioned features and which is implemented in Java.
This package contains:
Version 0.5.0 of KnitML Core Tools will be able to produce knitting charts in HTML, based on a user-provided knitting-stitch font or text art.
GPEC is a standalone visual editor incorporating the functionality of the KnitML Core Tools based on the Eclipse Framework.
GPEC is short for Graphical Pattern Editor and Composer. Note, that the term graphical only means that GPEC is a Graphical User Interface for the commandline tools. It does (currently) not have a graphical editor for knitting charts.
Knitting-instructions usually refer to a certain stitch gauge. But your actual gauge may vary depending on yarn, needle size, and knitting style. The KnitML gauge transformer can transform a KnitML instruction with a predefined gauge to one that matches your personal gauge (which you can find out by knitting a test swatch).
The KnitML specification provides a format to write hand knitting instructions in a way that computers can also understand. It focuses on expressing the process of creating a knitted object from the viewpoint of the pattern designer. This makes it easy to translate certain hand knitting instructions directly to KnitML.
It was not intended to express the structure of the object produced. It is therefore unlikely to be directly applicable to structure-based crafting notations, like those used in industrial knitting standards (JIS L 0201-1995).
While early KnitML was only XML based, the Knitting Expression Language (KEL) has been added to allow for more direct expression.
The syntax of KEL (formerly known as GroovyKnit) was heavily inspired by Groovy, a Java scripting language.
Here is a code snippet for a simple test swatch:
Pattern 'en' {
GeneralInformation {
Name: 'Simple Square'
Description: 'A simple square'
Dimensions: '4 in by 4 in'
Gauge 'stockinette' {
StitchGauge: 6 stitchesPerInch
RowGauge: 6 rowsPerInch
}
}
Supplies {
Yarns {
YarnType 'the-yarn-type' [weight:'worsted']
}
Needles {
NeedleType 'size-4' circular { size: 4 US }
Needle 'the-needle' [typeref:'size-4']
}
Accessories
}
Directions {
CastOn 24
Instruction 'stockinette-st' {
Row: k to end
Row: p to end
}
Repeat 'stockinette-st' until measures 4 in
NextRow: BindOff all sts
}
}
To produce a readable pattern in a human language involves a three-step process:
In KnitML Core Tools 0.5.0 and later, rendering always includes validation, so a separate 'validate' step is no longer needed.
XML standards usually result in the publication of a DTD, or an XML Schema which may then be used by standard XML tools to validate and transform data provided in the new XML-based format.
Since most hand-knitters are not used to the process of developing a standard from scratch, standardization by implementation is actually a very sensible approach. The reference implementation can be used in the field to find out which features are relevant to hand-knitters and modify the KnitML language accordingly.