/** * Get segments * * @return array * @throws Exception */ function getSegments() { $message_schema = $this->message->getSchema("message", $this->messageName); $xpath = new CHL7v2MessageXPath($message_schema); $segment = $xpath->queryUniqueNode("//segments"); $tree = array(); $this->getSegmentTree($segment, $tree); return $tree; }
/** * Get the node corresponding to an XPath * * @param string $nodeName The XPath to the node * @param DOMNode|null $contextNode The context node from which the XPath starts * @param array|null &$data Nodes data * @param boolean $root Is root node ? * * @return DOMNode The node */ function queryNode($nodeName, DOMNode $contextNode = null, &$data = null, $root = false) { $xpath = new CHL7v2MessageXPath($contextNode ? $contextNode->ownerDocument : $this); return $data[$nodeName] = $xpath->queryUniqueNode($root ? "//{$nodeName}" : "{$nodeName}", $contextNode); }