QuickBooks/WebConnector/Handlers.php
protected function _extractIdentifiers($xml)
	{
		$fetch_tagdata = array(
			'ListID',
			'TxnID',
			'OwnerID',
			'TxnLineID',
			'EditSequence',
			'FullName',
			'Name',
			'RefNumber',
			);

		$fetch_attributes = array(
			'requestID',
			'iteratorID',
			'iteratorRemainingCount',
			'metaData',
			'retCount',
			'statusCode',
			'statusSeverity',
			'statusMessage',
			'newMessageSetID',
			'messageSetStatusCode',
			);

		$list = array();

		foreach ($fetch_tagdata as $tag)
		{
			if (false !== ($start = strpos($xml, '<' . $tag . '>')) and
				false !== ($end = strpos($xml, '</' . $tag . '>')))
			{
				$list[$tag] = substr($xml, $start + 2 + strlen($tag), $end - $start - 2 - strlen($tag));
			}
		}

		foreach ($fetch_attributes as $attribute)
		{
			if (false !== ($start = strpos($xml, ' ' . $attribute . '="')) and
				false !== ($end = strpos($xml, '"', $start + strlen($attribute) + 3)))
			{
				$list[$attribute] = substr($xml, $start + strlen($attribute) + 3, $end - $start - strlen($attribute) - 3);
			}
		}

		return $list;
	}
protected function _extractIdentifiers($xml)
	{
		$fetch_tagdata = array(
			'ListID',
			'TxnID',
			'OwnerID',
			'TxnLineID',
			'EditSequence',
			'FullName',
			'Name',
			'RefNumber',
			);

		$fetch_attributes = array(
			'requestID',
			'iteratorID',
			'iteratorRemainingCount',
			'metaData',
			'retCount',
			'statusCode',
			'statusSeverity',
			'statusMessage',
			'newMessageSetID',
			'messageSetStatusCode',
			);

		$list = array();

		foreach ($fetch_tagdata as $tag)
		{
			if (false !== ($start = strpos($xml, '<' . $tag . '>')) and
				false !== ($end = strpos($xml, '</' . $tag . '>')))
			{
				$list[$tag] = substr($xml, $start + 2 + strlen($tag), $end - $start - 2 - strlen($tag));
			}
		}

		foreach ($fetch_attributes as $attribute)
		{
			if (false !== ($start = strpos($xml, ' ' . $attribute . '="')) and
				false !== ($end = strpos($xml, '"', $start + strlen($attribute) + 3)))
			{
				$list[$attribute] = substr($xml, $start + strlen($attribute) + 3, $end - $start - strlen($attribute) - 3);
			}
		}

		return $list;
	}
Extract a unique record identifier from an XML response

Some (most?) records within QuickBooks have unique identifiers which are
returned with the qbXML responses. This method will try to extract all
identifiers it can find from a qbXML response and return them in an
associative array.

For example, Customers have unique ListIDs, Invoices have unique TxnIDs,
etc. For an AddCustomer request, you'll get an array that looks like
this:
<code>
array(
'ListID' => '2C0000-1039887390'
)
</code>

Other transactions might have more than one identifier. For instance, a
call to AddInvoice returns both a ListID and a TxnID:
<code>
array(
'ListID' => '200000-1036881887', // This is actually part of the 'CustomerRef' entity in the Invoice XML response
'TxnID' => '11C26-1196256987', // This is the actual transaction ID for the Invoice XML response
)
</code>

*** IMPORTANT *** If there are duplicate fields (i.e.: 3 different
ListIDs returned) then only the first value encountered will appear in
the associative array.

The following elements/attributes are supported:
- ListID
- TxnID
- iteratorID
- OwnerID
- TxnLineID

@param string $xml	The XML stream to look for an identifier in
@return array		An associative array mapping identifier fields to identifier values