IndexedDocument<Node, Element, Text> createDocument() throws OperationException { return DocProviders.POJO.build(content, schema, handlerManager); } }
/** * Checks whether two strings are representations of equivalent documents. The * strings need not be normalized. * * @param flags specifies the aspects to compare for equivalence * @return true if the strings represent equivalent documents, based on the * types of things that are important as given by the flags */ public static <N, E extends N, T extends N> boolean equivalent(int flags, String a, String b) { return structureEquivalent(flags, DocProviders.POJO.parse(a), DocProviders.POJO.parse(b)); }
@Override public MutableDocumentImpl<Node, Element, Text> create(String tagName, Map<String, String> attributes) { IndexedDocument<Node, Element, Text> doc = POJO.create(tagName, attributes); return new MutableDocumentImpl<Node, Element, Text>(createTrivialSequencer(doc), doc); }
checkAuto = bootstrapDoc; } else { IndexedDocument<Node, Element, Text> indexedDoc = DocProviders.POJO.parse(""); checkDocOpProvider = indexedDoc; checkDoc = indexedDoc; IndexedDocument<Node, Element, Text> copy = DocProviders.POJO.build(docAsOp, DocumentSchema.NO_SCHEMA_CONSTRAINTS); BootstrapDocument copy2 = new BootstrapDocument();
/** * @param substrateProvider * @return An IndexedDocProvider which will provide indexed docs based on the given * substrate provider. */ public static <N, E extends N, T extends N, D extends RawDocument<N, E, T>> IndexedDocProvider<N, E, T, D> create(RawDocument.Provider<D> substrateProvider) { return new IndexedDocProvider<N, E, T, D>(substrateProvider); }
@Override public IndexedDocument<N, E, T> create(String tag, Map<String, String> attributes) { return adapt(((RawDocument.Factory<D>) substrateProvider).create(tag, attributes), NO_SCHEMA_CONSTRAINTS); }
checkAuto = bootstrapDoc; } else { IndexedDocument<Node, Element, Text> indexedDoc = DocProviders.POJO.parse(""); checkDocOpProvider = indexedDoc; checkDoc = indexedDoc; IndexedDocument<Node, Element, Text> copy = DocProviders.POJO.build(docAsOp, DocumentSchema.NO_SCHEMA_CONSTRAINTS); BootstrapDocument copy2 = new BootstrapDocument();
/** * Same as {@link #createFromXmlString(String)}, but with constraints on characters. * @param xmlContent */ public static XmlStringBuilder createFromXmlStringWithContraints(String xmlContent, PermittedCharacters permittedChars) { return XmlStringBuilder.innerXml(DocProviders.POJO.parse(xmlContent), permittedChars); }
private static IndexedDocument<Node, Element, Text> getEmptyDocument() { return DocProviders.POJO.build(EmptyDocument.EMPTY_DOCUMENT, NO_SCHEMA_CONSTRAINTS); }
@Override public Document create(String tagName, Map<String, String> attributes) { IndexedDocument<Node, Element, Text> doc = DocProviders.POJO.create(tagName, attributes); return new DocumentImpl(DocProviders.createTrivialSequencer(doc), doc); }
/** * Constructs a builder from a string containing a bit of xml * @param xmlContent the xml content * @return new {@link XmlStringBuilder} with the xml as content */ public static XmlStringBuilder createFromXmlString(String xmlContent) { return XmlStringBuilder.innerXml(DocProviders.POJO.parse(xmlContent)); }
@Override public IndexedDocument<N, E, T> parse(String text) { DocInitialization docInitialization; try { docInitialization = DocOpUtil.docInitializationFromXml(text); } catch (XmlParseException e) { throw new IllegalArgumentException(e); } return build(docInitialization, NO_SCHEMA_CONSTRAINTS); }
@Override public ObservablePluggableMutableDocument create( String tagName, Map<String, String> attributes) { // FIXME(ohler): this is inefficient. return build(DocProviders.POJO.create(tagName, attributes).asOperation()); }
private static SuperSink parse(String xml) { return DocProviders.POJO.parse(xml); }
private final DocumentSchema schema = schemas.getSchemaForId(waveletId, docId); private final IndexedDocument<Node, Element, Text> document = DocProviders.POJO.build(content, schema);
private static IndexedDocument<Node, Element, Text> createEmptyDocument() { return DocProviders.POJO.parse(""); }
/** * Creates a document which applies generated operations to a copy of * itself, thus ensuring those ops are valid when received remotely. */ public static Document createValidatingDocument(DocumentSchema schema) { IndexedDocument<Node, Element, Text> indexedDoc = POJO.build(new DocInitializationBuilder().build(), schema); return new DocumentImpl(createCopyingSequencer(indexedDoc), indexedDoc); }
private static SuperSink parse(String xml) { return DocProviders.POJO.parse(xml); }
/** * Creates a sequencer that applies outgoing operations to a copy of the given * document, ensuring that both incoming and outgoing ops are valid. * * This is not implemented efficiently, intended for use in unit tests only. * * @param doc document to copy */ public final static <N, E extends N> OperationSequencer<Nindo> createCopyingSequencer( IndexedDocument<N, E, ? extends N> doc) { final IndexedDocument<Node, Element, Text> copy = POJO.build( doc.asOperation(), doc.getSchema()); return createTrivialSequencer(doc, new OperationSink<DocOp>() { @Override public void consume(DocOp op) throws OperationException { // Should throw exceptions if the op is invalid. copy.consume(op); } }); }
private static SuperSink parse(String xml) { return DocProviders.POJO.parse(xml); }