private void parseChildren(Element e, XMLTag tag) {

        NodeList children = e.getChildNodes();

        for (int i = 0; i < children.getLength(); i++) {

            Node nChild = children.item(i);

            if (nChild.getNodeType() == Node.ELEMENT_NODE) {

                Element eChild = (Element) nChild;

                XMLTag child = new XMLTag(eChild.getNodeName());

                child.setParent(tag);

                parseElementAttributes(eChild, child);

                parseChildren(eChild, child);

                tag.addChild(child);

            } else if (nChild.getNodeType() == Node.TEXT_NODE) {

                String value = nChild.getTextContent();

                if (value != null && !value.trim().contentEquals("")) {

                    tag.setValue(value);
                }

            } else if (nChild.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) {

                PITag child = new PITag(nChild.getNodeName());

                child.setValue(nChild.getNodeValue());

                child.setParent(tag);

                tag.addChild(child);
            }
        }
    }