[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: RA existence check?

From: Greg Stein <gstein_at_collab.net>
Date: 2001-11-19 20:29:47 CET

> -----Original Message-----
> From: cmpilato@collab.net [mailto:cmpilato@collab.net]
> Sent: Monday, November 19, 2001 10:07 AM
>...
> An RA-layer existence/node-kind check of some sort is necessary.
> You know, maybe something like:
>
> ra->get_node_kind (enum svn_node_kind *kind,
> svn_string_t *url,
> svn_revnum_t revision,
> apr_pool_t *pool);
>
> Where a node kind of svn_node_none would indicate non-existence.
> GregS, is there an efficient way to do this in RA_DAV, or are we
> talking about a custom REPORT/response couplet here?

That is a PROPFIND (Depth:0) for the DAV:resourcetype property.

You can use the svn_ra_dav__get_one_prop() function to fetch it. If the
PROPFIND fails with a 404, then you have svn_node_none. If the resulting
property looks like:

    <D:resourcetype>
      <D:collection/>
    </D:resourcetype>

Then it is a collection (directory; svn_node_dir). Otherwise, it is a
regular resource (svn_node_file).

The harder part is parsing the resourcetype property. "Proper" parsing means
treating it as an XML property and looking for the DAV:collection element in
there. To do that, however, means that get_one_prop() can't be used. I think
there may be some Neon functions for parsing XML properties; we'd need to
look. That would probably be the best approach. (an alternative is to use
apr_xml_* parsing functions on the returned string; get back a DOM-like
thing, and look for the element).

Cheers,
-g

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:49 2006

This is an archived mail posted to the Subversion Dev mailing list.