* Error in xml.el documentation
@ 2008-02-22 20:44 Lennart Borgman (gmail)
2008-02-22 21:20 ` Lennart Borgman (gmail)
2008-02-22 22:30 ` Jason Rumney
0 siblings, 2 replies; 7+ messages in thread
From: Lennart Borgman (gmail) @ 2008-02-22 20:44 UTC (permalink / raw)
To: Emacs Devel
The documentation at the top of xml.el says
;; There can be only top level node, but with any number of children below.
;;; LIST FORMAT
;; The functions `xml-parse-file', `xml-parse-region' and
;; `xml-parse-tag' return a list with the following format:
;;
;; xml-list ::= (node node ...)
I think it should be "only one top level node" and
;; xml-list ::= node
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Error in xml.el documentation
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
1 sibling, 0 replies; 7+ messages in thread
From: Lennart Borgman (gmail) @ 2008-02-22 21:20 UTC (permalink / raw)
To: Emacs Devel
Lennart Borgman (gmail) wrote:
> The documentation at the top of xml.el says
>
> ;; There can be only top level node, but with any number of children below.
>
> ;;; LIST FORMAT
>
> ;; The functions `xml-parse-file', `xml-parse-region' and
> ;; `xml-parse-tag' return a list with the following format:
> ;;
> ;; xml-list ::= (node node ...)
>
> I think it should be "only one top level node" and
>
> ;; xml-list ::= node
Eh, xml-list ::= (list node)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Error in xml.el documentation
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)
1 sibling, 1 reply; 7+ messages in thread
From: Jason Rumney @ 2008-02-22 22:30 UTC (permalink / raw)
To: Lennart Borgman (gmail); +Cc: Emacs Devel
Lennart Borgman (gmail) wrote:
> The documentation at the top of xml.el says
>
> ;; There can be only top level node, but with any number of children
> below.
>
> I think it should be "only one top level node" and
>
Yes.
> ;; The functions `xml-parse-file', `xml-parse-region' and
> ;; `xml-parse-tag' return a list with the following format:
> ;;
> ;; xml-list ::= (node node ...)
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Error in xml.el documentation
2008-02-22 22:30 ` Jason Rumney
@ 2008-02-22 22:38 ` Lennart Borgman (gmail)
2008-02-22 23:07 ` Jason Rumney
0 siblings, 1 reply; 7+ messages in thread
From: Lennart Borgman (gmail) @ 2008-02-22 22:38 UTC (permalink / raw)
To: Jason Rumney; +Cc: Emacs Devel
Jason Rumney wrote:
> Lennart Borgman (gmail) wrote:
>> The documentation at the top of xml.el says
>>
>> ;; There can be only top level node, but with any number of children
>> below.
>>
>> I think it should be "only one top level node" and
>>
>
> Yes.
>
>> ;; The functions `xml-parse-file', `xml-parse-region' and
>> ;; `xml-parse-tag' return a list with the following format:
>> ;;
>> ;; xml-list ::= (node node ...)
>
> 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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Error in xml.el documentation
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)
0 siblings, 2 replies; 7+ messages in thread
From: Jason Rumney @ 2008-02-22 23:07 UTC (permalink / raw)
To: Lennart Borgman (gmail); +Cc: Emacs Devel
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Error in xml.el documentation
2008-02-22 23:07 ` Jason Rumney
@ 2008-02-22 23:10 ` Lennart Borgman (gmail)
2008-02-23 1:18 ` Lennart Borgman (gmail)
1 sibling, 0 replies; 7+ messages in thread
From: Lennart Borgman (gmail) @ 2008-02-22 23:10 UTC (permalink / raw)
To: Jason Rumney; +Cc: Emacs Devel
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.
Though is not that a bug? Why should not multiple top-level nodes be
allowed in that case?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Error in xml.el documentation
2008-02-22 23:07 ` Jason Rumney
2008-02-22 23:10 ` Lennart Borgman (gmail)
@ 2008-02-23 1:18 ` Lennart Borgman (gmail)
1 sibling, 0 replies; 7+ messages in thread
From: Lennart Borgman (gmail) @ 2008-02-23 1:18 UTC (permalink / raw)
To: Jason Rumney; +Cc: Emacs Devel
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)))
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-02-23 1:18 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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)
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.