var mid_parser = new Parser(); Parser.apply(mid_parser, mid_patterns);
private Route directions(final GeoPoint start, final GeoPoint dest) { Parser parser; //https://developers.google.com/maps/documentation/directions/#JSON <- get api String jsonURL = "http://maps.googleapis.com/maps/api/directions/json?"; final StringBuffer sBuf = new StringBuffer(jsonURL); sBuf.append("origin="); sBuf.append(start.getLatitudeE6()/1E6); sBuf.append(','); sBuf.append(start.getLongitudeE6()/1E6); sBuf.append("&destination="); sBuf.append(dest.getLatitudeE6()/1E6); sBuf.append(','); sBuf.append(dest.getLongitudeE6()/1E6); sBuf.append("&sensor=true&mode=driving"); parser = new GoogleParser(sBuf.toString()); Route r = parser.parse(); return r; }
/** * Returns an instance of the targetNamespace if it can be found ... null otherwise. * targetNamespaces which can be found are either hard-coded namespaces * (SchemaFactory.properties), have already been parsed or were registered. * * @param targetNamespace * @see #registerSchema(Strin,Schema) */ public static synchronized Schema getInstance(URI targetNamespace) { return getInstance().getRealInstance(targetNamespace); }
/** * calls getInstance(URI,Level) with Level.WARNING * * @param desiredDocument * @param hints May be null. * @return Object * @throws SAXException * @see DocumentFactory#getInstance(URI, Map, Level) */ public static Object getInstance(URI desiredDocument, Map<String, Object> hints) throws SAXException { return getInstance(desiredDocument, hints, Level.WARNING); }
/** * Registers a Schema instance with the factory. A clone is NOT created within this method. The * Schema passed in is associated with the specified targetNamespace. The Schema is not tested * to ensure the intended targetNamespace (schema.getTargetNamespace()) is equal to * targetNamespace. The ramifications is that you may hack wildly within the repository, but we * aware you may have some 'undocumented features' as a result (odd Schemas being returned). * * @param targetNamespace * @param schema */ public static void registerSchema(URI targetNamespace, Schema schema) { getInstance().registerRealSchema(targetNamespace, schema); }
protected void init(Map<String, Object> hints) { if (hints == null) { hints = new HashMap<String, Object>(); } this.hints = hints; setEntityResolver(XMLHandlerHints.toEntityResolver(hints)); } /**
private XSISAXHandler parseSchema(InputStream is1, Level level) throws SAXException { setParser(); XSISAXHandler contentHandler = getSAXHandler(null); XSISAXHandler.setLogLevel(level); try { parser.parse(is1, contentHandler); } catch (IOException e) { throw new SAXException(e); } return contentHandler; }
/** * Returns an instance of the desired class. There is no provision for: a) same instances each * call b) different instances each call c) this factory being thread safe * * @param targetNamespace * @param desiredSchema URI the uri of which you want a schema instance. * @return Schema an instance of the desired schema. * @throws SAXException */ public static Schema getInstance(URI targetNamespace, URI desiredSchema) throws SAXException { return getInstance(targetNamespace, desiredSchema, Level.WARNING); }
public Object convert(Object source, Class target) throws Exception { if (String.class.equals(target)) { return convertToString(source); } return convertFromString((String) source, target); }
/** Default constructor. */ protected SchemaFactory() { super(); initResolver(); }
/** @see org.geotools.xml.XMLElementHandler#getValue() */ public Object getValue() throws SAXException { return (xeh == null) ? null : xeh.getValue(); }
protected XSISAXHandler getSAXHandler(URI uri) { return new XSISAXHandler(uri); }
private Schema merge(Schema s1, Schema s2) throws SAXException { return new MergedSchema(s1, s2); }
/** * Used to set the logger level for all XMLSAXHandlers * * @param l */ public static void setLogLevel(Level l) { level = l; logger.setLevel(l); XMLElementHandler.setLogLevel(l); }
/** * Sets the logging level for all the XSISAXHandlers. * * @param l */ public static void setLogLevel(Level l) { logger.setLevel(l); XSIElementHandler.setLogLevel(l); }
List<ParseResult> results = parser.parse(fileExtension, sourceCode); for(ParseResult result : results){ String type = result.getStyleKeys().get(0);
import com.joestelmach.natty.*; List<Date> dates =new Parser().parse("Start date 11/30/2013 , end date Friday, Sept. 7, 2013").get(0).getDates(); System.out.println(dates.get(0)); System.out.println(dates.get(1)); //output: //Sat Nov 30 11:14:30 BDT 2013 //Sat Sep 07 11:14:30 BDT 2013
public static synchronized Schema getInstance(URI targetNamespace, InputStream is1, Level level) throws SAXException { return getInstance().getRealInstance(targetNamespace, is1, level); }
public static Schema getInstance(URI targetNamespace, InputStream is1) throws SAXException { return getInstance(targetNamespace, is1, Level.WARNING); }
/** * Returns an instance of the desired class. There is no provision for: a) same instances each * call b) different instances each call c) this factory being thread safe * * @param targetNamespace The targetNamespace to search for. * @param desiredSchema URI the uri of which you want a schema instance. * @param level Level * @return Schema an instance of the desired schema. * @throws SAXException When something goes wrong */ public static synchronized Schema getInstance( URI targetNamespace, URI desiredSchema, Level level) throws SAXException { return getInstance().getRealInstance(targetNamespace, desiredSchema, level); }