private GenericTreeNode<LayoutParserTreeElement> parseXMLRow(
			Match currentMatch) {
		GenericTreeNode<LayoutParserTreeElement> parentTreeNode = null;
		int i;
		int top = -1;
		int bottom;
		int right;
		int left;

		// Parsam atributele ca sa nu dea eroare
		if (currentMatch.attr("top") != null) {
			top = Integer.parseInt(currentMatch.attr("top"));
		} else {
			top = -1;
		}

		if (currentMatch.attr("bottom") != null) {
			bottom = Integer.parseInt(currentMatch.attr("bottom"));
		} else {
			bottom = -1;
		}

		if (currentMatch.attr("left") != null) {
			left = Integer.parseInt(currentMatch.attr("left"));
		} else {
			left = -1;
		}

		if (currentMatch.attr("right") != null) {
			right = Integer.parseInt(currentMatch.attr("right"));
		} else {
			right = -1;
		}

		if (currentMatch.tag().compareTo("Point") == 0) {
			LayoutParserTreeElement new_element = new LayoutParserTreeElement(
					LayoutParserTreeElement.ElementType.valueOf(currentMatch
							.tag().toUpperCase()), currentMatch.attr("x"),
					currentMatch.attr("y"));
			return new GenericTreeNode<LayoutParserTreeElement>(new_element);
		} else if (currentMatch.children().size() == 0) {
			// Suntem in frunza
			LayoutParserTreeElement new_element = new LayoutParserTreeElement(
					LayoutParserTreeElement.ElementType.valueOf(currentMatch
							.tag().toUpperCase()), currentMatch.content(), top,
					bottom,
					right, left, currentMatch.attr("image"));
			return new GenericTreeNode<LayoutParserTreeElement>(new_element);
		}

		// Cream nod parinte
		LayoutParserTreeElement rootElement = null;
		if (currentMatch.tag().compareTo("ComposedBlock") == 0) {
			if (currentMatch.attr("type").compareTo("page_number") == 0) {
				rootElement = new LayoutParserTreeElement(
						LayoutParserTreeElement.ElementType.valueOf(currentMatch
								.tag().toUpperCase()),
						true);
			} else {
				rootElement = new LayoutParserTreeElement(
						LayoutParserTreeElement.ElementType.valueOf(currentMatch
								.tag().toUpperCase()),
						false);
			}
		} else {
			rootElement = new LayoutParserTreeElement(
					LayoutParserTreeElement.ElementType.valueOf(currentMatch
							.tag().toUpperCase()),
					currentMatch.content(), top, bottom, right, left,
					currentMatch.attr("image"));

		}

		parentTreeNode = new GenericTreeNode<LayoutParserTreeElement>(
				rootElement);

		// Parsam copiii
		for (i = 0; i < currentMatch.children().size(); i++) {
			Match textLineElement = currentMatch.child(i);
			GenericTreeNode<LayoutParserTreeElement> newTreeNode = parseXMLRow(textLineElement);
			parentTreeNode.addChild(newTreeNode);
		}

		// Intoarcem nodul parinte
		return parentTreeNode;
	}