use of org.dom4j.Node in project application by collectionspace.
the class GenericStorage method getHardListView.
/**
* return list view of items
* TODO make getHardListView and getRepeatableHardListView to share more code as they aren't different enough to warrant the level of code repeat
* @param creds
* @param cache
* @param path
* @param nodeName
* @param matchlistitem
* @param csidfield
* @param fullcsid
* @return
* @throws ConnectionException
* @throws JSONException
*/
protected JSONObject getHardListView(CSPRequestCredentials creds, CSPRequestCache cache, String path, String listItemPath, String csidfield, Boolean fullcsid) throws ConnectionException, JSONException {
String[] listItemPathElements = listItemPath.split("/");
if (listItemPathElements.length != 2) {
throw new IllegalArgumentException("Illegal list item path " + listItemPath);
}
String listNodeName = listItemPathElements[0];
String listItemNodeName = listItemPathElements[1];
String listNodeChildrenSelector = "/" + listNodeName + "/*";
JSONObject out = new JSONObject();
JSONObject pagination = new JSONObject();
Document list = null;
List<String> listitems = new ArrayList<String>();
ReturnedDocument all = conn.getXMLDocument(RequestMethod.GET, path, null, creds, cache);
if (all.getStatus() != 200) {
// throw new StatusException(all.getStatus(),path,"Bad request during identifier cache map update: status not 200");
throw new ConnectionException("Bad request during identifier cache map update: status not 200 is " + Integer.toString(all.getStatus()), all.getStatus(), path);
}
list = all.getDocument();
List<Node> nodes = list.selectNodes(listNodeChildrenSelector);
if (listNodeName.equals("roles_list") || listNodeName.equals("permissions_list")) {
// XXX CSPACE-1887 workaround
for (Node node : nodes) {
if (listItemNodeName.equals(node.getName())) {
String csid = node.valueOf("@csid");
listitems.add(csid);
} else {
pagination.put(node.getName(), node.getText());
}
}
} else {
String[] allfields = null;
String fieldsReturnedName = r.getServicesFieldsPath();
for (Node node : nodes) {
if (listItemNodeName.equals(node.getName())) {
List<Node> fields = node.selectNodes("*");
String csid = "";
String extraFieldValue = "";
String urlPlusCSID = null;
if (node.selectSingleNode(csidfield) != null) {
csid = node.selectSingleNode(csidfield).getText();
urlPlusCSID = r.getServicesURL() + "/" + csid;
setGleanedValue(cache, urlPlusCSID, "csid", csid);
}
for (Node field : fields) {
if (csidfield.equals(field.getName())) {
if (!fullcsid) {
int idx = csid.lastIndexOf("/");
if (idx != -1) {
csid = csid.substring(idx + 1);
urlPlusCSID = r.getServicesURL() + "/" + csid;
}
}
listitems.add(csid);
} else {
String json_name = view_map.get(field.getName());
if (json_name != null) {
String value = field.getText();
// XXX hack to cope with multi values
if (value == null || "".equals(value)) {
List<Node> inners = field.selectNodes("*");
for (Node n : inners) {
value += n.getText();
}
}
setGleanedValue(cache, urlPlusCSID, json_name, value);
}
}
}
if (allfields == null || allfields.length == 0) {
if (log.isWarnEnabled()) {
log.warn("getHardListView(): Missing fieldsReturned value - may cause fan-out!\nRecord:" + r.getID() + " request to: " + path);
}
} else {
// Mark all the fields not yet found as gleaned -
for (String s : allfields) {
String gleaned = getGleanedValue(cache, urlPlusCSID, s);
if (gleaned == null) {
setGleanedValue(cache, urlPlusCSID, s, "");
}
}
}
} else if (fieldsReturnedName.equals(node.getName())) {
String myfields = node.getText();
allfields = myfields.split("\\|");
} else {
pagination.put(node.getName(), node.getText());
}
}
}
out.put("pagination", pagination);
out.put("listItems", listitems.toArray(new String[0]));
return out;
}
use of org.dom4j.Node in project OpenOLAT by OpenOLAT.
the class ChoiceQuestion method getInstance.
/**
* Called by ItemParser to fetch question/answers.
*
* @param item
* @return
*/
public static ChoiceQuestion getInstance(Element item) {
ChoiceQuestion instance = new ChoiceQuestion();
try {
String item_ident = item.attributeValue("ident");
if (item_ident.startsWith(ItemParser.ITEM_PREFIX_SCQ))
instance.setType(TYPE_SC);
else if (item_ident.startsWith(ItemParser.ITEM_PREFIX_MCQ))
instance.setType(TYPE_MC);
else if (item_ident.startsWith(ItemParser.ITEM_PREFIX_KPRIM))
instance.setType(TYPE_KPRIM);
else
return null;
Element presentationXML = item.element("presentation");
Element material = presentationXML.element("material");
Element flow = presentationXML.element("flow");
if (material == null && flow != null) {
/*
* This is a bugfix (see OLAT-4194). According to the qti specification,
* the presentation element can either have the elements material and
* response_lid as children or they may be children of the flow element
* which itself is a child of presentation.
*/
material = flow.element("material");
}
Material matQuestion = (Material) parserManager.parse(material);
if (matQuestion != null)
instance.setQuestion(matQuestion);
Element response_lid = presentationXML.element("response_lid");
if (response_lid == null && flow != null) {
response_lid = flow.element("response_lid");
}
String identQuestion = response_lid.attribute("ident").getText();
instance.setIdent(identQuestion);
String shuffle = response_lid.element("render_choice").attributeValue("shuffle");
if (shuffle == null)
shuffle = "Yes";
instance.setShuffle(shuffle.equals("Yes"));
// Set first flow_label class that is found for entire question. This
// editor uses the same flow_label on every response
Element flow_label = (Element) response_lid.selectSingleNode(".//flow_label");
if (flow_label != null)
instance.setFlowLabelClass(flow_label.attributeValue("class"));
List response_lables = response_lid.selectNodes(".//response_label");
List<Response> choices = QTIEditHelper.fetchChoices(response_lables);
instance.setResponses(choices);
Element resprocessingXML = item.element("resprocessing");
if (resprocessingXML != null) {
List respconditions = resprocessingXML.elements("respcondition");
Map<String, Float> points = QTIEditHelper.fetchPoints(respconditions, instance.getType());
// postprocessing choices
for (Iterator<Response> i = choices.iterator(); i.hasNext(); ) {
ChoiceResponse choice = (ChoiceResponse) i.next();
Float fPoints = points.get(choice.getIdent());
if (fPoints != null) {
choice.setPoints(fPoints.floatValue());
choice.setCorrect(true);
}
}
// get type of multiple choice
if (instance.getType() == TYPE_MC) {
// of answers is possible (which sets points by a setvar action="Set")
if (resprocessingXML.selectNodes(".//setvar[@action='Add']").size() == 0) {
instance.setSingleCorrect(true);
Collection<Float> values = points.values();
if (values.size() > 0)
instance.setSingleCorrectScore((values.iterator().next()).floatValue());
} else {
instance.setSingleCorrect(false);
}
QTIEditHelper.configureMinMaxScore(instance, (Element) resprocessingXML.selectSingleNode(".//decvar"));
} else if (instance.getType() == TYPE_SC) {
QTIEditHelper.configureMinMaxScore(instance, (Element) resprocessingXML.selectSingleNode(".//decvar"));
Collection<Float> values = points.values();
if (values.size() > 0) {
instance.setSingleCorrect(true);
instance.setSingleCorrectScore((values.iterator().next()).floatValue());
} else {
instance.setSingleCorrect(false);
instance.setSingleCorrectScore(0f);
}
} else if (instance.getType() == TYPE_KPRIM) {
instance.setSingleCorrect(false);
float maxValue = 0;
try {
Node score = resprocessingXML.selectSingleNode(".//decvar[@varname='SCORE']/@maxvalue");
if (score != null) {
maxValue = Float.parseFloat(score.getText());
}
} catch (NumberFormatException e) {
// set maxValue 0
}
for (int i = 0; i < choices.size(); i++) {
ChoiceResponse choice = (ChoiceResponse) choices.get(i);
if (resprocessingXML.selectNodes("./respcondition[@title='Mastery']/conditionvar/varequal[text()='" + choice.getIdent() + ":correct']").size() > 0) {
choice.setCorrect(true);
choice.setPoints(maxValue / 4);
} else {
choice.setCorrect(false);
choice.setPoints(maxValue / 4);
}
}
QTIEditHelper.configureMinMaxScore(instance, (Element) resprocessingXML.selectSingleNode(".//decvar"));
} else {
QTIEditHelper.configureMinMaxScore(instance, (Element) resprocessingXML.selectSingleNode(".//decvar"));
}
}
} catch (NullPointerException e) {
/*
* A null pointer exeption may occur (and has occured) due to incomplete
* implementation of the qti specification within OLAT. Since the QTI xml
* validation at this point already passed, it's hard to still output user
* information. At this point, definitely log error.
*/
log.error("Reading choice question failed. Might be due to incomplete qti implementation.", e);
}
return instance;
}
use of org.dom4j.Node in project OpenOLAT by OpenOLAT.
the class QTIImportProcessorTest method testImport_QTI12_multipleItems.
@Test
public void testImport_QTI12_multipleItems() throws IOException, URISyntaxException {
URL itemsUrl = QTIImportProcessorTest.class.getResource("multiple_items.zip");
Assert.assertNotNull(itemsUrl);
File itemFile = new File(itemsUrl.toURI());
// get the document informations
QTIImportProcessor proc = new QTIImportProcessor(owner, Locale.ENGLISH, itemFile.getName(), itemFile);
List<QuestionItem> items = proc.process();
Assert.assertNotNull(items);
Assert.assertEquals(2, items.size());
dbInstance.commitAndCloseSession();
// check the files
for (QuestionItem item : items) {
QuestionItemFull itemFull = (QuestionItemFull) item;
String dir = itemFull.getDirectory();
String file = itemFull.getRootFilename();
VFSContainer itemContainer = qpoolFileStorage.getContainer(dir);
Assert.assertNotNull(itemContainer);
VFSItem itemLeaf = itemContainer.resolve(file);
Assert.assertNotNull(itemLeaf);
Assert.assertTrue(itemLeaf instanceof VFSLeaf);
// try to parse it
InputStream is = ((VFSLeaf) itemLeaf).getInputStream();
XMLParser xmlParser = new XMLParser(new IMSEntityResolver());
Document doc = xmlParser.parse(is, false);
Node itemNode = doc.selectSingleNode("questestinterop/item");
Assert.assertNotNull(itemNode);
// check the attachments
if ("Export (blue)".equals(itemFull.getTitle())) {
Assert.assertTrue(exists(itemFull, "media/blue.png"));
Assert.assertFalse(exists(itemFull, "media/purple.png"));
} else if ("Export (purple)".equals(itemFull.getTitle())) {
Assert.assertFalse(exists(itemFull, "media/blue.png"));
Assert.assertTrue(exists(itemFull, "media/purple.png"));
} else {
Assert.fail();
}
}
}
use of org.dom4j.Node in project jMiniLang by bajdcc.
the class ModuleNet method buildRemoteMethods.
private void buildRemoteMethods(IRuntimeDebugInfo info) {
info.addExternalFunc("g_net_get", new IRuntimeDebugExec() {
@Override
public String getDoc() {
return "HTTP GET";
}
@Override
public RuntimeObjectType[] getArgsType() {
return new RuntimeObjectType[] { RuntimeObjectType.kString };
}
@Override
public RuntimeObject ExternalProcCall(List<RuntimeObject> args, IRuntimeStatus status) {
String text = "";
String txt = String.valueOf(args.get(0).getObj());
logger.debug("Request url: " + txt);
try {
URL url = new URL(txt);
// 打开连接
URLConnection urlConnection = url.openConnection();
// 获取输入流
BufferedReader br = new BufferedReader(new InputStreamReader(urlConnection.getInputStream(), "utf-8"));
String line = null;
StringBuilder sb = new StringBuilder();
while ((line = br.readLine()) != null) {
sb.append(line).append("\n");
}
text = sb.toString();
br.close();
} catch (Exception e) {
e.printStackTrace();
}
return new RuntimeObject(text);
}
});
info.addExternalFunc("g_net_get_json", new IRuntimeDebugExec() {
@Override
public String getDoc() {
return "HTTP GET - json";
}
@Override
public RuntimeObjectType[] getArgsType() {
return new RuntimeObjectType[] { RuntimeObjectType.kString };
}
@Override
public RuntimeObject ExternalProcCall(List<RuntimeObject> args, IRuntimeStatus status) {
String text = "";
String txt = String.valueOf(args.get(0).getObj());
logger.debug("Request url(json): " + txt);
try {
URL url = new URL(txt);
// 打开连接
URLConnection urlConnection = url.openConnection();
// 获取输入流
BufferedReader br = new BufferedReader(new InputStreamReader(urlConnection.getInputStream(), "utf-8"));
String line = null;
StringBuilder sb = new StringBuilder();
while ((line = br.readLine()) != null) {
sb.append(line).append("\n");
}
text = sb.toString();
br.close();
} catch (Exception e) {
e.printStackTrace();
}
return parseJson(text);
}
});
// -----------------------------------
// server
info.addExternalFunc("g_net_msg_create_server_internal", new IRuntimeDebugExec() {
@Override
public String getDoc() {
return "MSG SERVER";
}
@Override
public RuntimeObjectType[] getArgsType() {
return new RuntimeObjectType[] { RuntimeObjectType.kInt };
}
@Override
public RuntimeObject ExternalProcCall(List<RuntimeObject> args, IRuntimeStatus status) {
if (getServer() != null || getClient() != null)
return new RuntimeObject(false);
int port = ((BigInteger) args.get(0).getObj()).intValue();
setServer(new ModuleNetServer(port));
getServer().start();
return new RuntimeObject(true);
}
});
info.addExternalFunc("g_net_msg_shutdown_server", new IRuntimeDebugExec() {
@Override
public String getDoc() {
return "MSG SERVER SHUTDOWN";
}
@Override
public RuntimeObjectType[] getArgsType() {
return null;
}
@Override
public RuntimeObject ExternalProcCall(List<RuntimeObject> args, IRuntimeStatus status) {
if (getServer() == null)
return new RuntimeObject(false);
getServer().exit();
return new RuntimeObject(true);
}
});
info.addExternalFunc("g_net_msg_get_server_status", new IRuntimeDebugExec() {
@Override
public String getDoc() {
return "MSG SERVER GET STATUS";
}
@Override
public RuntimeObjectType[] getArgsType() {
return null;
}
@Override
public RuntimeObject ExternalProcCall(List<RuntimeObject> args, IRuntimeStatus status) {
if (getServer() != null) {
ModuleNetServer.Status s = getServer().getStatus();
if (s == ModuleNetServer.Status.ERROR) {
lastError = getServer().getError();
setServer(null);
}
status.getService().getProcessService().sleep(status.getPid(), MSG_QUERY_TIME);
return new RuntimeObject(BigInteger.valueOf(s.ordinal()));
}
return new RuntimeObject(BigInteger.valueOf(ModuleNetServer.Status.NULL.ordinal()));
}
});
// server
// -----------------------------------
// client
info.addExternalFunc("g_net_msg_create_client_internal", new IRuntimeDebugExec() {
@Override
public String getDoc() {
return "MSG CLIENT";
}
@Override
public RuntimeObjectType[] getArgsType() {
return new RuntimeObjectType[] { RuntimeObjectType.kString };
}
@Override
public RuntimeObject ExternalProcCall(List<RuntimeObject> args, IRuntimeStatus status) {
if (getServer() != null || getClient() != null)
return new RuntimeObject(false);
String addr = String.valueOf(args.get(0).getObj());
setClient(new ModuleNetClient(addr));
getClient().start();
return new RuntimeObject(true);
}
});
info.addExternalFunc("g_net_msg_shutdown_client", new IRuntimeDebugExec() {
@Override
public String getDoc() {
return "MSG CLIENT SHUTDOWN";
}
@Override
public RuntimeObjectType[] getArgsType() {
return null;
}
@Override
public RuntimeObject ExternalProcCall(List<RuntimeObject> args, IRuntimeStatus status) {
if (getClient() == null)
return new RuntimeObject(false);
getClient().exit();
return new RuntimeObject(true);
}
});
info.addExternalFunc("g_net_msg_get_client_status", new IRuntimeDebugExec() {
@Override
public String getDoc() {
return "MSG CLIENT GET STATUS";
}
@Override
public RuntimeObjectType[] getArgsType() {
return null;
}
@Override
public RuntimeObject ExternalProcCall(List<RuntimeObject> args, IRuntimeStatus status) {
if (getClient() != null) {
ModuleNetClient.Status s = getClient().getStatus();
if (s == ModuleNetClient.Status.ERROR) {
lastError = getClient().getError();
setClient(null);
}
status.getService().getProcessService().sleep(status.getPid(), MSG_QUERY_TIME);
return new RuntimeObject(BigInteger.valueOf(s.ordinal()));
}
return new RuntimeObject(BigInteger.valueOf(ModuleNetClient.Status.NULL.ordinal()));
}
});
info.addExternalFunc("g_net_msg_client_send", new IRuntimeDebugExec() {
@Override
public String getDoc() {
return "MSG CLIENT SEND";
}
@Override
public RuntimeObjectType[] getArgsType() {
return new RuntimeObjectType[] { RuntimeObjectType.kString };
}
@Override
public RuntimeObject ExternalProcCall(List<RuntimeObject> args, IRuntimeStatus status) {
if (getClient() != null) {
ModuleNetClient.Status s = getClient().getStatus();
if (s == ModuleNetClient.Status.RUNNING) {
status.getService().getProcessService().sleep(status.getPid(), MSG_SEND_TIME);
getClient().send(String.valueOf(args.get(0).getObj()));
return new RuntimeObject(true);
}
}
return new RuntimeObject(false);
}
});
info.addExternalFunc("g_net_msg_client_send_with_origin", new IRuntimeDebugExec() {
@Override
public String getDoc() {
return "MSG CLIENT SEND(ORIGIN)";
}
@Override
public RuntimeObjectType[] getArgsType() {
return new RuntimeObjectType[] { RuntimeObjectType.kString, RuntimeObjectType.kString };
}
@Override
public RuntimeObject ExternalProcCall(List<RuntimeObject> args, IRuntimeStatus status) {
if (getClient() != null) {
ModuleNetClient.Status s = getClient().getStatus();
if (s == ModuleNetClient.Status.RUNNING) {
status.getService().getProcessService().sleep(status.getPid(), MSG_SEND_TIME);
getClient().send(String.valueOf(args.get(0).getObj()), String.valueOf(args.get(1).getObj()));
return new RuntimeObject(true);
}
}
return new RuntimeObject(false);
}
});
info.addExternalFunc("g_net_msg_server_send", new IRuntimeDebugExec() {
@Override
public String getDoc() {
return "MSG SERVER SEND";
}
@Override
public RuntimeObjectType[] getArgsType() {
return new RuntimeObjectType[] { RuntimeObjectType.kString };
}
@Override
public RuntimeObject ExternalProcCall(List<RuntimeObject> args, IRuntimeStatus status) {
if (getServer() != null) {
ModuleNetServer.Status s = getServer().getStatus();
if (s == ModuleNetServer.Status.RUNNING) {
status.getService().getProcessService().sleep(status.getPid(), MSG_SEND_TIME);
getServer().send(String.valueOf(args.get(0).getObj()));
return new RuntimeObject(true);
}
}
return new RuntimeObject(false);
}
});
info.addExternalFunc("g_net_msg_server_send_error", new IRuntimeDebugExec() {
@Override
public String getDoc() {
return "MSG SERVER SEND ERROR";
}
@Override
public RuntimeObjectType[] getArgsType() {
return new RuntimeObjectType[] { RuntimeObjectType.kString };
}
@Override
public RuntimeObject ExternalProcCall(List<RuntimeObject> args, IRuntimeStatus status) {
if (getServer() != null) {
ModuleNetServer.Status s = getServer().getStatus();
if (s == ModuleNetServer.Status.RUNNING) {
status.getService().getProcessService().sleep(status.getPid(), MSG_SEND_TIME);
getServer().send_error(String.valueOf(args.get(0).getObj()));
return new RuntimeObject(true);
}
}
return new RuntimeObject(false);
}
});
info.addExternalFunc("g_net_msg_server_send_with_origin", new IRuntimeDebugExec() {
@Override
public String getDoc() {
return "MSG SERVER SEND(ORIGIN)";
}
@Override
public RuntimeObjectType[] getArgsType() {
return new RuntimeObjectType[] { RuntimeObjectType.kString, RuntimeObjectType.kString };
}
@Override
public RuntimeObject ExternalProcCall(List<RuntimeObject> args, IRuntimeStatus status) {
if (getServer() != null) {
ModuleNetServer.Status s = getServer().getStatus();
if (s == ModuleNetServer.Status.RUNNING) {
status.getService().getProcessService().sleep(status.getPid(), MSG_SEND_TIME);
getServer().send(String.valueOf(args.get(0).getObj()), String.valueOf(args.get(1).getObj()));
return new RuntimeObject(true);
}
}
return new RuntimeObject(false);
}
});
// client
// -----------------------------------
info.addExternalFunc("g_net_msg_get_error", new IRuntimeDebugExec() {
@Override
public String getDoc() {
return "MSG SERVER GET ERROR";
}
@Override
public RuntimeObjectType[] getArgsType() {
return null;
}
@Override
public RuntimeObject ExternalProcCall(List<RuntimeObject> args, IRuntimeStatus status) {
return new RuntimeObject(lastError);
}
});
info.addExternalFunc("g_net_msg_get_server_msg", new IRuntimeDebugExec() {
@Override
public String getDoc() {
return "MSG SERVER GET MESSAGE";
}
@Override
public RuntimeObjectType[] getArgsType() {
return null;
}
@Override
public RuntimeObject ExternalProcCall(List<RuntimeObject> args, IRuntimeStatus status) {
return new RuntimeObject(getServer() == null ? null : getServer().getMessage());
}
});
info.addExternalFunc("g_net_msg_get_client_msg", new IRuntimeDebugExec() {
@Override
public String getDoc() {
return "MSG CLIENT GET MESSAGE";
}
@Override
public RuntimeObjectType[] getArgsType() {
return null;
}
@Override
public RuntimeObject ExternalProcCall(List<RuntimeObject> args, IRuntimeStatus status) {
return new RuntimeObject(getClient() == null ? null : getClient().getMessage());
}
});
info.addExternalFunc("g_net_msg_get_client_addr", new IRuntimeDebugExec() {
@Override
public String getDoc() {
return "MSG CLIENT GET ADDRESS";
}
@Override
public RuntimeObjectType[] getArgsType() {
return null;
}
@Override
public RuntimeObject ExternalProcCall(List<RuntimeObject> args, IRuntimeStatus status) {
return new RuntimeObject(getClient() == null ? null : getClient().getAddr());
}
});
info.addExternalFunc("g_net_parse_json", new IRuntimeDebugExec() {
@Override
public String getDoc() {
return "Parse json";
}
@Override
public RuntimeObjectType[] getArgsType() {
return new RuntimeObjectType[] { RuntimeObjectType.kString };
}
@Override
public RuntimeObject ExternalProcCall(List<RuntimeObject> args, IRuntimeStatus status) {
return parseJsonSafe(String.valueOf(args.get(0).getObj()));
}
});
info.addExternalFunc("g_net_get_rss", new IRuntimeDebugExec() {
@Override
public String getDoc() {
return "RSS GET(BAIDU)";
}
@Override
public RuntimeObjectType[] getArgsType() {
return new RuntimeObjectType[] { RuntimeObjectType.kString };
}
@SuppressWarnings("unchecked")
@Override
public RuntimeObject ExternalProcCall(List<RuntimeObject> args, IRuntimeStatus status) {
String text = "";
String txt = String.valueOf(args.get(0).getObj());
logger.debug("Request url(rss): " + txt);
RuntimeArray array = new RuntimeArray();
final Pattern pattern = Pattern.compile("<br>(.*)<br />");
try {
SAXReader reader = new SAXReader();
Document document = reader.read(txt);
Node title = document.selectSingleNode("//title");
array.add(new RuntimeObject(title.getText()));
List<Node> list = document.selectNodes("//item");
for (Node item : list) {
String itemTitle = item.valueOf("title");
array.add(new RuntimeObject(itemTitle));
String itemDescription = item.valueOf("description");
Matcher matcher = pattern.matcher(itemDescription);
if (matcher.find()) {
array.add(new RuntimeObject(matcher.group(1)));
} else {
array.add(new RuntimeObject(itemDescription.replace("<br />", "")));
}
}
return new RuntimeObject(array);
} catch (Exception e) {
e.printStackTrace();
}
return new RuntimeObject(array);
}
});
}
use of org.dom4j.Node in project freemarker by apache.
the class _Dom4jNavigator method getDescendants.
private void getDescendants(Branch node, List result) {
List content = node.content();
for (Iterator iter = content.iterator(); iter.hasNext(); ) {
Node subnode = (Node) iter.next();
if (subnode instanceof Element) {
result.add(subnode);
getDescendants(subnode, result);
}
}
}
Aggregations