*** empty log message ***
diff --git a/bundles/org.eclipse.wst.xsl.launching/src/org/eclipse/wst/xsl/launching/model/NodeListVariable.java b/bundles/org.eclipse.wst.xsl.launching/src/org/eclipse/wst/xsl/launching/model/NodeListVariable.java
new file mode 100644
index 0000000..426668e
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsl.launching/src/org/eclipse/wst/xsl/launching/model/NodeListVariable.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ *Copyright (c) 2008 STAR and others.
+ *All rights reserved. This program and the accompanying materials
+ *are made available under the terms of the Eclipse Public License v1.0
+ *which accompanies this distribution, and is available at
+ *http://www.eclipse.org/legal/epl-v10.html
+ *
+ *Contributors:
+ * David Carver (STAR) - bug 214235 - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.xsl.launching.model;
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.core.model.IVariable;
+import org.w3c.dom.Node;
+
+public class NodeListVariable extends XSLDebugElement implements IVariable {
+
+ private Node node = null;
+ private IDebugTarget debugTarget;
+
+ public NodeListVariable(IDebugTarget target, Node nodeListNode) {
+ super(target);
+ node = nodeListNode;
+ debugTarget = target;
+ }
+
+ public String getName() throws DebugException {
+ // TODO Auto-generated method stub
+ String nodeName = "";
+ if (node.getPrefix() != null) {
+ nodeName = nodeName + node.getPrefix() + ":";
+ }
+ if (node.getNodeName() != null) {
+ nodeName = nodeName + node.getNodeName();
+ }
+ return nodeName;
+ }
+
+ public String getReferenceTypeName() throws DebugException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public IValue getValue() throws DebugException {
+ String nodeValue = "";
+ if (node.getNodeValue() != null) {
+ nodeValue = node.getNodeValue();
+ }
+ //IValue value = new XSLValue(debugTarget, "string", nodeValue);
+ IValue value = new XSLValue(debugTarget, "string", node);
+ return value;
+ }
+
+ public boolean hasValueChanged() throws DebugException {
+ return false;
+ }
+
+ public boolean supportsValueModification() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean verifyValue(String expression) throws DebugException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean verifyValue(IValue value) throws DebugException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void setValue(String expression) throws DebugException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setValue(IValue value) throws DebugException {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/bundles/org.eclipse.wst.xsl.launching/src/org/eclipse/wst/xsl/launching/model/XSLValue.java b/bundles/org.eclipse.wst.xsl.launching/src/org/eclipse/wst/xsl/launching/model/XSLValue.java
index 85fa4ba..fbb2b27 100644
--- a/bundles/org.eclipse.wst.xsl.launching/src/org/eclipse/wst/xsl/launching/model/XSLValue.java
+++ b/bundles/org.eclipse.wst.xsl.launching/src/org/eclipse/wst/xsl/launching/model/XSLValue.java
@@ -7,28 +7,59 @@
*
* Contributors:
* Doug Satchwell (Chase Technology Ltd) - initial API and implementation
+ * David Carver (STAR) - bug 214235 - Node List expansion
*******************************************************************************/
package org.eclipse.wst.xsl.launching.model;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.StringBufferInputStream;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IDebugTarget;
import org.eclipse.debug.core.model.IValue;
import org.eclipse.debug.core.model.IVariable;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
public class XSLValue extends XSLDebugElement implements IValue
{
private String fValue;
- private final String type;
+ private String type;
private boolean hasVariables;
private XSLVariable variable;
+ private Node actualNode;
+ public XSLValue(IDebugTarget target, String type, Node node) {
+ super(target);
+ String value = "";
+ if (node.getNodeValue() != null) {
+ value = node.getNodeValue();
+ }
+ init(target, type, value);
+ }
public XSLValue(IDebugTarget target, String type, String value)
{
super(target);
- IXSLDebugTarget xslDebugTarget = (IXSLDebugTarget) target;
+ init(target, type, value);
+ }
+
+ private void init(IDebugTarget target, String type, String value) {
this.type = type;
- if (type.equals("nodeset")) {
+ if (actualNode != null) {
+ hasVariables = actualNode.hasChildNodes();
+ } else if (type.equals("nodeset")) {
hasVariables = true;
} else {
hasVariables = false;
@@ -60,9 +91,43 @@
public IVariable[] getVariables() throws DebugException
{
-
+ if (actualNode != null) {
+ return getNodeListVariables(actualNode.getChildNodes());
+ }
+ if (type.equals("nodeset") && !(fValue.equals("<EMPTY NODESET>"))) {
+ DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
+ NodeList nodeList = null;
+ try {
+ DocumentBuilder builder = builderFactory.newDocumentBuilder();
+ InputStream is = new ByteArrayInputStream(fValue.getBytes());
+ Document doc = builder.parse(is);
+ nodeList = doc.getChildNodes();
+ return getNodeListVariables(nodeList);
+ } catch (ParserConfigurationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (SAXException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
return new IVariable[0];
}
+ private IVariable[] getNodeListVariables(NodeList nodeList) {
+ List<IVariable> variableList = new ArrayList<IVariable>();
+ IVariable[] returnVars = new IVariable[nodeList.getLength()];
+ if (nodeList != null) {
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Node node = nodeList.item(i);
+ IVariable variable = new NodeListVariable(getDebugTarget(), node);
+ variableList.add(variable);
+ }
+ }
+ return variableList.toArray(returnVars);
+ }
public boolean hasVariables() throws DebugException
{