I need to find the sume of the xml elements in mule. The input xml looks like this :
<message:MessageGroup
xmlns:message="http://www.SDMX.org/resources/SDMXML/schemas/v2_0/message"
xmlns="http://www.SDMX.org/resources/SDMXML/schemas/v2_0/generic"
xmlns:common="http://www.SDMX.org/resources/SDMXML/schemas/v2_0/common"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.SDMX.org/resources/SDMXML/schemas/v2_0/generic http://www.sdmx.org/docs/2_0/SDMXGenericData.xsd http://www.SDMX.org/resources/SDMXML/schemas/v2_0/message http://www.sdmx.org/docs/2_0/SDMXMessage.xsd">
<Header xmlns="http://www.SDMX.org/resources/SDMXML/schemas/v2_0/message">
<ID>none</ID>
<Test>false</Test>
<Truncated>false</Truncated>
<Prepared>2017-08-28T05:35:50</Prepared>
<Sender id="ABS">
<Name xml:lang="en">Australian Bureau of Statistics</Name>
<Name xml:lang="fr">Australian Bureau of Statistics</Name>
</Sender>
</Header>
<DataSet
keyFamilyURI="http://stat.data.abs.gov.au/restsdmx/sdmx.ashx/GetKeyFamily/CPI">
<KeyFamilyRef>CPI</KeyFamilyRef>
<Series>
<SeriesKey>
<Value concept="MEASURE" value="3" />
<Value concept="REGION" value="50" />
<Value concept="INDEX" value="10001" />
<Value concept="TSEST" value="10" />
<Value concept="FREQUENCY" value="Q" />
</SeriesKey>
<Attributes>
<Value concept="TIME_FORMAT" value="P3M" />
</Attributes>
<Obs>
<Time>2001-Q1</Time>
<ObsValue value="6" />
</Obs>
<Obs>
<Time>2001-Q2</Time>
<ObsValue value="6.1" />
</Obs>
<Obs>
<Time>2001-Q3</Time>
<ObsValue value="2.5" />
</Obs>
<Obs>
<Time>2001-Q4</Time>
<ObsValue value="3.1" />
</Obs>
<Obs>
<Time>2002-Q1</Time>
<ObsValue value="3" />
</Obs>
<Obs>
<Time>2002-Q2</Time>
<ObsValue value="2.8" />
</Obs>
<Obs>
<Time>2002-Q3</Time>
<ObsValue value="3.2" />
</Obs>
<Obs>
<Time>2002-Q4</Time>
<ObsValue value="2.9" />
</Obs>
</Series>
<Annotations>
<common:Annotation>
<common:AnnotationTitle>Statistical usage warning
</common:AnnotationTitle>
<common:AnnotationText>
ABS.Stat beta is continuing to be developed. Data will be updated as soon
as possible following its 11:30 am release on the ABS website.
</common:AnnotationText>
</common:Annotation>
</Annotations>
</DataSet>
Here I need to do sum of the elements : which is inside : MessageGroup.DataSet.Series.*Obs. Tried doing using dataweave but was unsuccessful. While using dataweave I am not able to value of . Any help will be appreciated.
As values are attributes of ObsValue tag use @ sign to get attribute value like,
Output = 29.6
Hope this helps