aboutsummaryrefslogtreecommitdiff
path: root/doc/ref
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-04-10 22:46:01 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2023-04-10 23:45:29 +0200
commitd59edcd022a73e0ec9460d95a092f050edf411b1 (patch)
treee71cb7f642f7231c73c4227ca43e4d998d1d697a /doc/ref
parentAdd (sxml util). (diff)
downloadcalp-d59edcd022a73e0ec9460d95a092f050edf411b1.tar.gz
calp-d59edcd022a73e0ec9460d95a092f050edf411b1.tar.xz
Add (sxml namespaced).
Diffstat (limited to 'doc/ref')
-rw-r--r--doc/ref/guile.texi1
-rw-r--r--doc/ref/guile/sxml.texi97
2 files changed, 98 insertions, 0 deletions
diff --git a/doc/ref/guile.texi b/doc/ref/guile.texi
index a6c5ebe4..970e8dee 100644
--- a/doc/ref/guile.texi
+++ b/doc/ref/guile.texi
@@ -10,6 +10,7 @@
@include guile/base64.texi
@include guile/web.texi
@include guile/vcomponent.texi
+@include guile/sxml.texi
@node Errors and Conditions
@section Errors and Conditions
diff --git a/doc/ref/guile/sxml.texi b/doc/ref/guile/sxml.texi
new file mode 100644
index 00000000..8b0246f7
--- /dev/null
+++ b/doc/ref/guile/sxml.texi
@@ -0,0 +1,97 @@
+@node sxml namespaced
+@section Namespaced SXML
+
+Namespaces is a variant to ``regular'' SXML. Difference being that
+instead of representing XML-tags as symbols, they are instead actual
+objects.
+
+For example
+@example
+`(a (b "Content"))
+@end example
+
+Would be represented as
+@example
+`(,(xml 'a)
+ (,(xml 'b)
+ "Content"))
+@end example
+
+@defun namespaced-sxml->sxml tree [namespace-prefixes='()]
+Takes a tree of namespaced-sxml, and optionally an assoc list from
+namespace symbols, to prefered prefix.
+
+Returns a sxml tree, with xmlns:<prefix>=namespace attributes
+@end defun
+
+@defun namespaced-sxml->xml tree [namespaces='()] [port='(current-output-port)]
+Serializes the namespaced sxml tree to port. @var{namespaces} should
+be an association list from namespace symbols, to prefered prefixes.
+@end defun
+
+@defun namespaced-sxml->sxml/namespaces tree [namespace-prefixes='()]
+Returns two values:
+@itemize
+@item An SXML tree (which doesn't have namespace attributes)
+@item an association list from namespace symbols, to used prefixes.
+@end itemize
+@end defun
+
+@c xml->namespcaed-sxml and sxml->namespaced-sxml don't share
+@c implementation, despite doing almost the same thing. This is since
+@c xml->namespaced-sxml directly uses the ssax parser, giving us great
+@c controll, while sxml->namespaced-sxml attempt to look at symbols.
+
+@defun xml->namespaced-sxml port-or-string
+Reads xml from port, and return a namespaced SXML tree.
+@end defun
+
+@defun sxml->namespaced-sxml tree namespaces
+Converts a ``regular'' SXML tree into a namespaced sxml tree.
+@var{namespaces} must be an association list which maps each prefix
+used in @var{tree} onto a full XML namespace.
+@end defun
+
+@defun xml tag
+@defunx xml ns tag [attrs]
+@anchor{xml-tag}
+ A single XML element, suitable to go as the car of a list to
+ create a full object.
+
+ @var{xml} is a shorthand to @code{make-xml-element}, which
+ either takes just a tag (for non-namespaced elements), or a
+ namespace, a tag, and a list of attributes.
+
+ @itemize
+ @item @var{tag} should be a symbol.
+ @item @var{ns} should be a symbol.
+ @item @var{attrs} should be a hash table.
+ @end itemize
+
+ @defun make-xml-element tagname namespace attributes
+ @end defun
+
+ @defun xml-element? x
+ @end defun
+
+ @defun xml-element-tagname el
+ @end defun
+
+ @defun xml-element-namespace el
+ @end defun
+
+ @defun xml-element-attributes el
+ @end defun
+@end defun
+
+
+@defun make-pi-element tag body
+ @defun pi-element? x
+ @end defun
+
+ @defun pi-tag pi
+ @end defun
+
+ @defun pi-body pi
+ @end defun
+@end defun