Skip to main content

Hi,

New in XML transformers, I'd like to know in FME Desktop 2022 how can I read and parse data contained on this XML:

 

<SOAP-ENV:Envelope>
<SOAP-ENV:Body>
<ns1:GetSiteValuesResponse>
<ns1:siteValues>
<ns1:siteRAIId>1558</ns1:siteRAIId>
<ns1:x>144.882271794492</ns1:x>
<ns1:y>-37.825548770183602</ns1:y>
<ns1:enabled>true</ns1:enabled>
<ns1:reportedTime>2022-07-26T23:58:04.878</ns1:reportedTime>
<ns1:currentValues>
<ns1:laneNumber>1</ns1:laneNumber>
<ns1:panelValue>Blank</ns1:panelValue>
<ns1:annulusFlashing>false</ns1:annulusFlashing>
</ns1:currentValues>
<ns1:currentValues>
<ns1:laneNumber>2</ns1:laneNumber>
<ns1:panelValue>Blank</ns1:panelValue>
<ns1:annulusFlashing>false</ns1:annulusFlashing>
</ns1:currentValues>
<ns1:currentValues>
<ns1:laneNumber>3</ns1:laneNumber>
<ns1:panelValue>Blank</ns1:panelValue>
<ns1:annulusFlashing>false</ns1:annulusFlashing>
</ns1:currentValues>
<ns1:currentValues>
<ns1:laneNumber>4</ns1:laneNumber>
<ns1:panelValue>Blank</ns1:panelValue>
<ns1:annulusFlashing>false</ns1:annulusFlashing>
</ns1:currentValues>
<ns1:previousValues>
<ns1:laneNumber>1</ns1:laneNumber>
<ns1:panelValue>Unknown</ns1:panelValue>
<ns1:annulusFlashing>false</ns1:annulusFlashing>
</ns1:previousValues>
<ns1:previousValues>
<ns1:laneNumber>2</ns1:laneNumber>
<ns1:panelValue>Unknown</ns1:panelValue>
<ns1:annulusFlashing>false</ns1:annulusFlashing>
</ns1:previousValues>
<ns1:previousValues>
<ns1:laneNumber>3</ns1:laneNumber>
<ns1:panelValue>Unknown</ns1:panelValue>
<ns1:annulusFlashing>false</ns1:annulusFlashing>
</ns1:previousValues>
<ns1:previousValues>
<ns1:laneNumber>4</ns1:laneNumber>
<ns1:panelValue>Unknown</ns1:panelValue>
<ns1:annulusFlashing>false</ns1:annulusFlashing>
</ns1:previousValues>
</ns1:siteValues>
<ns1:siteValues>

(sorry if its not the best way to Copy&Paste code).

My intention is to extract data and convert into points using the x,y and the rest of attributes.

Btw, the XML is taken from a HTTPCaller.

 

Thanks in advance!

J.

The XML supplied is incomplete, but passing it into an XMLFlattener with the Elements to Match set to "*" will produce an FME list from the XML, from which you can then go and explode/expose/extract the relevant values

image


Many thanks @hkingsbury​ ! I can proceed now with the List. Wise "*" tip. ;)


When using the "*", I can have these properties,

Propertiesbut it is not a FME List, so, how could I explode into features based on those "indexes"?

Thanks,


When using the "*", I can have these properties,

Propertiesbut it is not a FME List, so, how could I explode into features based on those "indexes"?

Thanks,

You'll need to expose those attributes using the AttributeExposer (or specifying them in the XMLFlattener). To expose at that level you'll need to expose "Body.GetSiteValuesResponse.SiteValues{}" - the "{}" indicates its a list. This will then make it show up as a list to transformers. You'll then need to also expose any other attributes you want to work with


Reply