本文整理了Java中org.jsoup.nodes.Document.children()
方法的一些代码示例,展示了Document.children()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Document.children()
方法的具体详情如下:
包路径:org.jsoup.nodes.Document
类名称:Document
方法名:children
暂无
代码示例来源:origin: stackoverflow.com
Document doc = ...//create HTML document
Elements htmlElements = doc.children();
htmlElements.traverse(new MyHtmlElementVisitor());
代码示例来源:origin: stackoverflow.com
Set<Document> alreadyExported = new HashSet<Document>();
for(Document parentDocument:Documents){
ExportToPdf(parentDocument);
for(Document childDocument:parentDocument.children()){
if(!aldreadyExported.contains(childDocument)){
ExportToPdf(childDocument);
alreadyExported.add(childDocument);
}
}
}
代码示例来源:origin: zhegexiaohuozi/JsoupXpath
public static JXDocument create(Document doc){
Elements els = doc.children();
return new JXDocument(els);
}
代码示例来源:origin: zhegexiaohuozi/JsoupXpath
public static JXDocument create(String html){
Elements els = Jsoup.parse(html).children();
return new JXDocument(els);
}
代码示例来源:origin: cn.wanghaomiao/JsoupXpath
public static JXDocument create(String html){
Elements els = Jsoup.parse(html).children();
return new JXDocument(els);
}
代码示例来源:origin: cn.wanghaomiao/JsoupXpath
public static JXDocument create(Document doc){
Elements els = doc.children();
return new JXDocument(els);
}
代码示例来源:origin: com.vaadin/flow-server
private static StringBuilder createHeaderInjectionCall(String content) {
StringBuilder inlineContent = new StringBuilder();
Document document = Jsoup.parse(content, "", Parser.xmlParser());
for (Element element : document.children()) {
String tagName = element.tagName();
inlineContent.append("_inlineHeader('");
inlineContent.append(tagName).append("',");
inlineContent.append(makeJsString(element.html()));
inlineContent.append(");\n");
}
return inlineContent;
}
代码示例来源:origin: br.com.anteros/Anteros-Bean-Validation
/**
* Returns a document whose {@code <body>} element contains the given HTML fragment.
*/
private Document getFragmentAsDocument(CharSequence value) {
// using the XML parser ensures that all elements in the input are retained, also if they actually are not allowed at the given
// location; E.g. a <td> element isn't allowed directly within the <body> element, so it would be used by the default HTML parser.
// we need to retain it though to apply the given white list properly; See HV-873
Document fragment = Jsoup.parse( value.toString(), "", Parser.xmlParser() );
Document document = Document.createShell( "" );
// add the fragment's nodes to the body of resulting document
Iterator<Element> nodes = fragment.children().iterator();
while ( nodes.hasNext() ) {
document.body().appendChild( nodes.next() );
}
return document;
}
代码示例来源:origin: org.apache.any23/apache-any23-core
String decl = "<" + new String(bytes, 2, length - 4) + ">";
org.jsoup.nodes.Document doc = org.jsoup.Jsoup.parse(decl, documentIRI, Parser.xmlParser());
for (org.jsoup.nodes.Element el : doc.children()) {
if ("xml".equalsIgnoreCase(el.tagName())) {
String enc = el.attr("encoding");
代码示例来源:origin: stackoverflow.com
path.clear();
all.clear();
parse(doc.children());
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.hibernate-validator
/**
* Returns a document whose {@code <body>} element contains the given HTML fragment.
*/
private Document getFragmentAsDocument(CharSequence value) {
// using the XML parser ensures that all elements in the input are retained, also if they actually are not allowed at the given
// location; E.g. a <td> element isn't allowed directly within the <body> element, so it would be used by the default HTML parser.
// we need to retain it though to apply the given white list properly; See HV-873
Document fragment = Jsoup.parse( value.toString(), "", Parser.xmlParser() );
Document document = Document.createShell( "" );
// add the fragment's nodes to the body of resulting document
Iterator<Element> nodes = fragment.children().iterator();
while ( nodes.hasNext() ) {
document.body().appendChild( nodes.next() );
}
return document;
}
}
代码示例来源:origin: org.hibernate.validator/hibernate-validator
/**
* Returns a document whose {@code <body>} element contains the given HTML fragment.
*/
private Document getFragmentAsDocument(CharSequence value) {
// using the XML parser ensures that all elements in the input are retained, also if they actually are not allowed at the given
// location; E.g. a <td> element isn't allowed directly within the <body> element, so it would be used by the default HTML parser.
// we need to retain it though to apply the given white list properly; See HV-873
Document fragment = Jsoup.parse( value.toString(), baseURI, Parser.xmlParser() );
Document document = Document.createShell( baseURI );
// add the fragment's nodes to the body of resulting document
Iterator<Element> nodes = fragment.children().iterator();
while ( nodes.hasNext() ) {
document.body().appendChild( nodes.next() );
}
return document;
}
}
代码示例来源:origin: zhegexiaohuozi/JsoupXpath
public static JXDocument createByUrl(String url){
Elements els;
try {
els = Jsoup.connect(url).get().children();
} catch (Exception e) {
throw new XpathParserException("url资源获取失败",e);
}
return new JXDocument(els);
}
代码示例来源:origin: org.apache.any23/apache-any23-core
private static Document convert(org.jsoup.nodes.Document document) {
Document w3cDoc = new org.apache.html.dom.HTMLDocumentImpl();
org.jsoup.nodes.Element rootEl = document.children().first();
if (rootEl != null) {
NodeTraversor.traverse(new DocumentConverter(w3cDoc), rootEl);
}
return w3cDoc;
}
代码示例来源:origin: cn.wanghaomiao/JsoupXpath
public static JXDocument createByUrl(String url){
Elements els;
try {
els = Jsoup.connect(url).get().children();
} catch (Exception e) {
throw new XpathParserException("url资源获取失败",e);
}
return new JXDocument(els);
}
代码示例来源:origin: stackoverflow.com
interface DocumentHandler {
void process(Document d);
}
class ExportToPdf implements DocumentHandler { ... }
class AppendToParentPdf implements DocumentHandler { ... }
// Now you're just passing the interface whose implementation does something with the document
void handleDocument(DocumentHandler parentHandler, DocumentHandler childHandler) {
for(Document parent : documents) {
parentHandler.process(parent);
for(Document child : parent.children()) {
childHandler.process(child);
}
}
}
DocumentHandler appendToParent = new AppendToParentPdf();
DocumentHandler exportToPdf = new ExportToPdf();
// pass the child/parent handlers as needed
handleDocument(exportToPdf, appendToParent);
handleDocument(exportToPdf, exportToPdf);
代码示例来源:origin: org.tinymediamanager.plugins/scraper-anidb
if (doc == null || doc.children().size() == 0) {
return episodes;
代码示例来源:origin: org.tinymediamanager.plugins/scraper-anidb
if (doc == null || doc.children().size() == 0) {
return md;
代码示例来源:origin: org.tinymediamanager.plugins/scraper-anidb
if (doc == null || doc.children().size() == 0) {
return md;
内容来源于网络,如有侵权,请联系作者删除!