How to extract some specific elements? #121
-
I have my XML like this <link type="text/html" title="View on Feedbooks" rel="alternate" href="https://www.feedbooks.com/book/2936"/>
<link type="application/epub+zip" rel="http://opds-spec.org/acquisition" href="https://www.feedbooks.com/book/2936.epub"/>
<link type="image/jpeg" rel="http://opds-spec.org/image" href="https://covers.feedbooks.net/book/2936.jpg?size=large&t=1549045871"/>
<link type="image/jpeg" rel="http://opds-spec.org/image/thumbnail" href="https://covers.feedbooks.net/book/2936.jpg?size=large&t=1549045871"/> Here I have multiple Can somebody help here ? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
This is not a valid XML document, but you can parse it as a fragment (i.e. |
Beta Was this translation helpful? Give feedback.
-
This is the whole XML <?xml version="1.0" encoding="UTF-8"?>
<entry xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:schema="http://schema.org/" xmlns="http://www.w3.org/2005/Atom">
<title>Romeo and Juliet</title>
<id>https://www.feedbooks.com/book/2936</id>
<author>
<name>William Shakespeare</name>
<uri>https://www.feedbooks.com/author/494</uri>
<schema:birthDate>1564</schema:birthDate>
<schema:deathDate>1616</schema:deathDate>
</author>
<published>2008-09-18T07:59:29Z</published>
<updated>2020-08-27T07:58:31Z</updated>
<dcterms:language>en</dcterms:language>
<dcterms:issued>1597</dcterms:issued>
<dcterms:publisher>Feedbooks</dcterms:publisher>
<category scheme="http://www.feedbooks.com/categories" label="Fiction" term="FBFIC000000"/>
<category scheme="http://www.feedbooks.com/categories" label="Drama" term="FBDRA000000"/>
<category scheme="http://www.feedbooks.com/categories" label="Romance" term="FBFIC027000"/>
<summary>Romeo and Juliet is a tragic play written early in the career of William Shakespeare about two teenage "star-cross'd lovers" whose untimely deaths ultimately unite their feuding households. It was among Shakespeare's most popular plays during his lifetime and, along with Hamlet, is one of his most frequently performed plays. Today, the title characters are regarded as archetypal "young lovers". (From Wikipedia)</summary>
<dcterms:extent>25,496 words</dcterms:extent>
<dcterms:source>http://shakespeare.mit.edu</dcterms:source>
<link type="text/html" title="View on Feedbooks" rel="alternate" href="https://www.feedbooks.com/book/2936"/>
<link type="application/epub+zip" rel="http://opds-spec.org/acquisition" href="https://www.feedbooks.com/book/2936.epub"/>
<link type="image/jpeg" rel="http://opds-spec.org/image" href="https://covers.feedbooks.net/book/2936.jpg?size=large&t=1549045871"/>
<link type="image/jpeg" rel="http://opds-spec.org/image/thumbnail" href="https://covers.feedbooks.net/book/2936.jpg?size=large&t=1549045871"/>
<link type="application/atom+xml;profile=opds-catalog;kind=acquisition" title="From the same author" rel="http://www.feedbooks.com/opds/same_author" href="https://www.feedbooks.com/author/494/books/top.atom?lang=en"/>
<link type="application/atom+xml;profile=opds-catalog;kind=navigation" title="Categories for this book" rel="related" href="https://www.feedbooks.com/book/2936/categories.atom"/>
<link type="application/atom+xml;profile=opds-catalog;kind=navigation" title="Reading lists for this book" rel="related" href="https://www.feedbooks.com/book/2936/lists.atom"/>
<content type="html"><p>Romeo and Juliet is a tragic play written early in the career of William Shakespeare about two teenage "star-cross'd lovers" whose untimely deaths ultimately unite their feuding households. It was among Shakespeare's most popular plays during his lifetime and, along with Hamlet, is one of his most frequently performed plays. Today, the title characters are regarded as archetypal "young lovers". (From Wikipedia)</p></content>
<link type="application/atom+xml;type=entry;profile=opds-catalog" rel="self" href="https://www.feedbooks.com/book/2936.atom"/>
<link type="application/atom+xml" rel="contents" href="http://www.feedbooks.com/book/2936/contents.atom"/>
</entry> |
Beta Was this translation helpful? Give feedback.
-
Your example helped me, thank you very much :D |
Beta Was this translation helpful? Give feedback.
This is not a valid XML document, but you can parse it as a fragment (i.e.
XmlDocumentFragment.parse(input)
) and use the traversal/querying methods as described in the tutorial.