Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: src/com/dom_distiller/client/MarkupParser.java

Issue 240073007: recognize and parse Schema.org Markup (Closed) Base URL: https://code.google.com/p/dom-distiller/@master
Patch Set: rm 1 more unused prop in image Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package com.dom_distiller.client; 5 package com.dom_distiller.client;
6 6
7 import java.util.ArrayList; 7 import java.util.ArrayList;
8 import java.util.List; 8 import java.util.List;
9 9
10 import com.google.gwt.dom.client.Element; 10 import com.google.gwt.dom.client.Element;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 135
136 /** 136 /**
137 * The object that loads the different parsers, and retrieves requested info rmation from one or 137 * The object that loads the different parsers, and retrieves requested info rmation from one or
138 * more of the parsers. 138 * more of the parsers.
139 */ 139 */
140 public MarkupParser(Element root) { 140 public MarkupParser(Element root) {
141 mParsers = new ArrayList<Parser>(); 141 mParsers = new ArrayList<Parser>();
142 142
143 Parser ogp = OpenGraphProtocolParser.parse(root); 143 Parser ogp = OpenGraphProtocolParser.parse(root);
144 if (ogp != null) mParsers.add(ogp); 144 if (ogp != null) mParsers.add(ogp);
145 Parser ie = new IEReadingViewParser(root); 145 mParsers.add(new SchemaOrgParserAccessor(root));
146 if (ie != null) mParsers.add(ie); 146 mParsers.add(new IEReadingViewParser(root));
147 } 147 }
148 148
149 public String getTitle() { 149 public String getTitle() {
150 String title = null; 150 String title = null;
151 for (int i = 0; i < mParsers.size(); i++) { 151 for (int i = 0; i < mParsers.size(); i++) {
152 title = mParsers.get(i).getTitle(); 152 title = mParsers.get(i).getTitle();
153 if (title != null && !title.isEmpty()) break; 153 if (title != null && !title.isEmpty()) break;
154 } 154 }
155 return title; 155 return title;
156 } 156 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 220
221 public Article getArticle() { 221 public Article getArticle() {
222 Article article = null; 222 Article article = null;
223 for (int i = 0; i < mParsers.size(); i++) { 223 for (int i = 0; i < mParsers.size(); i++) {
224 article = mParsers.get(i).getArticle(); 224 article = mParsers.get(i).getArticle();
225 if (article != null) break; 225 if (article != null) break;
226 } 226 }
227 return article; 227 return article;
228 } 228 }
229 } 229 }
OLDNEW
« no previous file with comments | « no previous file | src/com/dom_distiller/client/SchemaOrgParser.java » ('j') | src/com/dom_distiller/client/SchemaOrgParser.java » ('J')

Powered by Google App Engine
This is Rietveld 408576698