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

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

Knitting Expression Language

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
  }
}


KnitML pattern transformation

To produce a readable pattern in a human language involves a three-step process:

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

In KnitML Core Tools 0.5.0 and later, rendering always includes validation, so a separate 'validate' step is no longer needed.

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.txt · Last modified: 2009/03/25 20:32 by fiddlinfool
Creative Commons License Knitting Knerds Geek Girls Stitching Bitches Purling Pimps Driven by DokuWiki