[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: xml-get-children doesn't handle strings

From: Mark A. Hershberger
Subject: Re: xml-get-children doesn't handle strings
Date: Wed, 14 Apr 2004 14:07:39 -0500
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/22.0.0 (gnu/linux)

I've tried to fix up these docstrings (as well as fix the bug) but
I'm not sure how well I've done.

2004-04-14  Mark A. Hershberger  <address@hidden>

        * xml.el (xml-get-children): Fix docstring. Fix so that it only
        looks at sub-tags and ignores strings.
        (xml-node-name): Fix docstring.

--- xml.el      2 Mar 2004 21:45:06 -0000       1.30
+++ xml.el      14 Apr 2004 19:02:50 -0000
@@ -79,6 +84,17 @@
 (defsubst xml-node-name (node)
   "Return the tag associated with NODE.
-The tag is a lower-case symbol."
+Without namespace-aware parsing, the tag is a symbol.
+With namespace-aware parsing, the tag is a cons of a string
+representing the uri of the namespace with the local name of the
+tag.  For example,
+    <foo>
+would be represented by
+    '(\"\" . \"foo\")."
   (car node))
 (defsubst xml-node-attributes (node)
@@ -96,12 +128,12 @@
 (defun xml-get-children (node child-name)
   "Return the children of NODE whose tag is CHILD-NAME.
-CHILD-NAME should be a lower case symbol."
+CHILD-NAME should match the value returned by xml-node-name."
   (let ((match ()))
     (dolist (child (xml-node-children node))
-      (if child
-         (if (equal (xml-node-name child) child-name)
-             (push child match))))
+      (if (and (listp child)
+               (equal (xml-node-name child) child-name))
+          (push child match)))
     (nreverse match)))
 (defun xml-get-attribute-or-nil (node attribute)

A choice between one man and a shovel, or a dozen men with teaspoons
is clear to me, and I'm sure it is clear to you also.
    -- Zimran Ahmed <http://www.winterspeak.com/>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]