Package dev.omnist.oml
Class OmlWriter
java.lang.Object
dev.omnist.oml.OmlWriter
OML (Omnist Markup Language) Canonical Writer (omnist-spec §4 and §9.5).
Serializes a
Document into canonical OML text format.-
Method Summary
Modifier and TypeMethodDescriptionstatic StringSerializes aDocumentto canonical indented OML text (omnist-spec §4 and §9.5).static Stringwrite(Document doc, WriteReport report) Likewrite(Document), and records inreportevery value the OML grammar cannot hold exactly: a time or datetime whose fraction needs more than six digits (the grammar is1*6DIGIT) is written as a quoted string holding every digit, with aformat.temporal-stringifiedadjustment (E-37: a value is never altered).static StringwriteCompact(Document doc) Serializes aDocumentto compact inline OML text.static StringwriteCompact(Document doc, WriteReport report) LikewriteCompact(Document), recording the temporal adjustments inreportaswrite(Document, WriteReport)does.
-
Method Details
-
write
Serializes aDocumentto canonical indented OML text (omnist-spec §4 and §9.5). Nested objects are indented by two spaces per level; edges are separated by newlines.- Parameters:
doc- the document to serialize; must not benull- Returns:
- the canonical OML text; never
null - Throws:
WriteException- withwrite.unsupported-value(C-9) if a string value or an edge label has no UTF-8 encoding (a lone surrogate)
-
write
Likewrite(Document), and records inreportevery value the OML grammar cannot hold exactly: a time or datetime whose fraction needs more than six digits (the grammar is1*6DIGIT) is written as a quoted string holding every digit, with aformat.temporal-stringifiedadjustment (E-37: a value is never altered).- Parameters:
doc- the document to serialize; must not benullreport- receives the adjustments; may benull- Returns:
- the canonical OML text; never
null - Throws:
WriteException- withwrite.unsupported-value(C-9) aswrite(Document)
-
writeCompact
Serializes aDocumentto compact inline OML text. Edges are separated by"; "instead of newlines and indentation is suppressed, producing output suitable for single-line display or embedding in other formats.- Parameters:
doc- the document to serialize; must not benull- Returns:
- the compact OML text; never
null - Throws:
WriteException- withwrite.unsupported-value(C-9) if a string value or an edge label has no UTF-8 encoding (a lone surrogate)
-
writeCompact
LikewriteCompact(Document), recording the temporal adjustments inreportaswrite(Document, WriteReport)does.- Parameters:
doc- the document to serialize; must not benullreport- receives the adjustments; may benull- Returns:
- the compact OML text; never
null - Throws:
WriteException- withwrite.unsupported-value(C-9) aswrite(Document)
-