Re: [xml] xpath question: parsing or create elements with an expression



On Tue, Oct 29, 2002 at 06:06:44PM +0100, Torsten Grundmann wrote:
Hi,

I have to navigate in a given DOM tree with a xpath expression.
Searching for data is easy,  but I have also to save data.

The xpath expression look like:
"/settings/section[ name='configuration']/item[ type='wxDateTime'][ name='datawritten']"
(I know, xpath can pointed to several items. This isn't the problem in
my case.)

If a node doesn't exists, it should be create. This contain the

  Well you will have to create it.

How could I manage this?

  This is completely dependant on the set of constraints on your input document.

Is there a way to do automatically this with an
existing function?

  No.

If not, then as first I have to parse the xpath
expression. Is there an existing function which can detach the
hierarchic elements and the attributes?

  An XPath expression is compiled into a tree. You will have to learn
about libxml2 and xpath.c internals. Read tree.h, try to undrstand
how those interfaces are implemented by reading tree.c, then read
xpath.c to see the XPath specific parts. Don't expect to have this done
very easilly, what you're looking for is complex and will require you
to do some significant learning work.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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