add support for getting from name of element in fscript
This commit is contained in:
parent
7b7d4a206e
commit
acd1f0dfe8
|
@ -288,6 +288,11 @@ public class Rizzo {
|
|||
id = tag.substring(tag.indexOf("#")+1);
|
||||
tag = tag.substring(0, tag.indexOf("#"));
|
||||
}
|
||||
String name = "";
|
||||
if (tag.contains("$")) {
|
||||
name = tag.substring(tag.indexOf("$")+1);
|
||||
tag = tag.substring(0, tag.indexOf("$"));
|
||||
}
|
||||
if (id.length() > 0) {
|
||||
NodeList ns;
|
||||
if (parent instanceof Document document)
|
||||
|
@ -301,6 +306,19 @@ public class Rizzo {
|
|||
break;
|
||||
}
|
||||
}
|
||||
} else if (name.length() > 0) {
|
||||
NodeList ns;
|
||||
if (parent instanceof Document document)
|
||||
ns = document.getChildNodes();
|
||||
else
|
||||
ns = ((Element)parent).getChildNodes();
|
||||
for (int i = 0; i < ns.getLength(); i++) {
|
||||
Node n = ns.item(i);
|
||||
if (((Element)n).getAttribute("name").equals(name)) {
|
||||
newParent = (Element)n;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (parent instanceof Document document)
|
||||
newParent = document.getElementsByTagName(tag).item(index);
|
||||
|
|
Loading…
Reference in New Issue
Block a user