private void storeData(final StoreNode node,
                           final Buffer buffer,
                           final Match parentMatch,
                           final int parentMatchCount) throws IOException, SAXException {
        final int[] referencedGroups = node.getAllReferencedGroups();

        // Store value for future use.
        if (referencedGroups != null && referencedGroups.length > 0) {
            if (parentMatchCount == 0) {
                node.clearStores();
            }

            if (parentMatch == null) {
                // Parent match will only be null if a <var> or <data> element
                // is used within <group>. In these cases only group 0 can be
                // used as there is no parent match and the whole content from
                // the group will be used.
                for (final int groupNo : referencedGroups) {
                    try {
                        if (groupNo == 0) {
                            // Use the whole parent buffer.
                            node.storeValue(groupNo, parentMatchCount, buffer);

                        } else {
                            node.storeValue(groupNo, parentMatchCount, null);

                            messageBuffer.clear();
                            messageBuffer.append("Group number ");
                            messageBuffer.append(groupNo);
                            messageBuffer.append(" not valid within parent group of: ");
                            messageBuffer.append(node.getDebugId());
                            log(Severity.FATAL_ERROR, messageBuffer.toString());
                        }
                    } catch (final SAXException e) {
                        log(Severity.FATAL_ERROR, e.getMessage());
                    }
                }
            } else {
                for (final int groupNo : referencedGroups) {
                    try {
                        // Filter the buffer with the parent expression.
                        final Buffer val = parentMatch.filter(buffer, groupNo);
                        node.storeValue(groupNo, parentMatchCount, val);

                    } catch (final SAXException e) {
                        log(Severity.FATAL_ERROR, e.getMessage());

                    } catch (final IndexOutOfBoundsException e) {
                        node.storeValue(groupNo, parentMatchCount, null);

                        messageBuffer.clear();
                        messageBuffer.append("Group number ");
                        messageBuffer.append(groupNo);
                        messageBuffer.append(" not found in parent expression of: ");
                        messageBuffer.append(node.getDebugId());
                        log(Severity.FATAL_ERROR, messageBuffer.toString());
                    }
                }
            }
        }
    }
Store data against a node for future retrieval by this node or by remote
reference from another node in the case of var elements.
stroom-pipeline/src/main/java/stroom/pipeline/xml/converter/ds3/DS3Parser.java