DataNode convertToDataNode(Node node) {
		if (node != null) {
			DataNode dataNode = new BasicDataNode(node.getNodeName(),
					node.getTextContent());
			
			NodeList children = node.getChildNodes();
			
			for (int index = 0; index < children.getLength(); ++index) {
				Node child = children.item(index);
				
				if (child.getNodeType() == Node.TEXT_NODE) {
					dataNode.setContent(child.getTextContent().trim());
					break;
				}
			}

			NamedNodeMap attributes = node.getAttributes();

			if (attributes != null) {
				for (int i = 0; i < attributes.getLength(); ++i) {
					Node attribute = attributes.item(i);

					if (attribute.getNodeType() == Node.ATTRIBUTE_NODE) {
						dataNode.addAttribute(attribute.getNodeName(),
								attribute.getNodeValue());
					}
				}
			}

			return dataNode;
		} else {
			return null;
		}
	}