[204210] NPE when click on "version" in xml file
diff --git a/bundles/org.eclipse.wst.xml.ui/src-multipage/org/eclipse/wst/xml/ui/internal/tabletree/XMLTableTreeViewer.java b/bundles/org.eclipse.wst.xml.ui/src-multipage/org/eclipse/wst/xml/ui/internal/tabletree/XMLTableTreeViewer.java
index 61436b6..331f2d6 100644
--- a/bundles/org.eclipse.wst.xml.ui/src-multipage/org/eclipse/wst/xml/ui/internal/tabletree/XMLTableTreeViewer.java
+++ b/bundles/org.eclipse.wst.xml.ui/src-multipage/org/eclipse/wst/xml/ui/internal/tabletree/XMLTableTreeViewer.java
@@ -53,6 +53,7 @@
 import org.eclipse.wst.xml.ui.internal.contentoutline.XMLNodeActionManager;
 import org.eclipse.wst.xml.ui.internal.dnd.DragNodeCommand;
 import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
 
 public class XMLTableTreeViewer extends TreeViewer implements IDesignViewer {
@@ -102,21 +103,27 @@
 				IStructuredSelection structuredSelection = (IStructuredSelection) selection;
 				if (selection instanceof ITextSelection) {
 					ITextSelection textSelection = (ITextSelection) selection;
+					
 					if (structuredSelection.size() == 1) {
 						if (structuredSelection.getFirstElement() instanceof IDOMNode) {
 							IDOMNode domNode = (IDOMNode) structuredSelection.getFirstElement();
 							IStructuredDocumentRegion startStructuredDocumentRegion = domNode.getStartStructuredDocumentRegion();
 							if (startStructuredDocumentRegion != null) {
 								ITextRegion matchingRegion = startStructuredDocumentRegion.getRegionAtCharacterOffset(textSelection.getOffset());
-								while (matchingRegion != null && !matchingRegion.getType().equals(DOMRegionContext.XML_TAG_ATTRIBUTE_NAME)) {
+								int allowedIterations = 40;
+								while (matchingRegion != null && !matchingRegion.getType().equals(DOMRegionContext.XML_TAG_ATTRIBUTE_NAME) && allowedIterations > 0) {
 									matchingRegion = startStructuredDocumentRegion.getRegionAtCharacterOffset(startStructuredDocumentRegion.getStartOffset(matchingRegion) - 1);
+									allowedIterations--;
 								}
 								if (matchingRegion != null && matchingRegion.getType().equals(DOMRegionContext.XML_TAG_ATTRIBUTE_NAME)) {
 									String attrName = startStructuredDocumentRegion.getText(matchingRegion);
-									Node attr = domNode.getAttributes().getNamedItem(attrName);
-									if (attr != null) {
-										selectionSet = true;
-										XMLTableTreeViewer.this.setSelection(new StructuredSelection(attr));
+									NamedNodeMap attributes = domNode.getAttributes();
+									if (attributes != null && attrName.length() > 0) {
+										Node attr = attributes.getNamedItem(attrName);
+										if (attr != null) {
+											selectionSet = true;
+											XMLTableTreeViewer.this.setSelection(new StructuredSelection(attr));
+										}
 									}
 								}
 							}
@@ -132,8 +139,6 @@
 
 	protected CellEditor cellEditor;
 
-	int count = 0;
-
 	protected XMLTreeExtension treeExtension;
 	
 	private ISelectionProvider fSelectionProvider = new SelectionProvider();