public void simple2() {
        //the following line works inside process(Document, Arguments, Processing) in a DocumentProcessor
        AnnotationTypeRegistry atr = processing.getService().getDocumentTypeManager().getAnnotationTypeRegistry();

        StringFieldValue text = new StringFieldValue("<html><head><title>Diary</title></head><body>I live in San Francisco</body></html>");
                                                    //012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
        AnnotationType textType = atr.getType("text");
        AnnotationType markup = atr.getType("markup");

        SpanList root = new SpanList();
        SpanTree tree = new SpanTree("html", root);


        Span span1 = new Span(0, 19);
        root.add(span1);
        tree.annotate(span1, markup);

        Span span2 = new Span(19, 5);
        root.add(span2);
        tree.annotate(span2, textType);

        Span span3 = new Span(24, 21);
        root.add(span3);
        tree.annotate(span3, markup);

        Span span4 = new Span(45, 23);
        root.add(span4);
        tree.annotate(span4, textType);

        Span span5 = new Span(68, 14);
        root.add(span5);
        tree.annotate(span5, markup);


        text.setSpanTree(tree);
    }
Contains code snippets that are used in the documentation. Not really a test case.

@author Einar M R Rosenvinge
document/src/test/java/com/yahoo/document/annotation/DocTestCase.java