Rules for XML/XPath

224 views
Skip to first unread message

Marc Dzaebel

unread,
Oct 2, 2014, 12:37:38 PM10/2/14
to drools...@googlegroups.com
Hi,

I just figure out, how to write rules for XML input. I know XSLT/XPath, CBR/ESB systems etc. but want to have complex DRL rules that are as powerfull as XSLT. It's possible to insert dom.Elements or a Proxies into working memory but there you can't specify an XPath or constrain an attribute in a DRL-pattern (at least it would be cryptic). SXC seems to be outdated so currently I'd have to program with JAXB etc. to develop my own solution.

Any helpful tools or best practices for this issue?

Thanks and best regards

Marc

Davide Sottara

unread,
Oct 12, 2014, 11:22:25 PM10/12/14
to drools...@googlegroups.com
At the moment, the use of JAXB is the most stable solution.
In the past, there was the possibility of loading an XSD as a resource: the engine would then invoke xjc implicitly. I have never used it and I don't know to what extent it still works, and how you would have to deal with the insertion of facts.
These very days I'm experimenting with Apache JXPath myself, and I'm thinking to provide a built-in way to trait XML Elements and map a virtual bean's attributes to xpath expressions, but given how hard pressed I've been recently, that feature won't be available before the end of the year.
Open to feedback, suggestions and contributions
Best
Davide


--
You received this message because you are subscribed to the Google Groups "Drools Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-usage...@googlegroups.com.
To post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-usage/2f9b8172-3ec0-435b-9ee9-090c2eac5428%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Marc Dzaebel

unread,
Oct 18, 2014, 7:50:54 AM10/18/14
to drools...@googlegroups.com
My current ideas are:
  • pass JAXB/JXPath giving up the need to have a class for every element or an XSD
  • use Saxon-HE as it implements the newest XSLT 2.0, XQuery 3.0, and XPath 3.0 standards
  • base rules on Wrappers that delegate to compiled XPathExpression's (NodeInfo-objects/sets as context)

I found a relevant report at http://members.inode.at/w.laun/drools/ReasoningWithXMLData/RulesXML.pdf

I'm still interested in any further, even conceptual ideas.

Good luck, Marc

Reply all
Reply to author
Forward
0 new messages