/** * Creates an IndexedDocument from the provided operation, with the provided * handler installed to receive document events. */ public IndexedDocument<N, E, T> build(DocInitialization operation, DocumentSchema schema, DocumentHandler<N, E, T> handler) throws OperationException { ObservableIndexedDocument<N, E, T, ?> doc = new ObservableIndexedDocument<N, E, T, Void>(handler, substrateProvider.create("doc", Attributes.EMPTY_MAP), schema); doc.consume(operation); return doc; } }
private void create(String xml) { RawDocumentImpl raw = DocProviders.ROJO.parse("<d>" + xml + "</d>"); RawDocumentImpl raw2 = DocProviders.ROJO.parse("<d>" + xml + "</d>"); indexed = new ObservableIndexedDocument<Node, Element, Text, Void>(handler, raw, null, DocumentSchema.NO_SCHEMA_CONSTRAINTS); indexedCopy = new ObservableIndexedDocument<Node, Element, Text, Void>( handler2, raw2, null, DocumentSchema.NO_SCHEMA_CONSTRAINTS); doc = new MutableDocumentImpl<Node, Element, Text>( new OperationSequencer<Nindo>() { @Override public void begin() { } @Override public void consume(Nindo op) { try { consumeNindo(op); } catch (OperationException e) { throw new OperationRuntimeException("Bug!", e); } } @Override public void end() { } }, testNindoConsume ? indexed : indexedCopy); root = doc.getDocumentElement(); }
private void create(String xml) { RawDocumentImpl raw = DocProviders.ROJO.parse("<d>" + xml + "</d>"); RawDocumentImpl raw2 = DocProviders.ROJO.parse("<d>" + xml + "</d>"); indexed = new ObservableIndexedDocument<Node, Element, Text, Void>(handler, raw, null, DocumentSchema.NO_SCHEMA_CONSTRAINTS); indexedCopy = new ObservableIndexedDocument<Node, Element, Text, Void>( handler2, raw2, null, DocumentSchema.NO_SCHEMA_CONSTRAINTS); doc = new MutableDocumentImpl<Node, Element, Text>( new OperationSequencer<Nindo>() { @Override public void begin() { } @Override public void consume(Nindo op) { try { consumeNindo(op); } catch (OperationException e) { throw new OperationRuntimeException("Bug!", e); } } @Override public void end() { } }, testNindoConsume ? indexed : indexedCopy); root = doc.getDocumentElement(); }