Does anybody know the
answer to my question? I’m not able to solve this issue and don’t
find any clarifying tutorial either….
Hi,
I’m new in drools and I’m having some
problems accessing an xml field. I’m using drools with jaxb to treat xml
files that follow an specific xsd. I have the following xml (this is just a
piece of the xml):
<OASIS_TSO_1_0>
<EVENT>
<EVENT_ID>EVENT_ID_03/10/2008
10:22:36</EVENT_ID>
<NODE_ID>00</NODE_ID>
<OTHER_EVENT_ID>Incidente
<EVENT_TYPE>POL</EVENT_TYPE>
<SOURCE>HUMDED</SOURCE>
<SEVERITY>EXTREM</SEVERITY>
<CERTAINTY>88</CERTAINTY>
<DECL_DATIME>2008-10-03T10:20:47.0000000+02:00</DECL_DATIME>
<GEO>
<DESCRIPTION/>
<POSITION>
<LOC_ID>14021</LOC_ID>
<COORD>
<LAT>37.9811636567434</LAT>
<LON>-4.85417587343286</LON>
<HEIGHT>0</HEIGHT>
</COORD>
</POSITION>
</GEO>
</EVENT>
</OASIS_TSO_1_0>
I already have a couple of rules working, but they
are simple rules, like this one:
rule "Rule1"
salience 10
when
OASISTSO10($e: EVENT)
OASISTSO10($e.SEVERITY
== "EXTREM") or OASISTSO10($e.SEVERITY == "SEVERE")
then
action
The problem appears when I have to check the LOC_ID
field and I don’t know how to access to it. I have tried several things
but none of them work
1.
when
OASISTSO10($e:
EVENT)
OASISTSO10($e.GEO.POSITION.LOCID == "40005")
then
2.
when
OASISTSO10($e:
EVENT)
OASISTSO10($g:
$e.GEO)
OASISTSO10($p: $g.POSITION)
OASISTSO10($p.LOCID == "40005")
Then
I have also tried with ($e.GEO.POSITION.DESCRIPTION,
just in case the “_” character was the problem. But the same
results… I have searched also for examples with xmls but I haven’t
had luck.
Any help would be appreciated. Thanks in advance,
Zaloa