From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
To: Jason Rumney <jasonr@gnu.org>
Cc: Emacs Devel <emacs-devel@gnu.org>
Subject: Re: Error in xml.el documentation
Date: Sat, 23 Feb 2008 02:18:50 +0100 [thread overview]
Message-ID: <47BF747A.3030507@gmail.com> (raw)
In-Reply-To: <47BF55B2.9090400@gnu.org>
Jason Rumney wrote:
> Lennart Borgman (gmail) wrote:
>>>
>>> This one is correct. The functions mentioned return a list of nodes.
>>> In the case of xml-parse-region at least, there can be more than one
>>> node at the top level of the returned list.
>>
>> Thanks, I did not think of that case.
>
> But it seems I was wrong. xml-parse-region throws an error if the region
> does not contain well-formed XML with a single top-level node. So
> although the functions all return a list, they all always return a list
> of one.
Would something like this fit in xml.el:
(defun freemind-get-child (parent path)
(message "freemind-get-child %s %s" parent path)
(let* ((childs (cddr parent))
(step (car path))
(step-node (if (listp step) (car step) step))
(step-num (if (listp step) (cdr step) 1))
(path-tail (cdr path))
(path-child (catch 'path-child
(dolist (child childs)
(when (and (not (stringp child))
(eq step-node (car child)))
(when (= 1 step-num)
(throw 'path-child child))
(setq step-num (1- step-num)))))))
(if path-tail
(freemind-get-child path-child path-tail)
path-child)))
prev parent reply other threads:[~2008-02-23 1:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-22 20:44 Error in xml.el documentation Lennart Borgman (gmail)
2008-02-22 21:20 ` Lennart Borgman (gmail)
2008-02-22 22:30 ` Jason Rumney
2008-02-22 22:38 ` Lennart Borgman (gmail)
2008-02-22 23:07 ` Jason Rumney
2008-02-22 23:10 ` Lennart Borgman (gmail)
2008-02-23 1:18 ` Lennart Borgman (gmail) [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47BF747A.3030507@gmail.com \
--to=lennart.borgman@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=jasonr@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.