Returns build(Scope.Empty)
Returns toTreeRepr.
Returns toTreeRepr.
Returns the tree representation.
Returns the tree representation. See the corresponding method in eu.cdevreeze.yaidom.simple.Node.
DSL to build
Elems (orDocuments) without having to pass parentScopes around. For example:The latter expression could also be written as follows:
There is an impedance mismatch between XML's scoping rules (which are top-down, from root to leaves) and "functional trees" (which are built bottom-up, from leaves to root). In the context of the Anti-XML library, Daniel Spiewak explained this impedance mismatch in https://github.com/djspiewak/anti-xml/issues/78. In yaidom, however, this impedance mismatch is far less severe. Yaidom distinguishes between eu.cdevreeze.yaidom.simple.Node and eu.cdevreeze.yaidom.simple.NodeBuilder, and eu.cdevreeze.yaidom.simple.Elem and eu.cdevreeze.yaidom.simple.ElemBuilder in particular.
Elems have (fixed, resolved)Scopes, butElemBuilders do not. UsingNodeBuilders,Scopedetermination is postponed. OnlyElemBuilders can have unbound prefixes, but onlyElems have (resolved) scopes. Instead of a eu.cdevreeze.yaidom.core.Scope, anElemBuilderhas a eu.cdevreeze.yaidom.core.Declarations.Another reason that the above-mentioned impedance mismatch is less of a problem in practice is that typically the XML trees (as
NodeBuilders or directly asNodes) are built in a top-down manner. The eu.cdevreeze.yaidom.simple.ConverterToDocuments in packageconvertrecursively buildElems in a top-down manner, possibly creating anEleminstance (for each element) twice (first without children, and finally as a copy with children added).When using
NodeBuilders to create aDocument, thisDocumenttypically contains no "ignorable whitespace". This may cause theDocumentnot to be pretty-printed when using a (default)eu.cdevreeze.yaidom.print.DocumentPrinterto convert theDocumentto an XML string. See also the classes in packageeu.cdevreeze.yaidom.print.