List of usage examples for org.dom4j Element getText
String getText();
From source file:com.poka.util.XmlSax.java
public void getLastlastPaperSizeInfo() { Document doc = load(bankFile, false); Element rootElm = doc.getRootElement(); Element root1Elm = rootElm.element("paperSize"); if (root1Elm == null) { return;//from www . ja v a 2 s . co m } Element node = root1Elm.element("lastSize"); if (node == null) { return; } this.lastPaperSize = node.getText(); }
From source file:com.poka.util.XmlSax.java
public void getLastAddComInfo() { Document doc = load(bankFile, false); Element rootElm = doc.getRootElement(); Element root1Elm = rootElm.element("addcoms"); if (root1Elm == null) { return;// w w w. j av a2 s. co m } Element node = root1Elm.element("com"); if (node == null) { return; } this.lastAddCom = node.getText(); }
From source file:com.poka.util.XmlSax.java
public void getLastComInfo() { Document doc = load(bankFile, false); Element rootElm = doc.getRootElement(); Element root1Elm = rootElm.element("coms"); if (root1Elm == null) { return;/*from w ww.j a va 2 s.com*/ } Element node = root1Elm.element("com"); if (node == null) { return; } this.lastCom = node.getText(); }
From source file:com.poka.util.XmlSax.java
public void getLocalNOInfo() { Document doc = load(bankFile, false); Element rootElm = doc.getRootElement(); Element root1Elm = rootElm.element("localnos"); if (root1Elm == null) { return;/*from w w w .j av a 2 s .c o m*/ } Element node = root1Elm.element("NO"); if (node == null) { return; } this.locatNO = node.getText(); }
From source file:com.poka.util.XmlSax.java
public void getLastInfo() { Document doc = load(bankFile, false); Element rootElm = doc.getRootElement(); Element root1Elm = rootElm.element("loginers"); if (root1Elm == null) { return;//w w w.j a va 2s .c om } Element node = root1Elm.element("loginer"); if (node == null) { return; } this.lastLoginer = node.getText(); }
From source file:com.prj.utils.UfdmXmlUtil.java
/** * ??: ??XML//from ww w . j a va 2 s . c o m * @auther * @date 2014-11-28 * @param element * @param map * @return */ @SuppressWarnings({ "rawtypes", "unchecked" }) public static Map readXml(Element element, Map map) { try { if (map == null) { map = new HashMap(); } Iterator iter = element.elementIterator(); while (iter.hasNext()) { Element ele = (Element) iter.next(); map.put(ele.getName(), ele.getText().trim()); if (ele.elements().size() != 0) { readXml(ele, map); } } return map; } catch (Exception er) { er.printStackTrace(); return null; } }
From source file:com.processpuzzle.internalization.domain.LocaleLoader.java
License:Open Source License
private void loadQuantityFormatElements(Element root, ProcessPuzzleLocale locale) { if (root == null) return;/*from ww w . j ava 2s. c o m*/ Attribute decimalSeparatorAttribute = root.attribute("decimalSeparator"); if (decimalSeparatorAttribute != null) locale.getQuantityFormat().setDecimalSeparator(decimalSeparatorAttribute.getText().charAt(0)); Attribute groupingSeparatorAttribute = root.attribute("groupingSeparator"); if (groupingSeparatorAttribute != null) locale.getQuantityFormat().setGroupingSeparator(groupingSeparatorAttribute.getText().charAt(0)); if (groupingSeparatorAttribute != null && decimalSeparatorAttribute != null) { if (groupingSeparatorAttribute.getText().charAt(0) == decimalSeparatorAttribute.getText().charAt(0)) { throw new ProcessPuzzleParseException( Character.toString(groupingSeparatorAttribute.getText().charAt(0)) + Character.toString(decimalSeparatorAttribute.getText().charAt(0)), "Same Separators!", null); } } try { Element maxIntElement = root.element("maxIntDigits"); if (maxIntElement != null) locale.getQuantityFormat().setMaximumIntegerDigits(Integer.parseInt(maxIntElement.getText())); Element minIntElement = root.element("minIntDigits"); if (minIntElement != null) locale.getQuantityFormat().setMinimumIntegerDigits(Integer.parseInt(minIntElement.getText())); Element maxFractElement = root.element("maxFractDigits"); if (maxFractElement != null) locale.getQuantityFormat().setMaximumFractionDigits(Integer.parseInt(maxFractElement.getText())); Element minFractElement = root.element("minFractDigits"); if (minFractElement != null) locale.getQuantityFormat().setMinimumFractionDigits(Integer.parseInt(minFractElement.getText())); } catch (NumberFormatException e) { throw new XmlDataLoaderException(this, "Non-Integer values!", e); } }
From source file:com.processpuzzle.internalization.domain.LocaleLoader.java
License:Open Source License
private void loadDateFormatElements(Element root, ProcessPuzzleLocale locale) { if (root == null) return;// w ww .j ava 2 s.c o m Element dateElement = root.element("dateFormat"); Element timeElement = root.element("timeFormat"); if ((dateElement == null) || (timeElement == null)) return; Element mediumDateElement = dateElement.element("mediumPattern"); Element mediumTimeElement = timeElement.element("mediumPattern"); if (mediumDateElement == null || mediumTimeElement == null) return; locale.getDateFormat().setDatePattern(mediumDateElement.getText()); locale.getDateFormat().setTimePattern(mediumTimeElement.getText()); Element fullDateElement = dateElement.element("fullPattern"); Element longDateElement = dateElement.element("longPattern"); Element shortDateElement = dateElement.element("shortPattern"); if (fullDateElement != null) { locale.getDateFormat().setDatePattern(fullDateElement.getText(), DateFormat.FULL); } if (longDateElement != null) { locale.getDateFormat().setDatePattern(longDateElement.getText(), DateFormat.LONG); } if (shortDateElement != null) { locale.getDateFormat().setDatePattern(shortDateElement.getText(), DateFormat.SHORT); } Element fullTimeElement = timeElement.element("fullPattern"); Element longTimeElement = timeElement.element("longPattern"); Element shortTimeElement = timeElement.element("shortPattern"); if (fullTimeElement != null) { locale.getDateFormat().setTimePattern(fullTimeElement.getText(), DateFormat.FULL); } if (longTimeElement != null) { locale.getDateFormat().setTimePattern(longTimeElement.getText(), DateFormat.LONG); } if (shortTimeElement != null) { locale.getDateFormat().setTimePattern(shortTimeElement.getText(), DateFormat.SHORT); } }
From source file:com.processpuzzle.party.artifact.CompanyDataLoader.java
License:Open Source License
public @Override @SuppressWarnings("unchecked") void loadData() { super.loadData(); companyDataSheetFactory = applicationContext.getEntityFactory(CompanyDataSheetFactory.class); addressFactory = applicationContext.getEntityFactory(AddressFactory.class); countryFactory = applicationContext.getEntityFactory(CountryFactory.class); settlementFactory = applicationContext.getEntityFactory(SettlementFactory.class); zipCodeFactory = applicationContext.getEntityFactory(ZipCodeFactory.class); artifactRepository = applicationContext.getRepository(CompanyDataSheetRepository.class); Document doc = getDocument(); Element root = doc.getRootElement(); for (Iterator<Element> i = root.elementIterator(ROOT_ELEMENT); i.hasNext();) { DefaultUnitOfWork work = new DefaultUnitOfWork(true); Element companyElement = (Element) i.next(); Element shortNameElement = companyElement.element(SHORT_NAME_ELEMENT); String shortName = shortNameElement.getText(); try {/*from w w w . j av a 2 s . com*/ Element longNameElement = companyElement.element(LONG_NAME_ELEMENT); String longName = longNameElement.getText(); CompanyDataSheet companyDataSheet = companyDataSheetFactory.create(longName); int idx = 1; try { while (true) { // create geographic address createGeographicAddress(work, companyElement, companyDataSheet, idx); // create phone address createPhoneAddress(companyElement, companyDataSheet, idx); // create email address createEmailAddress(companyElement, companyDataSheet, idx); idx++; } //while } catch (NullPointerException e) { // nothing serious just while(true) loop ends } //create webAddress createWebAddress(companyElement, companyDataSheet); if (companyDataSheet != null) { saveCompanyDataSheet(work, companyDataSheet); logSuccess(companyDataSheet.getCompany()); savedCompanies.add(companyDataSheet); } } catch (Exception e) { logError(e, shortName); } finally { work.finish(); } } //end for }
From source file:com.processpuzzle.party.artifact.CompanyDataLoader.java
License:Open Source License
private void createWebAddress(Element element, CompanyDataSheet companyDataSheet) { Element webAddressElement = element.element(WEB_ADDRESS_ELEMENT); if (webAddressElement != null) { String webAddressStr = webAddressElement.getText(); String webPageAddress = !"".equals(webAddressStr) ? webAddressStr : null; if (webPageAddress != null) { WebPageAddress webAddr = addressFactory.createWebPageAddress(webPageAddress); if (webAddr != null) { companyDataSheet.addAddress(webAddr); }/* w ww . jav a 2 s.co m*/ } } }