By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,798 Members | 1,342 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,798 IT Pros & Developers. It's quick & easy.

Facade to read & WRITE using XPath

P: n/a
I am building various framework components for my team to use in
development, and one of those components is a Facade for
reading/writing user preferences.

The idea is that preference settings are stored in a free-format XML
document (in memory for the life of the session) and persisted to a
database (as free text) on exit.

I have taught my developers the basics of XPath, however I don't want
to have to review XMLDOM code all over the place, so this Facade
object should allow them to both retrieve and SET information in the
tree using XPath arguments.

The interface for the Facade must include the following methods:

public void load(String xml);
public String get(String xpath);
public void set(String xpath, String value);
public List getList(String xpath);
public void setList(String xpath, List values);
public Map getMap(String xpath, String keyPath, String valuePath);
public void setMap(String xpath, String keyPath, String valuePath, Map

The load, get, getList, and getMap methods are easy - just run the
specified XPath against the document element and return the results.

The tricky part is the set, setList, and setMap methods. They must all
analyse and break down the specified XPaths and add new
elements/attributes where necessary.

I have made an attempt at this with some limited success, but
analysing the incoming XPath is very complicated as there are so many

Has anyone else tried this, or come across a library that implements
this functionality?

Any help would be greatly appreciated. :)
Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.