List of usage examples for org.jdom2 Element getName
public String getName()
From source file:Model.ConsultarXML.java
/*** * Metodo para solicitar la informacion de una etiqueta en especfico * @param Documento documento que se inspecionar * @param Variable variabel dentro de la etiqueta que se buscar si se desea el texto entre la etiqueta se coloca Null * @param indice indice donde se encuentra la informacion * @param Ruta si se requiere se coloca la ruta para llegar a la informacin requerida sino se coloca null * @return/* w w w . ja va 2 s . co m*/ * @throws JDOMException */ public static String InformacionEtiqueta(String Documento, String Variable, int indice, String Ruta) throws JDOMException, IOException, Exception { //Se crea un SAXBuilder para poder parsear el archivo String Respuesta = ""; String[] rut; SAXBuilder builder = new SAXBuilder(); if (!Ruta.equals("")) rut = Ruta.split(Util.SEPARADOR_DIRECTORIO); else rut = new String[0]; org.jdom2.Element rootNode; File xmlFile = new File(Documento); //Se crea el documento a traves del archivo org.jdom2.Document document = (org.jdom2.Document) builder.build(xmlFile); //Se obtiene la raiz 'tables' rootNode = document.getRootElement(); for (int i = 0; i < rut.length; i++) rootNode = elementoNodo(rut[i], rootNode.getChildren()); //Se obtiene la lista de hijos de la raiz 'tables' List list = rootNode.getChildren(); //Se obtiene el elemento 'tabla' org.jdom2.Element tabla = (org.jdom2.Element) list.get(indice); if (!Variable.equals("")) { if (Variable.equals(Util.ETIQUETA_NOMBRE)) Respuesta = tabla.getName(); else Respuesta = tabla.getAttributeValue(Variable); } else Respuesta = tabla.getText(); return Respuesta; }
From source file:model.data.contrat.Clause.java
License:Open Source License
@Override protected boolean handleElement(Element e) { String val = e.getText(); switch (e.getName()) { case "title": this.title = val; return true; case "content": this.content = val; return true; default://ww w . j a v a 2 s. c om return false; } }
From source file:model.data.contrat.Contrat.java
License:Open Source License
private void loadSignatories(Element e) { Element root = StringToElement.getElementFromString(e.getValue(), e.getName()); for (Element s : root.getChildren("signatory")) { addSignatory(s.getText());// w w w .jav a 2 s. c o m } }
From source file:model.data.contrat.Contrat.java
License:Open Source License
private void loadItems(Element e) { Element root = StringToElement.getElementFromString(e.getValue(), e.getName()); for (Element i : root.getChildren()) { addItem(new Item(i)); }//from w w w .ja v a2 s . c o m }
From source file:model.data.contrat.Contrat.java
License:Open Source License
private void loadRules(Element e) { Element root = StringToElement.getElementFromString(e.getValue(), e.getName()); for (Element r : root.getChildren("rule")) { Element itemKeyElement = r.getChild("itemKey"); Element receiverElement = r.getChild("receiver"); if (itemKeyElement == null || receiverElement == null) continue; String itemKey = itemKeyElement.getText(); String receiver = receiverElement.getText(); if (!rules.containsKey(itemKey)) rules.put(itemKey, receiver); }/*from w w w. j a v a 2 s . c o m*/ }
From source file:model.data.contrat.Contrat.java
License:Open Source License
private void loadClauses(Element e) { Element root = StringToElement.getElementFromString(e.getValue(), e.getName()); for (Element i : root.getChildren()) { addClaus(new Clause(i)); }/*from ww w. j av a 2s . c om*/ }
From source file:model.data.contrat.Contrat.java
License:Open Source License
@Override protected boolean handleElement(Element e) { String val = e.getText(); switch (e.getName()) { case "title": setTitle(val); break;// w ww . j a v a 2 s . com case "state": setState(Integer.parseInt(val)); break; case "signatories": loadSignatories(e); break; case "items": loadItems(e); break; case "rules": loadRules(e); break; case "clauses": loadClauses(e); break; default: return false; } return true; }
From source file:model.data.favorites.Favorites.java
License:Open Source License
private void loadItemsKey(Element e) { Element root = StringToElement.getElementFromString(e.getValue(), e.getName()); if (itemsKey == null) itemsKey = new ArrayList<String>(); for (Element i : root.getChildren()) { String itemKey = new String(i.getValue()); itemsKey.add(itemKey);// www. j av a 2 s .c o m } }
From source file:model.data.favorites.Favorites.java
License:Open Source License
@Override protected boolean handleElement(Element e) { String val = e.getText(); switch (e.getName()) { case "itemsKey": this.loadItemsKey(e); break;/*from ww w. ja v a 2 s .com*/ case "crypted": this.loadCrypted(val); break; default: return false; } return true; }
From source file:model.data.favorites.KnownUsers.java
License:Open Source License
private boolean parseUsers(Element root) { for (Element e : root.getChildren()) { if (!e.getName().equals("user")) return false; String nick = e.getChild("nick").getValue(); String publicKey = e.getChild("publicKey").getValue(); users.put(nick, new AsymKeysImpl(publicKey)); }//from w w w. java 2 s . c om return true; }