本文整理汇总了Java中org.apache.abdera.parser.Parser.parse方法的典型用法代码示例。如果您正苦于以下问题:Java Parser.parse方法的具体用法?Java Parser.parse怎么用?Java Parser.parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.abdera.parser.Parser
的用法示例。
在下文中一共展示了Parser.parse方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseInputStream
import org.apache.abdera.parser.Parser; //导入方法依赖的package包/类
private static Document<Feed> parseInputStream(InputStream in) throws ParseException {
Parser parser = getAtomParser();
// set the thread context loader with the ParserClassLoader
ClassLoader old = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(parser.getClass().getClassLoader());
return parser.parse(in);
} finally {
Thread.currentThread().setContextClassLoader(old);
}
}
示例2: getElement
import org.apache.abdera.parser.Parser; //导入方法依赖的package包/类
private <T extends Element> T getElement(String url) throws IOException {
String username = "admin";
String password = "changeit";
URLConnection uc = new URL(url).openConnection();
String userpass = username + ":" + password;
String basicAuth = "Basic " + new String(Base64.getEncoder().encode(userpass.getBytes()));
uc.setRequestProperty("Authorization", basicAuth);
uc.setRequestProperty("Accept", "application/atom+xml");
Abdera abdera = new Abdera();
Parser parser = abdera.getParser();
Document<T> doc = parser.parse(uc.getInputStream(), url);
return doc.getRoot();
}
示例3: getElement
import org.apache.abdera.parser.Parser; //导入方法依赖的package包/类
private <T extends Element> T getElement(String url) throws IOException {
String username = "admin";
String password = "changeit";
URLConnection uc = new URL(url).openConnection();
String userpass = username + ":" + password;
String basicAuth = "Basic " + new String(Base64.getEncoder().encode(userpass.getBytes()));
uc.setRequestProperty("Authorization", basicAuth);
uc.setRequestProperty("Accept", "application/atom+xml");
Abdera abdera = new Abdera();
Parser parser = abdera.getParser();
Document<T> doc = parser.parse(uc.getInputStream(), url);
return doc.getRoot();
}
示例4: CodePackageFeed
import org.apache.abdera.parser.Parser; //导入方法依赖的package包/类
/**
* Construct a {@link CodePackageFeed} from an atom XML stream
*
* @param atomStream {@link InputStream}
*/
public CodePackageFeed(InputStream atomStream) {
LOGGER.debug("Loading Feed from " + atomStream);
Parser parser = Abdera.getInstance().getParser();
Document<Feed> doc = parser.parse(atomStream);
feed = doc.getRoot();
LOGGER.info("New Feed: " + feed.getTitle());
}
示例5: getMessagesAtom
import org.apache.abdera.parser.Parser; //导入方法依赖的package包/类
private List<FeedMessageContainer> getMessagesAtom() {
List<FeedMessageContainer> messages = new ArrayList<>();
Parser parser = abdera.getParser();
Document<Feed> doc = null;
try {
doc = parser.parse(url.openStream(),url.toString());
} catch (IOException exception) {
exception.printStackTrace();
}
Feed feed = doc.getRoot();
for (Entry entry : feed.getEntries()) {
messages.add(new FeedMessageContainer(entry));
}
return messages;
}
示例6: from
import org.apache.abdera.parser.Parser; //导入方法依赖的package包/类
public static String from(Reader reader, ProgressDialogJFrame progressDialogJFrame) {
try {
Abdera abdera = new Abdera();
Parser parser = abdera.getParser();
Document<Feed> doc = parser.parse(reader);
Feed feed = doc.getRoot();
HashMap<String, Entry> entryByUri=new HashMap<String, Entry>();
logger.debug(feed.getTitle());
for (Entry entry : feed.getEntries()) {
logger.debug("\t"+entry.getTitle());
entryByUri.put(entry.getId().toString(), entry);
}
String outlineUri = null;
String outlineLabel;
String labelUri = MindRaider.labelCustodian.LABEL_TWIKI_IMPORT_URI;
MindRaider.labelCustodian.create("Atom Import", MindRaider.labelCustodian.LABEL_ATOM_IMPORT_URI);
outlineLabel = feed.getTitle()+" ("+Utils.getCurrentDataTimeAsPrettyString()+")";
logger.debug("Outline label: '"+outlineLabel+"'");
outlineUri = MindRaiderVocabulary.getNotebookUri(Utils.toNcName(outlineLabel));
String createdUri;
while (MindRaiderConstants.EXISTS.equals(createdUri = MindRaider.outlineCustodian.create(
outlineLabel,
outlineUri,
feed.getSubtitle(),
false))) {
outlineUri += "_";
}
outlineUri = createdUri;
MindRaider.labelCustodian.addOutline(labelUri, outlineUri);
OutlineResource activeOutlineResource = MindRaider.outlineCustodian.getActiveOutlineResource();
// fill in notebook resource
activeOutlineResource.save();
logger.debug("Outline created: " + outlineUri);
String parentNoteUri=activeOutlineResource.getUri();
List<Link> childrenLinks = feed.getLinks(Atomizer.ATOM_REL_CHILD_NOTE);
fromOneLevel(progressDialogJFrame, entryByUri, outlineUri, parentNoteUri, childrenLinks, activeOutlineResource);
return outlineUri;
} catch(Exception e) {
logger.debug("Unable to import Outline from Atom",e);
return null;
} finally {
// now refresh notebook outline
ExplorerJPanel.getInstance().refresh();
OutlineJPanel.getInstance().refresh();
MindRaider.spidersGraph.renderModel();
}
}
示例7: getVistaDataChunks
import org.apache.abdera.parser.Parser; //导入方法依赖的package包/类
/**
* Gets the vista data chunks.
*
* @param in the in
* @param patientIds the patient ids
* @return the vista data chunks
*/
public static List<VistaDataChunk> getVistaDataChunks(InputStream in, PatientIds patientIds) {
Abdera abdera = new Abdera();
Parser parser = abdera.getParser();
org.apache.abdera.model.Document<Feed> doc = parser.parse(in);
return getVistaDataChunks(doc, patientIds);
}