Documentation Center

Retrieve XML from document by XPATH

In order to retrieve specific XML from a document, XPATH is the preferred method. This API call allows you to run multiple XPATH expressions against a single document, and the XML results are returned.

Example API call

/servlets3/wietmsd?id=1459951032129&book=s1000d_bike_41&collection=default&date=1459951031057&target=interface&action=xpath_query&html_entity=1&document=S1000DBIKE-AAA-DA4-10-00-00-AA-251-B-A

Parameters

ParameterDescription
targetinterface
actionxpath_query
html_entity1
documentThe @DOCUMENT_ID attribute on the <DOCUMENT/> that is being targeted, such as S1000DBIKE-AAA-DA4-10-00-00-AA-251-B-A
idA session ID that is valid for this collection and publication combination.
collectionThe name of the collection that the publication is registered in, such as default.
book The name of the publication, such as s1000d_bike_41.
dateTo prevent browser-side caching of data, especially with AJAX requests, it is important to make a URL unique. The most effective technique to accomplish this is to include a time parameter that is based on the time at which the call is made.

XML post data

This API call requires XML post data to complete. An example of that XML data is given here. The request XML can contain as many <query/> elements as needed, each containing an XPATH to execute.

<request>
	<query>.//identAndStatusSection/dmAddress//dmTitle</query>
</request>

Returns

On success
<results>
	<status>SUCCESS</status>
	<message>Success!!!</message>
	<request name='xpath'>
		<session-id>1459951032129</session-id>
		<document-id>S1000DBIKE-AAA-DA4-10-00-00-AA-251-B-A</document-id>
	</request>
	<reply>
		<query-results>
			<xpath>.//identAndStatusSection/dmAddress//dmTitle</xpath>
			<item>
				<dmTitle EID="24" LASTEID="26">
					<techName EID="25">Chain</techName>
					<infoName EID="26">Clean with chain cleaning fluid</infoName>
				</dmTitle>
			</item>
		</query-results>
	</reply>
</results>
On failure
<results>
	<status>EXCEPTION</status>
	<message> Exception while running xpath query</message>
	<request name=’’xpath" >
		<session-id> 1459951032129</session-id>
		<document-id> S1000DBIKE-AAA-DA4-10-00-00-AA-251-B-A </document-id>
	</request>
</results>