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

Re: xpath filter



If I understand well :-)
1.
- you optimize your tool to limit the reading in your database *per value*
- we optimize our tool to limit the reading *per module*
2.
- you parse the XPath expression to build the XML document little by little
- we build a brute subset XML document, and then we use an existing XPath library to select the nodes (so we have a full support of XPath). But it's better for us if the XPath expr starts in the same way as the registration XPath expr of an existing module. Otherwise, we have to query all modules... :-( (Hence the contexts, namespaces and prefixes...)

You must have better performances but you have to reimplement XPath, don't you ? I guess that, in most cases (except for the relative expressions and exotic XPath requests), it probably looks like subtree filtering.

Thanks for your replies. I find it very interesting to compare implementation choices.

Vincent


Martin Bjorklund wrote:

Cridlig Vincent <vincent.cridlig@loria.fr> wrote:
Moreover, the XPath expressions without prefix are still valid.
Do you check all namespaces in this case?


yes. Actually, we load the entire configuration data and then apply a filter (easy solution but not performant). Ideally, it should parse the XML schemas to find some matching nodes (or search in a dictionnary built from the schemas), load the configuration data of each matching schemas and finally filter.

For now, namespaces are not very well handled in our agent because I was waiting for some clarifications on this context problem. Still some work in the pipe...

What about you ?

Our agent knows the data model, and thus we can do two things when
filtering: if the filter uses a instance key, we just read the
corresponding instance and continue filtering down there.
(e.g. "interfaces/interface[ifName=eth0]/...")
When no instance identifier is specified
(e.g. "interfaces/interface[ifType=ethernet]/...") we check the match
nodes (in the example ifType of each instance, if a match is found we
read the rest of instance.  This means that if you just want to read
one or a few parameters in a given instance, we'll just do one read to
the db to get the instance.

As for namespaces for xpath, we don't handle that either - we're also
waiting for clarification.  For subtree filtering we handle
namespaces though.


/martin



begin:vcard
fn:Vincent Cridlig
n:Cridlig;Vincent
org:LORIA - INRIA Lorraine;Madynes
adr:;;;Nancy;;;France
email;internet:cridligv@loria.fr
title:PhD Student
tel;work:+33 (0)3 83 59 20 48
url:http://www.loria.fr/~cridligv
version:2.1
end:vcard