emacs-devel
[Top][All Lists]
Advanced

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

Re: Problems with xml-parse-string


From: Wojciech Meyer
Subject: Re: Problems with xml-parse-string
Date: Sat, 25 Sep 2010 01:25:20 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50

Chong Yidong <address@hidden> writes:

> If what you're saying is that it might be good to push certain
> (currently unspecified) xml-handling functions into the C level,
> I agree.

Here is a draft for the API in C - some of the functions could be lifted
to Elisp (please feel free to drop comments, strip, or add what I've 
missed):

access functions:
sxml-node-attributes
sxml-node-content
sxml-node-children
sxml-node-name
sxml-node-comment
sxml-node-descent

selection functions:
sxml-node-get-attribute-by-name
sxml-node-get-nodes-by-name

destructive structure updates:
sxml-node-strip-attributes
sxml-node-append
sxml-node-prepend
sxml-node-add-attribute
smxl-node-set-or-insert-attributes
smxl-node-set-or-insert-nodes
sxml-node-sort

cloning:
sxml-node-clone

mapping:
sxml-node-mapc (destructive)
sxml-node-map

collecting data:
sxml-node-flatten
sxml-node-filter-flatten
sxml-node-sparse-tree
sxml-node-leafs

visiting: (with some extra flags)
sxml-node-visit-depth 
sxml-node-visit-breadth 

searching:
sxml-node-find
sxml-node-search

various:
sxml-strict-sxmlp
sxml-no-attributesp
sxml-validp
sxml->xml

the rest would be done via Xpath. 

Some of the XML specific things are missing (name-spaces, top-level
headers, docs, line numbers and etc.). 

Open question is how to parse directly buffers (skimming through manuals
didn't give my any clue how to deal with custom buffers, AFAIU it is not
possible).

The tricky question is also how do we interface we xpath.  Once we've
marshaled the tree to Lisp, we would need to either implement Xpath in
Elisp (where there is implementation already:

http://www.emacswiki.org/emacs/xpath.el

), or marshal back and again. (should be IMHO faster then Xpath in
Elisp, despite copying).

Thanks,
Wojciech



reply via email to

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