List of usage examples for org.apache.commons.digester Digester parse
public Object parse(URL url) throws IOException, SAXException
From source file:edu.uci.ics.hyracks.yarn.am.manifest.ManifestParser.java
public static HyracksCluster parse(String mXML) throws Exception { Digester d = createDigester(); return (HyracksCluster) d.parse(new StringReader(mXML)); }
From source file:com.redhat.rhn.common.client.ClientCertificateDigester.java
/** * Creates a ClientCertificate from the given inputstream. * @param is to client certificate/*from w w w. j a v a 2s. c o m*/ * @return a ClientCertificate * @throws IOException thrown if there is a problem reading the certificate. * @throws SAXException thrown if there is a problem reading the certificate. */ public static ClientCertificate buildCertificate(InputStream is) throws IOException, SAXException { Digester digester = new Digester(); configureDigester(digester); return (ClientCertificate) digester.parse(is); }
From source file:com.redhat.rhn.common.client.ClientCertificateDigester.java
/** * @param rdr to client certificate//from w w w .java2 s.c o m * @return a ClientCertificate * @throws IOException thrown if there is a problem reading the certificate. * @throws SAXException thrown if there is a problem reading the certificate. */ public static ClientCertificate buildCertificate(Reader rdr) throws IOException, SAXException { Digester digester = new Digester(); configureDigester(digester); return (ClientCertificate) digester.parse(rdr); }
From source file:net.erdfelt.android.sdkfido.sdks.SourceOriginsLoader.java
public static SourceOrigins load(URL url) throws IOException { try {//from w w w . j a v a2 s . c o m ConvertUtils.register(new VersionConverter(), Version.class); DigesterLoader loader = DigesterLoaderBuilder.byDefaultFactories(); Digester digester = loader.createDigester(SourceOrigins.class); SourceOrigins origins = (SourceOrigins) digester.parse(url); origins.normalize(); return origins; } catch (SAXException e) { LOG.log(Level.WARNING, "Unable to load/parse url: " + url, e); throw new IOException("Unable to load/parse url: " + url, e); } }
From source file:com.tonbeller.wcf.format.FormatterFactory.java
private static void fillFormatter(Formatter formatter, Locale locale, URL configXml) { if (locale == null) locale = Locale.getDefault(); URL rulesXml = Formatter.class.getResource("rules.xml"); Digester digester = DigesterLoader.createDigester(rulesXml); digester.setValidating(false);/*from w w w .ja v a 2s . co m*/ digester.push(formatter); try { digester.parse(new InputSource(configXml.toExternalForm())); } catch (IOException e) { logger.error("exception caught", e); throw new SoftException(e); } catch (SAXException e) { logger.error("exception caught", e); throw new SoftException(e); } formatter.setLocale(locale); }
From source file:com.tonbeller.wcf.utils.ObjectFactory.java
public static Object instance(URL rulesXml, URL configXml) throws SAXException, IOException { Digester digester = DigesterLoader.createDigester(rulesXml); digester.setValidating(false);/*www . ja va 2s. co m*/ ObjectHolder root = new ObjectHolder(); digester.push(root); digester.parse(configXml.openStream()); return root.getObject(); }
From source file:com.mmounirou.spotirss.spotify.tracks.SpotifyHrefQuery.java
private static List<XTracks> parseResult(String strResult) throws IOException, SAXException { Digester digester = new Digester(); List<XTracks> result = Lists.newArrayList(); digester.push(result);//w w w . j a v a 2s . c o m addRules(digester); digester.parse(IOUtils.toInputStream(strResult, Charsets.UTF_8)); return result; }
From source file:it.jnrpe.server.CJNRPEServer.java
private static CommandLine parseCommandLine(String[] vsArgs) { Digester d = DigesterLoader.createDigester(new InputSource( CJNRPEServer.class.getResourceAsStream("/it/jnrpe/server/command-line-digester.xml"))); try {/*from w w w .jav a 2 s.c o m*/ COptions opts = (COptions) d .parse(CJNRPEServer.class.getResourceAsStream("/it/jnrpe/server/jnrpe-command-line.xml")); m_Options = opts.toOptions(); CommandLineParser clp = new PosixParser(); return clp.parse(m_Options, vsArgs); } catch (IOException e) { // Should never happen... } catch (SAXException e) { // Should never happen... } catch (ParseException e) { printUsage(); } return null; }
From source file:com.projity.configuration.ConfigurationReader.java
public static ProvidesDigesterEvents readStream(InputStream stream, ProvidesDigesterEvents root) { ProvidesDigesterEvents result = null; Digester digester = new Digester(); digester.setNamespaceAware(true); // this is so we can use the JADE parser instead which is faster digester.setValidating(false);/*from w w w. j av a 2s.co m*/ digester.push(root); root.addDigesterEvents(digester); try { result = (ProvidesDigesterEvents) digester.parse(stream); } catch (Exception e1) { //claur log.error("Error parsing reading/parsing field xml configuration file."); // TODO Auto-generated catch block e1.printStackTrace(); } return result; }
From source file:net.erdfelt.android.sdkfido.git.GitMirrors.java
/** * Load specific gitmirror xml file.//www .j av a 2 s . co m * * @param mirrorxml * the mirrorxml to load * @return a GitMirrors object, with information from the mirrorxml, or empty (if mirrorxml not found) */ public static GitMirrors load(File mirrorxml) { if (!mirrorxml.exists()) { return new GitMirrors(); } Digester digester = new Digester(); digester.addObjectCreate("mirrors", GitMirrors.class); digester.addCallMethod("mirrors/mirror", "addMirror", 2); digester.addCallParam("mirrors/mirror", 0, "url"); digester.addCallParam("mirrors/mirror", 1, "mirrorurl"); try { return (GitMirrors) digester.parse(mirrorxml); } catch (IOException e) { LOG.log(Level.WARNING, "Unable to load GitMirrors: " + mirrorxml, e); } catch (SAXException e) { LOG.log(Level.WARNING, "Unable to load GitMirrors: " + mirrorxml, e); } return new GitMirrors(); }