private void addChildren(Element element, List list) { List children = element.getChildren(); Iterator it = children.iterator(); while (it.hasNext()) { Element child = (Element) it.next(); list.add(child); addChildren(child, list); } } }
public void readData(@NotNull Element element) { final Element conflictsElement = element.getChild(SHORTCUT_CONFLICTS_ELEMENT); if (conflictsElement != null) { final java.util.List<Element> conflictElements = conflictsElement.getChildren(SHORTCUT_CONFLICT_ELEMENT); for (Element conflictElement : conflictElements) { final String ownerValue = conflictElement.getAttributeValue(OWNER_ATTRIBUTE); ShortcutOwner owner = ShortcutOwner.UNDEFINED; try { owner = ShortcutOwner.fromString(ownerValue); } catch (IllegalArgumentException ignored) { } final Element textElement = conflictElement.getChild(TEXT_ELEMENT); if (textElement != null) { final String text = StringHelper.getSafeXmlText(textElement); if (text != null) { final KeyStroke keyStroke = KeyStroke.getKeyStroke(text); if (keyStroke != null) { shortcutConflicts.put(keyStroke, owner); } } } } } }
public static SerializerDefinition readSerializer(Element elmt) { String name = elmt.getChild(STORE_SERIALIZATION_TYPE_ELMT).getText(); boolean hasVersion = true; Map<Integer, String> schemaInfosByVersion = new HashMap<Integer, String>(); for(Object schemaInfo: elmt.getChildren(STORE_SERIALIZATION_META_ELMT)) { Element schemaInfoElmt = (Element) schemaInfo; String versionStr = schemaInfoElmt.getAttributeValue(STORE_VERSION_ATTR); throw new IllegalArgumentException("Specified multiple schemas AND version=none, which is not permitted."); Element compressionElmt = elmt.getChild(STORE_COMPRESSION_ELMT); Compression compression = null; if(compressionElmt != null)
Element node = (Element) contextNode; if (namespaceURI == null) { return node.getChildren(localName).iterator(); return node.getChildren(localName, Namespace.getNamespace(namespacePrefix, namespaceURI)).iterator(); if (!Namespace.getNamespace(namespacePrefix, namespaceURI).equals(el.getNamespace())) { return JaxenConstants.EMPTY_ITERATOR; else if(el.getNamespace() != Namespace.NO_NAMESPACE) { return JaxenConstants.EMPTY_ITERATOR;
private void checkForNoLongerSupported(Element root) throws Exception { Namespace namespace = root.getNamespace(); List<Element> children = root.getChildren("service", namespace); for (Element child : children) { Element typeChild = child.getChild("type", namespace); String type = typeChild.getText(); if (type.equals("management.snmp")) { throw new Exception("snmp management type is no longer supported."); } else if (type.equals("session")) { throw new Exception("session service type is no longer supported."); } } }
@SuppressWarnings("unchecked") static List<org.jdom.Element> getChildren(org.jdom.Element e, String name) { if (e == null) { return null; } Namespace ns = e.getNamespace(); return e.getChildren(name, ns); }
private void getDescendants(Element node, List result) { for (Iterator iter = node.getChildren().iterator(); iter.hasNext(); ) { Element subnode = (Element) iter.next(); result.add(subnode); getDescendants(subnode, result); } }
private void readData(@NotNull Element element, String key) { HistoryBlock block = histories.get(key); if (block != null) { return; } block = new HistoryBlock(); histories.put(key, block); final Element root = element.getChild("history-" + key); if (root != null) { //noinspection unchecked List<Element> items = root.getChildren("entry"); for (Element item : items) { final String text = StringHelper.getSafeXmlText(item); if (text != null) { block.addEntry(text); } } } }
/** * Resolve datasets using job configuration. * * @param eAppXml : Job Element XML * @throws Exception thrown if failed to resolve datasets */ @SuppressWarnings("unchecked") private void resolveDataSets(Element eAppXml) throws Exception { Element datasetList = eAppXml.getChild("datasets", eAppXml.getNamespace()); if (datasetList != null) { List<Element> dsElems = datasetList.getChildren("dataset", eAppXml.getNamespace()); resolveDataSets(dsElems); resolveTagContents("app-path", eAppXml.getChild("action", eAppXml.getNamespace()).getChild("workflow", eAppXml.getNamespace()), evalNofuncs); } }
protected final org.jdom.Element findElement(org.jdom.Element parent, String name) { List<org.jdom.Element> childs = parent.getChildren("element", parent.getNamespace()); //NOI18N for (org.jdom.Element el : childs) { if (name.equals(el.getAttributeValue("name"))) { //NOI18N return el; } } return null; }
Element zoneReplicationFactorNode = store.getChild(STORE_ZONE_REPLICATION_FACTOR_ELMT); if(zoneReplicationFactorNode != null) { zoneReplicationFactor = new HashMap<Integer, Integer>(); for(Element node: (List<Element>) zoneReplicationFactorNode.getChildren(STORE_REPLICATION_FACTOR_ELMT)) { int zone = Integer.parseInt(node.getAttribute(STORE_ZONE_ID_ELMT).getValue()); int repFactor = Integer.parseInt(node.getText()); if(preferredWritesStr != null) preferredWrites = Integer.parseInt(preferredWritesStr); SerializerDefinition keySerializer = readSerializer(store.getChild(STORE_KEY_SERIALIZER_ELMT)); if(keySerializer.getAllSchemaInfoVersions().size() > 1) throw new MappingException("Only a single schema is allowed for the store key."); SerializerDefinition valueSerializer = readSerializer(store.getChild(STORE_VALUE_SERIALIZER_ELMT)); RoutingTier routingTier = RoutingTier.fromDisplay(store.getChildText(STORE_ROUTING_TIER_ELMT));
public void parse(Element root, Map<String, TargetMetaDef> mps) throws Exception { Debug .logVerbose("[JdonFramework] enter XmlPojoServiceParser .", module); List services = root.getChildren("services"); Iterator iter = services.iterator(); while (iter.hasNext()) { Element service = (Element) iter.next(); if (service.getChildren("pojoService") != null) { Iterator ii = service.getChildren("pojoService").iterator(); while (ii.hasNext()) { Element pojoService = (Element) ii.next(); parsePOJOServiceConfig(pojoService, mps); } } if (service.getChildren("component") != null) { Iterator ii = service.getChildren("component").iterator(); while (ii.hasNext()) { Element pojoService = (Element) ii.next(); parsePOJOServiceConfig(pojoService, mps); } } } }
public void readData(@NotNull final Element element) { logger.debug("readData"); final Element registersElement = element.getChild("registers"); if (registersElement != null) { final List<Element> registerElements = registersElement.getChildren("register"); for (Element registerElement : registerElements) { final char key = registerElement.getAttributeValue("name").charAt(0); final Register register; final Element textElement = registerElement.getChild("text"); final String typeText = registerElement.getAttributeValue("type"); final SelectionType type = SelectionType.fromValue(Integer.parseInt(typeText)); final Element keysElement = registerElement.getChild("keys"); final List<Element> keyElements = keysElement.getChildren("key"); final List<KeyStroke> strokes = new ArrayList<>(); for (Element keyElement : keyElements) {
/** * Resolve datasets using job configuration. * * @param eAppXml : Job Element XML * @throws Exception thrown if failed to resolve datasets */ @SuppressWarnings("unchecked") private void resolveDataSets(Element eAppXml) throws Exception { Element datasetList = eAppXml.getChild("datasets", eAppXml.getNamespace()); if (datasetList != null) { List<Element> dsElems = datasetList.getChildren("dataset", eAppXml.getNamespace()); resolveDataSets(dsElems); resolveTagContents("app-path", eAppXml.getChild("action", eAppXml.getNamespace()).getChild("workflow", eAppXml.getNamespace()), evalNofuncs); } }
static List<org.jdom.Element> getDescendants(org.jdom.Element tel, String... names) { ArrayList<org.jdom.Element> aktl=new ArrayList<>(); ArrayList<org.jdom.Element> newl=new ArrayList<>(); aktl.add(tel); for (String n : names) { for (org.jdom.Element e : aktl) { if (e != null) { Namespace ns = e.getNamespace(); newl.addAll(e.getChildren(n, ns)); } } aktl=newl; newl=new ArrayList<>(); } return aktl; }
public void parse(Element root, Map mps) throws Exception { List components = root.getChildren("component"); Debug.logVerbose("[JdonFramework] found component size:" + components.size(), module); Iterator iter = components.iterator(); while (iter.hasNext()) { Element component = (Element) iter.next(); String name = component.getAttributeValue("name"); String className = component.getAttributeValue("class"); List mappings = component.getChildren("constructor"); String[] constructors = null; if ((mappings != null) && (mappings.size() != 0)) { constructors = new String[mappings.size()]; int j = 0; Iterator i = mappings.iterator(); while (i.hasNext()) { Element constructor = (Element) i.next(); String value = constructor.getAttributeValue("value"); Debug.logVerbose("[JdonFramework] component constructor=" + value, module);
/** * Loads {@link UserTemplate} objects from the {@link Element}. * * @param element source * @return {@link UserTemplate} list */ @NotNull public static List<UserTemplate> loadTemplates(@NotNull Element element) { final String key = KEY.USER_TEMPLATES.toString(); final List<UserTemplate> list = ContainerUtil.newArrayList(); if (!key.equals(element.getName())) { element = element.getChild(key); } for (Element template : element.getChildren()) { list.add(new UserTemplate( template.getAttributeValue(KEY.USER_TEMPLATES_NAME.toString()), template.getText() )); } return list; }
@SuppressWarnings("unchecked") private Element getInputSetEvent(String name) throws JDOMException { Element eAction = XmlUtils.parseXml(coordAction.getActionXml().toString()); Element inputList = eAction.getChild("input-events", eAction.getNamespace()); List<Element> eDataEvents = inputList.getChildren("data-in", eAction.getNamespace()); for (Element dEvent : eDataEvents) { if (dEvent.getAttribute("name").getValue().equals(name)) { return dEvent; } } throw new RuntimeException("Event not found"); } }
private boolean hasElementsFrom(Element root, Namespace namespace) { boolean hasElements = false; // boolean hasElements = namespace.equals(root.getNamespace()); if (!hasElements) { List children = root.getChildren(); for (int i=0;!hasElements && i < children.size();i++) { Element child = (Element) children.get(i); hasElements = namespace.equals(child.getNamespace()); } } return hasElements; } }
public void parse(Element root, Map mps) throws Exception { List interceptors = root.getChildren("interceptor"); Debug.logVerbose("[JdonFramework] found interceptor size:" + interceptors.size(), module); Iterator iter = interceptors.iterator(); while (iter.hasNext()) { Element component = (Element) iter.next(); String name = component.getAttributeValue("name"); Debug.logVerbose("[JdonFramework] found interceptor name:" + name, module); String className = component.getAttributeValue("class"); String pointcut = component.getAttributeValue("pointcut"); List mappings = component.getChildren("constructor"); String[] constructors = null; if ((mappings != null) && (mappings.size() != 0)) { constructors = new String[mappings.size()]; int j = 0; Iterator i = mappings.iterator(); while (i.hasNext()) { Element constructor = (Element) i.next(); String value = constructor.getAttributeValue("value"); Debug.logVerbose("[JdonFramework] interceptor " + name + "constructor=" + value, module);