class SequenceDescriptorParser {

    public List<SequenceDescriptor> parse(final Document document, final Element root, final List<DialogDescriptor> dialogDescriptors) {
        NodeList sequenceDescriptorNodes = root.getElementsByTagName(SequenceDescriptor.TAG_NAME);
        List<SequenceDescriptor> sequenceDescriptors = new ArrayList<>();
        for (int i = 0; i < sequenceDescriptorNodes.getLength(); i++) {
            Element sequenceElement = (Element) sequenceDescriptorNodes.item(i);
            SequenceDescriptor sequenceDescriptor = sequenceDescriptorFactory.create(document, sequenceElement, dialogDescriptors);
            sequenceDescriptors.add(sequenceDescriptor);
        }
        return sequenceDescriptors;
    }

}