<Chapter ChapterID="1" ChapterName="The Opening">
<Verse VerseID="1"><![CDATA[text1 ]]></Verse>
<Verse VerseID="2"><![CDATA[text2 ]]></Verse>
<Verse VerseID="3"><![CDATA[text3 ]]></Verse>
<Verse VerseID="4"><![CDATA[text4 ]]></Verse>
<Verse VerseID="5"><![CDATA[text5 ]]></Verse>
<Verse VerseID="6"><![CDATA[text6 ]]></Verse>
<Verse VerseID="7"><![CDATA[text7 ]]></Verse>
</Chapter>
<Chapter ChapterID="2" ChapterName="The main">
<Verse VerseID="1"><![CDATA[text1 ]]></Verse>
<Verse VerseID="2"><![CDATA[text2 ]]></Verse>
<Verse VerseID="3"><![CDATA[text3 ]]></Verse>
<Verse VerseID="4"><![CDATA[text4 ]]></Verse>
<Verse VerseID="5"><![CDATA[text5 ]]></Verse>
<Verse VerseID="6"><![CDATA[text6 ]]></Verse>
<Verse VerseID="7"><![CDATA[text7 ]]></Verse>
</Chapter>
<Chapter ChapterID="3" ChapterName="The ending">
<Verse VerseID="1"><![CDATA[text1 ]]></Verse>
<Verse VerseID="2"><![CDATA[text2 ]]></Verse>
<Verse VerseID="3"><![CDATA[text3 ]]></Verse>
<Verse VerseID="4"><![CDATA[text4 ]]></Verse>
<Verse VerseID="5"><![CDATA[text5 ]]></Verse>
<Verse VerseID="6"><![CDATA[text6 ]]></Verse>
<Verse VerseID="7"><![CDATA[text7 ]]></Verse>
</Chapter>
so that was the XML file > As you can see, each Chapter contains words and an id for it
what i want to do it to get all the text from a chapter by its id in java
for example some thing like:
get Chapter.ChapterID = (int)
and then get all the text from that Chapter with that id
I know I am bad at asking the question or idea I want but... I hope the idea arrived
I would suggest that you take a look at different XML Parsing Libaries. There exists a lot of different, helpful tutorials (for example https://examples.javacodegeeks.com/java-xml-parser-tutorial ).
If you don't understand some of the explanation or if you get problems while coding, you can ask a new question.
One more thing, try to search for a solution first, before asking at stackoverflow. A lot of questions which you might have, have been already been answered in the past on stackoverflow or on similar forums/websites.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.