[Pkg-javascript-commits] [ltx] 162/469: more README
Jonas Smedegaard
dr at jones.dk
Wed Aug 31 13:01:20 UTC 2016
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository ltx.
commit 14f9726b8cec94de3b0ffd2dcf6db4d16e1efe90
Author: Astro <astro at spaceboyz.net>
Date: Sun Nov 21 02:12:22 2010 +0100
more README
---
README.markdown | 35 ++++++++++++++++++++++++++++++++---
1 file changed, 32 insertions(+), 3 deletions(-)
diff --git a/README.markdown b/README.markdown
index b08b6dc..3554d94 100644
--- a/README.markdown
+++ b/README.markdown
@@ -1,15 +1,41 @@
# Less-Than XML
-
* *Element:* any XML Element
+* Text nodes are Strings
+
+
+## Element traversal
+
+* `Element(name, attrs?)`: constructor
+* `is(name, xmlns?)`: check
+* `getName()`: name without ns prefix
+* `getNS()`: element's xmlns, respects prefixes and searches upwards
+* `findNS(prefix?)`: search for xmlns of a prefix upwards
+* `getChild(name, xmlns?)`: find one children
+* `getChildren(name, xmlns?)`: find all children
+* `getText()`: appends all text nodes recursively
+* `getChildText(name)`: a child's text contents
+* `root()`: uppermost parent in the tree
+* `up()`: parent or self
+
+## Element attributes
-### Building XML Elements
+* `attrs` is an object of the Element's attributes
+* `name` contains optional prefix, colon, name
+* `parent` points to its parent, this should always be consistent with
+ children
+* `children` is an Array of Strings and Elements
+
+
+## Building XML Elements
+
+This resembles strophejs a bit.
strophejs' XML Builder is very convenient for producing XMPP
stanzas. node-xmpp includes it in a much more primitive way: the
`c()`, `cnode()` and `t()` methods can be called on any *Element*
-object, returning the new child element.
+object, returning the child element.
This can be confusing: in the end, you will hold the last-added child
until you use `up()`, a getter for the parent. `Connection.send()`
@@ -17,6 +43,9 @@ first invokes `tree()` to retrieve the uppermost parent, the XMPP
stanza, before sending it out the wire.
+## Destructive modification
+
+
## TODO
* More documentation
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/ltx.git
More information about the Pkg-javascript-commits
mailing list