[rules-users] Solution for reasoning over XML?

Wolfgang Laun wolfgang.laun at gmail.com
Fri Jan 11 02:03:18 EST 2013


There was my talk at IntelliFest 2012: "Reasoning with XML Data".
Although it assumes that XML elements are unmarshalled into regular
Pojos, it may still contain some useful ideas and code snippets.

I'll send you the paper off-list, and I'd be interested to learn about
your reason for not converting to Pojos (using JAXB or similar).

Best
Wolfgang


On 11/01/2013, craigparra <craigparra at gmail.com> wrote:
> Hi,
>
> I was looking around trying to find a solution for reasoning over any XML
> in
> drools, without having to convert the XML into java objects, but couldn't
> find any example where this had been done.
>
> I have opted to DOM parse the XML, then recursively wrap every Element node
> in a convenience class (XmlElement) and insert as facts.  That is every
> element is inserted individually as a fact.
>
> My conditionals look like:
>
> $xml : XmlElement(name == 'someName', value == 'someValue')
> $xml : XmlElement(path== '/some/xpathlike/path', value == 'someValue')
> $xml : XmlElement(attribute['someAttr'] == 'someValue')
>
> or using a DSL:
>
> An XML element exists
> - named someName with a value of
> - at path /some/xpathlike/path with a value in "someVal","someOtherVal"
>
> Is this a pattern that other drools users have encountered? Or tried to
> solve.
>
> It seems to work quite well, at least in my scenario - but clearly it has
> limitations based on the DOM parse (ie not great for massive XML files).
>
> Was wondering if anyone else had tried to solve how to use XML as facts?
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Solution-for-reasoning-over-XML-tp4021454.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>


More information about the rules-users mailing list