Translations of this page?:
{{{ knitml }}}

This is an old revision of the document!


KnitML

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.

Vision

In his KnitML blog post Jonathan formulated his vision of what KnitML should be able to accomplish:

  • Render a pattern in either written directions or a chart, depending entirely on your preference
  • Render a pattern in any language, using conventions familiar to that language and dialect
  • Automatically convert English measurements to metric
  • Size a pattern up or down to any size, not just the sizes that come with the pattern
  • Recalculate a pattern for your gauge rather than the one that came with the pattern
  • Explicitly write out highly annoying directions (e.g., “increase 34 stitches evenly over 171 stiches”)
  • Alter the pattern using an easy-to-use graphical editor (or create new KnitML-based pattern from scratch)
  • Preview the result of the pattern with pretty graphics
  • Digitally sign the pattern to guarantee an author's authenticity

Features

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.

KnitML Core Tools

This package contains:

  • KnitML parsers (for both XML and the Knitting Expression Language format)
  • a validation engine to ensure that the pattern provided is knittable
  • A renderer than can produce human language knitting instructions (currently in English and Spanish)
  • Command line utilities

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

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.

Gauge Transformer

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).

KnitML Specification

The KnitML specification provides a standardized format to write hand knitting instructions in a computer-readable way. It is firmly rooted in the western tradition of process-based crafting notation.

This makes it easy to translate certain hand knitting instructions directly to KnitML.

Unfortunately this does not provide for the universality inherent in structure based crafting notations, like those used in industrial knitting standards (JIS L 0201-1995).

Knitting Expression Language

While early KnitML was XML-only, The Knitting Expression Language (KEL) has been added to allow for a more compact wiki-style notation of knitting patterns. 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
  }
}


KnitML transformation

KnitML transformation is a three-step process:

  • convert (KEL to KnitML)
  • validate (the KnitML)
  • render (to knitting instructions, in plaintext or HTML)

Standardization by Implementation

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.

Web Links

Introduction

Docs and Specs

wiki/knitml.1238003961.txt.gz · Last modified: 2009/03/25 17:59 by fiddlinfool
Creative Commons License Knitting Knerds Geek Girls Stitching Bitches Purling Pimps Driven by DokuWiki