/** * Creates an operation to insert the XML fragment * "<a href=\"http://www.google.com/\">google</a>". * * @param location The location at which the insert the fragment. * @return The operation. */ private static Nindo structuralSample5(int location) { Attributes attributes = new AttributesImpl( Collections.singletonMap("href", "http://www.google.com/")); Nindo.Builder builder = new Nindo.Builder(); builder.skip(location); builder.elementStart("a", new AttributesImpl(attributes)); builder.characters("google"); builder.elementEnd(); return builder.build(); }
/** * Creates an operation to insert the XML fragment * "<a href=\"http://www.google.com/\">google</a>". * * @param location The location at which the insert the fragment. * @return The operation. */ private static Nindo structuralSample5(int location) { Attributes attributes = new AttributesImpl( Collections.singletonMap("href", "http://www.google.com/")); Nindo.Builder builder = new Nindo.Builder(); builder.skip(location); builder.elementStart("a", new AttributesImpl(attributes)); builder.characters("google"); builder.elementEnd(); return builder.build(); }
public void testInsertionThenDeletionWithAnnotations() throws OperationException { IndexedDocument<Node, Element, Text> doc = DocProviders.POJO.parse("abcdefg"); Nindo.Builder b; b = new Nindo.Builder(); b.skip(1); b.startAnnotation("a", "2"); b.skip(2); b.endAnnotation("a"); checkApply(doc, b.build()); b = new Nindo.Builder(); b.skip(1); b.startAnnotation("a", null); b.characters("x"); b.deleteCharacters(1); b.skip(1); b.endAnnotation("a"); checkApply(doc, b.build()); }
public void testAnnotationThroughInsertionEndingInDeletion() throws OperationException { IndexedDocument<Node, Element, Text> doc = DocProviders.POJO.parse("abcdefg"); Nindo.Builder b; b = new Nindo.Builder(); b.skip(1); b.startAnnotation("a", "2"); b.skip(1); b.endAnnotation("a"); checkApply(doc, b.build()); b = new Nindo.Builder(); b.skip(1); b.startAnnotation("a", "1"); b.characters("x"); b.deleteCharacters(1); b.endAnnotation("a"); checkApply(doc, b.build()); }
public void testAnnotationThroughInsertionFollowedByDeletion() throws OperationException { IndexedDocument<Node, Element, Text> doc = DocProviders.POJO.parse("abcdefg"); Nindo.Builder b; b = new Nindo.Builder(); b.skip(1); b.startAnnotation("a", "2"); b.skip(1); b.endAnnotation("a"); checkApply(doc, b.build()); b = new Nindo.Builder(); b.skip(1); b.startAnnotation("a", "1"); b.characters("x"); b.endAnnotation("a"); b.deleteCharacters(1); checkApply(doc, b.build()); }
public void testAnnotationThroughInsertionEndingInDeletion() throws OperationException { IndexedDocument<Node, Element, Text> doc = DocProviders.POJO.parse("abcdefg"); Nindo.Builder b; b = new Nindo.Builder(); b.skip(1); b.startAnnotation("a", "2"); b.skip(1); b.endAnnotation("a"); checkApply(doc, b.build()); b = new Nindo.Builder(); b.skip(1); b.startAnnotation("a", "1"); b.characters("x"); b.deleteCharacters(1); b.endAnnotation("a"); checkApply(doc, b.build()); }
/** * Creates an operation to insert the XML fragment "12<u>34</u>56". * * @param location The location at which the insert the fragment. * @return The operation. */ private static Nindo structuralSample1(int location) { Nindo.Builder builder = new Nindo.Builder(); builder.skip(location); builder.characters("12"); builder.elementStart("u", Attributes.EMPTY_MAP); builder.characters("34"); builder.elementEnd(); builder.characters("56"); return builder.build(); }
/** * Creates an operation to insert the XML fragment "<i>hello</i><b>world</b>". * * @param location The location at which the insert the fragment. * @return The operation. */ private static Nindo structuralSample4(int location) { Nindo.Builder builder = new Nindo.Builder(); builder.skip(location); builder.elementStart("i", Attributes.EMPTY_MAP); builder.characters("hello"); builder.elementEnd(); builder.elementStart("b", Attributes.EMPTY_MAP); builder.characters("world"); builder.elementEnd(); return builder.build(); }
/** * Creates an operation to insert the XML fragment "12<u>34</u>56". * * @param location The location at which the insert the fragment. * @return The operation. */ private static Nindo structuralSample1(int location) { Nindo.Builder builder = new Nindo.Builder(); builder.skip(location); builder.characters("12"); builder.elementStart("u", Attributes.EMPTY_MAP); builder.characters("34"); builder.elementEnd(); builder.characters("56"); return builder.build(); }
public void testInsertionThenDeletionWithAnnotations() throws OperationException { IndexedDocument<Node, Element, Text> doc = DocProviders.POJO.parse("abcdefg"); Nindo.Builder b; b = new Nindo.Builder(); b.skip(1); b.startAnnotation("a", "2"); b.skip(2); b.endAnnotation("a"); checkApply(doc, b.build()); b = new Nindo.Builder(); b.skip(1); b.startAnnotation("a", null); b.characters("x"); b.deleteCharacters(1); b.skip(1); b.endAnnotation("a"); checkApply(doc, b.build()); }
/** * Creates an operation to insert the XML fragment "<i>hello</i><b>world</b>". * * @param location The location at which the insert the fragment. * @return The operation. */ private static Nindo structuralSample4(int location) { Nindo.Builder builder = new Nindo.Builder(); builder.skip(location); builder.elementStart("i", Attributes.EMPTY_MAP); builder.characters("hello"); builder.elementEnd(); builder.elementStart("b", Attributes.EMPTY_MAP); builder.characters("world"); builder.elementEnd(); return builder.build(); }
public void testAnnotationThroughInsertionFollowedByDeletion() throws OperationException { IndexedDocument<Node, Element, Text> doc = DocProviders.POJO.parse("abcdefg"); Nindo.Builder b; b = new Nindo.Builder(); b.skip(1); b.startAnnotation("a", "2"); b.skip(1); b.endAnnotation("a"); checkApply(doc, b.build()); b = new Nindo.Builder(); b.skip(1); b.startAnnotation("a", "1"); b.characters("x"); b.endAnnotation("a"); b.deleteCharacters(1); checkApply(doc, b.build()); }
private Builder insertText(String text, Builder builder) { builder.characters(text); return builder; }
@Override public void characters(String chars) { b.characters(chars); }
public void testEndBeforeAndStartAfterDeletionThenInsertion() throws OperationException { IndexedDocument<Node, Element, Text> doc = DocProviders.POJO.parse("abcdefg"); Nindo.Builder b; b = new Nindo.Builder(); b.skip(1); b.startAnnotation("a", null); b.skip(1); b.endAnnotation("a"); b.deleteCharacters(1); b.startAnnotation("a", "1"); b.characters("x"); b.endAnnotation("a"); checkApply(doc, b.build()); }
public void testChangeBetweenInsertionAndDeletion() throws OperationException { IndexedDocument<Node, Element, Text> doc = DocProviders.POJO.parse("abcdefg"); Nindo.Builder b; b = new Nindo.Builder(); b.skip(1); b.startAnnotation("a", "1"); b.characters("x"); b.startAnnotation("a", "2"); b.deleteCharacters(1); b.skip(1); b.endAnnotation("a"); checkApply(doc, b.build()); }
public void testChangeBetweenInsertionAndDeletion() throws OperationException { IndexedDocument<Node, Element, Text> doc = DocProviders.POJO.parse("abcdefg"); Nindo.Builder b; b = new Nindo.Builder(); b.skip(1); b.startAnnotation("a", "1"); b.characters("x"); b.startAnnotation("a", "2"); b.deleteCharacters(1); b.skip(1); b.endAnnotation("a"); checkApply(doc, b.build()); }
public void testEndBeforeAndStartAfterDeletionThenInsertion() throws OperationException { IndexedDocument<Node, Element, Text> doc = DocProviders.POJO.parse("abcdefg"); Nindo.Builder b; b = new Nindo.Builder(); b.skip(1); b.startAnnotation("a", null); b.skip(1); b.endAnnotation("a"); b.deleteCharacters(1); b.startAnnotation("a", "1"); b.characters("x"); b.endAnnotation("a"); checkApply(doc, b.build()); }
public void testOpenInsertOpenClose() throws OperationException { IndexedDocument<Node, Element, Text> doc = DocProviders.POJO.parse("abcdefg"); Nindo.Builder b; b = new Nindo.Builder(); b.skip(1); b.startAnnotation("a", "1"); b.characters("xyz"); b.startAnnotation("a", "1"); b.endAnnotation("a"); checkApply(doc, b.build()); }
public void testOpenInsertOpenClose() throws OperationException { IndexedDocument<Node, Element, Text> doc = DocProviders.POJO.parse("abcdefg"); Nindo.Builder b; b = new Nindo.Builder(); b.skip(1); b.startAnnotation("a", "1"); b.characters("xyz"); b.startAnnotation("a", "1"); b.endAnnotation("a"); checkApply(doc, b.build()); }