Package com.google.api.client.xml

Examples of com.google.api.client.xml.XmlObjectParser


  public HttpManager() {
    requestFactory = APACHE_HTTP_TRANSPORT.createRequestFactory(new HttpRequestInitializer() {
      @Override
      public void initialize(HttpRequest hr) throws IOException {
        hr.setParser(new XmlObjectParser(DefaultConfigs.DOUBAN_XML_NAMESPACE));
        HttpHeaders header = new HttpHeaders();
        header.setUserAgent("Dongxuexidu - Douban Java SDK");
        hr.setHeaders(header);
        hr.setNumberOfRetries(3);
      }
View Full Code Here


 
  public static void testAtomParse () {
    FileInputStream fis = null;
    try {
      XmlNamespaceDictionary nameSpace = new XmlNamespaceDictionary().set("", "http://www.w3.org/2005/Atom").set("db", "http://www.douban.com/xmlns/").set("gd", "http://schemas.google.com/g/2005").set("openSearch", "http://a9.com/-/spec/opensearchrss/1.0/").set("opensearch", "http://a9.com/-/spec/opensearchrss/1.0/");
      XmlObjectParser parser = new XmlObjectParser(nameSpace);
      //JsonObjectParser parser = new JsonObjectParser(new JacksonFactory());
      fis = new FileInputStream("/home/zwei/doubantestxml");
      DoubanPeopleEntry result = parser.parseAndClose(fis, Charset.forName("utf-8"), DoubanPeopleEntry.class);
      System.out.println("result : " + result);
    } catch (FileNotFoundException ex) {
      Logger.getLogger(PlayGround.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
      Logger.getLogger(PlayGround.class.getName()).log(Level.SEVERE, null, ex);
View Full Code Here

TOP

Related Classes of com.google.api.client.xml.XmlObjectParser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.