This is not a Drools problem, however...<br><br>You are using a Domain Specific Language (DSL) to transform rules into Drools Rule Language (DRL). If you have written the DSL you should know how it works; if you haven't, then there should be a documentation telling you what the parameters of<br>
xpathEquals "/IATA/messageaudit/@messageVersion" "FSU/13/RCS"<br>mean, and this would immediately solve your problem. If you had that documentation (why don't you have it?), it would say that the first parameter is an XPath expression and the second a value to match at the location the first expression identifies. <br>
<br>Now, when you use SW using XPath with XML, you should know the basics about XPath. If you don't - w3c has some good tutorials, see the one on XPath, <a href="http://www.w3schools.com/xpath/default.asp">here</a>.<br>
<br>The XPath used denotes an attribute and therefore your rules will only work if messageVersion is an attribute of the element /IATA/messageaudit. In the second XML, all values are elements below that element.<br><br>-W<br>
<br><div class="gmail_quote">On 23 April 2011 11:39, annukaila <span dir="ltr"><<a href="mailto:annu.sifu@gmail.com">annu.sifu@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi<br>
<br>
iam new to drools rules my problem is<br>
<br>
<br>
iam receiving message in xml format so using drools have to route it my<br>
drools rules work when the xml message is the format as below<br>
<br>
<?xml version="1.0" encoding="UTF-8"?><br>
<IATA><br>
<messageaudit senderId="125" receiverId="FFCategory"<br>
dateTimeOfMessage="19:00"<br>
messageVersion="FSU/13/RCS" airwaybill="125-1234565" /><br>
<fsurcs AwbNumber="125-1234565" origin="HYD" destination="KUL"<br>
totalPieces="T40" totalWeight="K200"<br>
statusCodeConsignmentRecieveDFromShipperOrAgent="RCS"<br>
dayAndMonthOfReceipt="02June" actualTimeOfGivenStatusEvent="19:00"<br>
airportCodeOfReceipt="HYD"<br>
totalOrPartNumberOfPices="T40" weightOfTotalOrPartOfPieces="K200"<br>
nameOfAgentOfShipper="Shipper" osi="RcsMessage"/><br>
</IATA><br>
<br>
but if the xml is the format as below<br>
<br>
<?xml version="1.0" encoding="UTF-8"?><br>
<IATA><br>
<messageaudit><br>
<senderId>125</senderId><br>
<receiverId>FFCategory</receiverId><br>
<dateTimeOfMessage>19:00</dateTimeOfMessage><br>
<messageVersion>FSU/13/RCS</messageVersion><br>
<airwaybill>125-1234565</airwaybill><br>
</messageaudit><br>
<fsurcs><br>
<AwbNumber>125-1234565</AwbNumber><br>
<origin>HYD</origin><br>
<destination>KUL</destination><br>
<totalPieces>T40</totalPieces><br>
<totalWeight>K200</totalWeight><br>
<statusCodeConsignmentRecieveDFromShipperOrAgent>RCS</statusCodeConsignmentRecieveDFromShipperOrAgent><br>
<dayAndMonthOfReceipt>02June</dayAndMonthOfReceipt><br>
<actualTimeOfGivenStatusEvent>19:00</actualTimeOfGivenStatusEvent><br>
<airportCodeOfReceipt>HYD</airportCodeOfReceipt><br>
<totalOrPartNumberOfPices>T40</totalOrPartNumberOfPices><br>
<weightOfTotalOrPartOfPieces>K200</weightOfTotalOrPartOfPieces><br>
<nameOfAgentOfShipper>Shipper</nameOfAgentOfShipper><br>
<osi>RcsMessage</osi><br>
</fsurcs><br>
</IATA><br>
<br>
<br>
it is not routing the message means not recognizing the drools and my drools<br>
file is as follows<br>
<br>
package com.jboss.soa.esb.routing.cbr<br>
<br>
#list any import classes here.<br>
import org.jboss.soa.esb.message.Message;<br>
import org.jboss.soa.esb.message.format.MessageType;<br>
<br>
expander XPathLanguage.dsl<br>
<br>
#declare any global variables here<br>
global java.util.List destinations;<br>
<br>
rule "Blue Routing Rule using XPATH"<br>
when<br>
xpathEquals "/IATA/messageaudit/@messageVersion" "FSU/13/RCS"<br>
then<br>
Log : "Blue Team";<br>
Destination : "blue";<br>
end<br>
<br>
rule "Red Routing Rule using XPATH"<br>
when<br>
xpathEquals "/IATA/messageaudit/@messageVersion" "FSU/13/MAN"<br>
then<br>
Log : "Red Team";<br>
Destination : "red";<br>
end<br>
<br>
rule "Green Routing Rule using XPATH"<br>
when<br>
xpathEquals "/IATA/messageaudit/@messageVersion" "FSU/13/DEP"<br>
then<br>
Log : "Green Team";<br>
Destination : "green";<br>
end<br>
<br>
<br>
<br>
please help me hoe to rectify this its very urgent for me and please dnt<br>
mind if i did any mistakes<br>
<br>
<br>
thanku<br>
<font color="#888888"><br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Drools-rules-tp2854688p2854688.html" target="_blank">http://drools.46999.n3.nabble.com/Drools-rules-tp2854688p2854688.html</a><br>
Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</font></blockquote></div><br>