*/
package net.sourceforge.phpeclipse.xdebug.php.model;
+//import java.io.ByteArrayInputStream;
+//import java.io.IOException;
import java.util.List;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
import net.sourceforge.phpeclipse.xdebug.core.IPHPDebugEvent;
import net.sourceforge.phpeclipse.xdebug.core.IProxyEventListener;
import net.sourceforge.phpeclipse.xdebug.core.IXDebugPreferenceConstants;
import org.eclipse.debug.core.model.IMemoryBlock;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.debug.core.model.IThread;
+import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
+//import org.xml.sax.SAXException;
import net.sourceforge.phpeclipse.xdebug.core.xdebug.ResponseListener;
import net.sourceforge.phpeclipse.xdebug.core.xdebug.XDebugConnection;
}
}
- public Node eval(String expression) {
- int id = fDebugConnection.eval(expression);
- XDebugResponse response = getResponse(id);
-
- Node evalResponse = response.getParentNode();
- Node evalProperty = evalResponse.getFirstChild();
+ public Node eval(String expression) throws DebugException {
+ Node evalProperty = null;
+ if (fDebugConnection != null) {
+ int id = fDebugConnection.eval(expression);
+ //Node evalProperty = new Node("");
+ //if (id > 0) {
+ XDebugResponse response = getResponse(id);
+
+ Node evalResponse = response.getParentNode();
+ /*Node*/ evalProperty = evalResponse.getFirstChild();
+ //} /*else {
+
+ //}*/
+ } else {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = null;
+ Document doc = null;
+
+ try {
+ builder = factory.newDocumentBuilder();
+ } catch (ParserConfigurationException e) {
+ e.printStackTrace();
+ }
+ //try {
+ doc = builder.newDocument(); // .parse("");
+ evalProperty = doc.createElement("value");
+ /*} catch (SAXException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }*/
+ }
return evalProperty;
}