@Override public DocInitialization toInitialization() { return asOperation(); }
@Override public String toXmlString() { return DocOpUtil.toXmlString(asOperation()); }
private static IndexedDocumentImpl<Node, Element, Text, ?> doCopyDocument( IndexedDocumentImpl<Node, Element, Text, ?> other) { IndexedDocumentImpl<Node, Element, Text, ?> doc = new IndexedDocumentImpl<Node, Element, Text, Void>( RawDocumentImpl.PROVIDER.create("doc", Attributes.EMPTY_MAP), null, DocumentSchema.NO_SCHEMA_CONSTRAINTS); try { doc.consume(other.asOperation()); } catch (OperationException e) { throw new OperationRuntimeException("Copy should not fail", e); } return doc; }
private static IndexedDocumentImpl<Node, Element, Text, ?> doCopyDocument( IndexedDocumentImpl<Node, Element, Text, ?> other) { IndexedDocumentImpl<Node, Element, Text, ?> doc = new IndexedDocumentImpl<Node, Element, Text, Void>( RawDocumentImpl.PROVIDER.create("doc", Attributes.EMPTY_MAP), null, DocumentSchema.NO_SCHEMA_CONSTRAINTS); try { doc.consume(other.asOperation()); } catch (OperationException e) { throw new OperationRuntimeException("Copy should not fail", e); } return doc; }
/** * Tests the asOperation method. */ public void testAsOperation() { IndexedDocumentImpl<Node, Element, Text, ?> document = documentParser.parseDocument( "<blip><p><i>ab</i>cd<b>ef</b>gh</p></blip>"); DocInitialization expected = new DocInitializationBuilder() .elementStart("blip", Attributes.EMPTY_MAP) .elementStart("p", Attributes.EMPTY_MAP) .elementStart("i", Attributes.EMPTY_MAP) .characters("ab") .elementEnd() .characters("cd") .elementStart("b", Attributes.EMPTY_MAP) .characters("ef") .elementEnd() .characters("gh") .elementEnd() .elementEnd() .build(); document.asOperation(); assertEquals( DocOpUtil.toConciseString(expected), DocOpUtil.toConciseString(document.asOperation())); }
/** * Tests the asOperation method. */ public void testAsOperation() { IndexedDocumentImpl<Node, Element, Text, ?> document = documentParser.parseDocument( "<blip><p><i>ab</i>cd<b>ef</b>gh</p></blip>"); DocInitialization expected = new DocInitializationBuilder() .elementStart("blip", Attributes.EMPTY_MAP) .elementStart("p", Attributes.EMPTY_MAP) .elementStart("i", Attributes.EMPTY_MAP) .characters("ab") .elementEnd() .characters("cd") .elementStart("b", Attributes.EMPTY_MAP) .characters("ef") .elementEnd() .characters("gh") .elementEnd() .elementEnd() .build(); document.asOperation(); assertEquals( DocOpUtil.toConciseString(expected), DocOpUtil.toConciseString(document.asOperation())); }