List of usage examples for org.jdom2 Element getChildren
public List<Element> getChildren(final String cname, final Namespace ns)
List
of all the child elements nested directly (one level deep) within this element with the given local name and belonging to the given Namespace, returned as Element
objects. From source file:com.sun.syndication.io.impl.RSS094Parser.java
License:Open Source License
protected WireFeed parseChannel(Element rssRoot) { Channel channel = (Channel) super.parseChannel(rssRoot); Element eChannel = rssRoot.getChild("channel", getRSSNamespace()); List eCats = eChannel.getChildren("category", getRSSNamespace()); channel.setCategories(parseCategories(eCats)); Element eTtl = eChannel.getChild("ttl", getRSSNamespace()); if (eTtl != null && eTtl.getText() != null) { Integer ttlValue = null;//from www. j a v a 2 s . c o m try { ttlValue = new Integer(eTtl.getText()); } catch (NumberFormatException nfe) { ; //let it go by } if (ttlValue != null) { channel.setTtl(ttlValue.intValue()); } } return channel; }
From source file:compile.util.Pom.java
public HashMap<String, String> getMapDependencies() { HashMap<String, String> mapDependenciesProject = new HashMap<String, String>(); Element racine = _xmlUtil.getRacine(); Element projectDependencies = racine.getChild("dependencies", null); List<Element> listProjectDependencies = projectDependencies.getChildren("dependency", null); for (Element elem : listProjectDependencies) { mapDependenciesProject.put(elem.getChild("artifactId", null).getText(), elem.getChild("version", null).getText()); }//from w w w . j a v a2 s . co m return mapDependenciesProject; }
From source file:compile.util.Tomcat.java
public void checkIfInContextFile(Project proj) { LogService.tomcatAddingContext(// ww w.j a v a 2s . c o m PropertiesFile.getInstance().getPropertiesUtil().getParam("workingDirContext")); Element racine = _serverXml.getRacine(); Element service = racine.getChild("Service", null); Element engine = service.getChild("Engine", null); Element host = engine.getChild("Host", null); List<Element> listContext = host.getChildren("Context", null); boolean notInContext = true; for (Element context : listContext) { if (context.getAttributeValue("docBase") .equals(proj.getPathProject() + SEP + "target" + SEP + proj.getWebappName())) { notInContext = false; } } if (notInContext) { host.addContent(new Element("Context") .setAttribute("docBase", proj.getPathProject() + SEP + "target" + SEP + proj.getWebappName()) .setAttribute("path", PropertiesFile.getInstance().getPropertiesUtil().getParam("workingDirContext")) .setAttribute("reloadable", "true")); _serverXml.save(); } }
From source file:cz.muni.fi.pb138.scxml2voicexmlj.voicexml.XsltStateStackConverter.java
/** * Assemble the structure containing conditional logic for navigating backwards in the dialogue. * Ignore every transition pointing forward and for every transition pointing to an already visited state A * create a {code clear} element with fields from the most recent state up to A in appropriate if/elseif struct. * <p>//w w w .ja v a2s . c o m * E.g. if we are in C, have already visited A and B and C has two transitions, one pointing to D * (event d) and the other to B (event b), the result of this method will be following * <pre> <if expr="C=='b'"> * <clear namelist="B C" /> * </if></pre> * If there are no backward transitions, there will be no element to obtain from the result and * its {@code isAvailable()} method returns false */ public AssemblerResult<Element> assembleClearsForBackwardTransitions(Element state, List<String> visitedStates) { String stateName = helper.extractAttribute(state, "id"); List<Element> transitions = state.getChildren("transition", NS_SCXML); ConditionalTransitionsAssembler clearBuilder = new ConditionalTransitionsAssembler(); for (Element transition : transitions) { String target = helper.extractAttribute(transition, "target"); String event = helper.extractAttribute(transition, "event"); if (visitedStates.contains(target)) { int from = visitedStates.indexOf(target); int to = visitedStates.size(); List<String> fieldsToClear = visitedStates.subList(from, to); clearBuilder.appendCondition(stateName, event, fieldsToClear); } } return clearBuilder; }
From source file:DataWeb.Code.java
License:Open Source License
public Code(Element e, Namespace ns) { id = e.getAttributeValue("id"); idProfesor = e.getChildText("idProfesor", ns); nombre = e.getChildText("nombre", ns); lenguaje = e.getChildText("lenguaje", ns); resaltar = e.getChildText("resaltar", ns); linea = new ArrayList<String>(); comentario = new ArrayList<String>(); for (Element line : e.getChildren("linea", ns)) linea.add(line.getText());/*w ww . j a v a 2s . co m*/ for (Element line : e.getChildren("idComentario", ns)) comentario.add(line.getText()); }
From source file:DataWeb.Course.java
License:Open Source License
public Course(Element e, Namespace ns) { id = e.getAttributeValue("id"); idProfesor = e.getChildText("idProfesor", ns); nombre = e.getChildText("nombre", ns); idAlumno = new ArrayList<String>(); idCodigo = new ArrayList<String>(); for (Element alumno : e.getChildren("idAlumno", ns)) idAlumno.add(alumno.getText());/*from w w w . j a v a2 s .co m*/ for (Element codigo : e.getChildren("idCodigo", ns)) idCodigo.add(codigo.getText()); }
From source file:DataWeb.User.java
License:Open Source License
public User(Element e, Namespace ns) { id = e.getAttributeValue("id"); usuario = e.getChildText("usuario", ns); password = e.getChildText("password", ns); nombres = e.getChildText("nombres", ns); apPaterno = e.getChildText("apPat", ns); apMaterno = e.getChildText("apMat", ns); category = e.getChildText("category", ns); idCurso = new ArrayList<String>(); for (Element curso : e.getChildren("idCurso", ns)) idCurso.add(curso.getText());//w ww. j a va 2s. co m }
From source file:de.hbrs.oryx.yawl.converter.layout.YAWLLayoutArranger.java
License:Open Source License
public Element arrangeLayout(Element root) throws JDOMException, IOException { sb = new StringBuilder(); sb.append("<layout>"); sb.append("<specification id=\"Initial\">"); sb.append("<size w=\"1000\" h=\"1000\"/>"); List<Element> specifications = root.getChildren("specification", root.getNamespace()); for (Element specification : specifications) { List<Element> decompositions = specification.getChildren("decomposition", root.getNamespace()); for (Element yawlDecomposition : decompositions) { createNet(yawlDecomposition); }// w w w . ja v a2 s . c o m } sb.append("<labelFontSize>12</labelFontSize>"); sb.append("</specification>"); sb.append("</layout>"); String XMLLayoutContent = sb.toString(); SAXBuilder builder = new SAXBuilder(); Document document = builder.build(new StringReader(XMLLayoutContent)); return document.getRootElement(); }
From source file:de.hbrs.oryx.yawl.converter.layout.YAWLLayoutArranger.java
License:Open Source License
private List<String> searchFlows(Element element) { List<String> res = new LinkedList<String>(); String sourceId = element.getAttributeValue("id"), targetId; List<Element> flowsIntos = element.getChildren("flowsInto", element.getNamespace()); for (Element flowInto : flowsIntos) { List<Element> nextElementRefs = flowInto.getChildren("nextElementRef", element.getNamespace()); for (Element nextElementRef : nextElementRefs) { targetId = nextElementRef.getAttributeValue("id"); res.add("<flow source=\"" + sourceId + "\" target=\"" + targetId + "\">"); }/*from ww w.jav a 2 s. c o m*/ } return res; }
From source file:de.hbrs.oryx.yawl.converter.layout.YAWLLayoutConverter.java
License:Open Source License
/** * Parse and convert information about the layout of the YAWL nets. These information are stored separate from the decompositions in a YAWL * specification.//from www .j a va 2 s.c o m * * @throws JDOMException * @throws IOException */ public void convertLayout() throws JDOMException, IOException { Element spec = layout.getChild("specification", yawlNamespace); if (spec != null) { @SuppressWarnings("rawtypes") // JDOM uses Raw Lists, but we check with "instanceof" List nets = spec.getChildren("net", yawlNamespace); for (Object netObject : nets) { // YAWL Nets if (netObject instanceof Element) { Element yawlNet = (Element) netObject; NetLayout netLayout = convertNetLayout(yawlNet); // Vertexes are Conditions or Tasks of a YAWL Net without a // Label or Decorator for (Object vertexObject : yawlNet.getChildren("vertex", yawlNamespace)) { convertVertexLayout(netLayout, (Element) vertexObject); } // Containers may be Conditions or Tasks of a YAWL Net for (Object containterObject : yawlNet.getChildren("container", yawlNamespace)) { convertContainerLayout(netLayout, (Element) containterObject); } // Flows for a YAWL Net, should be read as last because it // uses the Join/Split decorator information of the task // containers for (Object flowObject : yawlNet.getChildren("flow", yawlNamespace)) { convertFlowLayout(netLayout, (Element) flowObject); } } } } }