Consider the following XML

<ServerStatus>
<ServerStatusHash>3809a723-038f-4129-b597-06ef0c244452</ServerStatusHash>
<Server Name="Diafaan SMS Server - full edition">...</Server>
<GatewayStatusList>
<Gateway Name="GSM Modem Gateway" Id="1" Active="1" SendEnabled="1" ReceiveEnabled="1">
<Status>Ready to send and receive messages</Status>

The Gateway Name tag above is what's giving me grief. I'm trying to read the

<Status>Ready to send and receive messages</Status>

tag below but I always get errors.

The Status tag is not unique so I cant just reference that tag.

Using the example section1/value_float does not work as it doesn't seem to like tags with values in them.


Article Comments

Can you post the full XML? Because the XML you posted is not valid (Gateway node opened, but not closed). Let's assume the XML looks like this:

<ServerStatus>
	<ServerStatusHash>3809a723-038f-4129-b597-06ef0c244452</ServerStatusHash>
	<Server Name="Diafaan SMS Server - full edition">...</Server>
	<GatewayStatusList>
		<Gateway Name="GSM Modem Gateway" Id="1" Active="1" SendEnabled="1" ReceiveEnabled="1">
			<Status>Ready to send and receive messages</Status>
		</Gateway>
	</GatewayStatusList>
</ServerStatus>

The XPath should look like this: ServerStatus/GatewayStatusList/Gateway[1]/Status ...in order to get the status content of the first entry. Is that what you need?


Feb, 2015 - Permalink