Index: tmp/org.txm.core/src/java/org/txm/xml/XPathHookActivator.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/xml/XPathHookActivator.java	(revision 3266)
+++ tmp/org.txm.core/src/java/org/txm/xml/XPathHookActivator.java	(revision 3267)
@@ -67,6 +67,7 @@
 	
 	@Override
 	public boolean mustActivate() {
+		
 		if (xpath == null) return false;
 		if (p == null) return false;
 		
@@ -75,7 +76,8 @@
 			return p.matcher(hook.getCurrentPath()).matches() && hook.parentParser.getCurrentAttributes().equals(attributesTest);
 		}
 		else {
-			return p.matcher(hook.getCurrentPath()).matches();
+			String path = hook.getCurrentPath();
+			return p.matcher(path).matches();
 		}
 	}
 	
Index: tmp/org.txm.core/src/java/org/txm/xml/StaxDomConstructor.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/xml/StaxDomConstructor.java	(revision 3266)
+++ tmp/org.txm.core/src/java/org/txm/xml/StaxDomConstructor.java	(revision 3267)
@@ -54,13 +54,8 @@
 					localname = parser.getLocalName();
 					
 					String ns = parser.getNamespaceURI();
-					Element e = null;
-					if (ns != null) {
-						e = doc.createElementNS(ns, localname);
-					}
-					else {
-						e = doc.createElement(localname);
-					}
+					if (ns == null) ns = "";
+					Element e = doc.createElementNS(ns, localname);
 					
 					for (int i = 0; i < parser.getAttributeCount(); i++) {
 						ns = parser.getAttributeNamespace(i);
@@ -88,7 +83,7 @@
 				case XMLStreamConstants.END_ELEMENT:
 					
 					elements--;
-					if (elements == 0) return doc.getDocumentElement();
+					if (elements == 0) return doc.getDocumentElement(); // stop parsing elements now : it was the last element
 					
 					currentElement = (Element) currentElement.getParentNode();
 					
Index: tmp/org.txm.core/src/java/org/txm/xml/DOMIdentityHook.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/xml/DOMIdentityHook.java	(revision 3266)
+++ tmp/org.txm.core/src/java/org/txm/xml/DOMIdentityHook.java	(revision 3267)
@@ -20,10 +20,11 @@
 	}
 	
 	@Override
-	public boolean _activate() {
+	public final boolean _activate() {
 		StaxDomConstructor domConstructor = new StaxDomConstructor(parentParser.parser);
 		try {
 			dom = domConstructor.getDom();
+			
 			return dom != null;
 		}
 		catch (Exception e) {
@@ -34,7 +35,7 @@
 	}
 	
 	@Override
-	public boolean mustDeactivate() {
+	public final boolean mustDeactivate() {
 		boolean b = dom != null; // the DOM has been constructed and the XMLProcess can continue parsing
 		if (b) {
 			try {
@@ -57,7 +58,7 @@
 	}
 	
 	@Override
-	public boolean deactivate() {
+	public final boolean deactivate() {
 		return dom == null; // dom should be null
 	}
 	
@@ -69,10 +70,17 @@
 		if (node == null) return; // nothing to write
 		
 		if (node.getNodeType() == Node.ELEMENT_NODE) {
+			parentParser.writer.writeCharacters("\n");
 			Element e = (Element) node;
 			NodeList children = e.getChildNodes();
 			if (children.getLength() > 0) {
-				parentParser.writer.writeStartElement(e.getNamespaceURI(), e.getLocalName());
+				String ns = e.getNamespaceURI();
+				String ln = e.getLocalName();
+				if (ns == null) {
+					parentParser.writer.writeStartElement(ln);
+				} else {
+					parentParser.writer.writeStartElement(ns, ln);
+				}
 			}
 			else {
 				parentParser.writer.writeEmptyElement(e.getNamespaceURI(), e.getLocalName());
@@ -87,12 +95,14 @@
 					parentParser.writer.writeAttribute(att.getNodeName(), att.getNodeValue());
 				}
 			}
+			//parentParser.writer.writeCharacters("\n");
 			
 			for (int c = 0; c < children.getLength(); c++) {
 				writeDOM(children.item(c));
 			}
 			if (children.getLength() > 0) {
 				parentParser.writer.writeEndElement();
+				parentParser.writer.writeCharacters("\n");
 			}
 		}
 		else if (node.getNodeType() == Node.TEXT_NODE) {
Index: tmp/org.txm.core/src/java/org/txm/xml/Hook.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/xml/Hook.java	(revision 3266)
+++ tmp/org.txm.core/src/java/org/txm/xml/Hook.java	(revision 3267)
@@ -120,9 +120,9 @@
 			case XMLStreamConstants.END_ELEMENT:
 				processEndElement();
 				elements--;
-				if (elements < 0) {
-					Log.severe("ERROR: Hook was not interupted on time AT " + getLocation());
-				}
+//				if (elements < 0) {
+//					//Log.severe("ERROR: Hook was not interupted on time AT " + getLocation());
+//				}
 				break;
 			case XMLStreamConstants.PROCESSING_INSTRUCTION:
 				processProcessingInstruction();
