[英]How to modifies the Xml tag using Java and insert new tag inside the Xml File?
I need to add following method tag in the given below Xml File using Java. 我需要使用Java在下面给出的Xml文件中添加以下方法标记。
<method id="img_8497" img_src="/media/media/12508/23804/AWH13.ThreeKids.SM.jpg" img_height="180" img_width="317" title_="playing^kids"/>
In this tag it have 5 attributes and in java i can given it as local variable. 在这个标签中它有5个属性,在java中我可以将它作为局部变量。 In the Xml creation i need to use the 5 attributes.
在Xml创建中,我需要使用5个属性。 The method tag will be child tag for LiberaryBook and In option it may be child of Liberary tag too.
方法标签将是LiberaryBook的子标签,而In选项也可能是Liberary标签的子标签。 I need to insert the method tag between LiberayBook and Liberary tag.
我需要在LiberayBook和Liberary标签之间插入方法标签。 If the number of Liberay tag may less or increase.
如果Liberay标签的数量可能减少或增加。 dipend on that it should create method for Liberay tag.(FOR loop).
dipend它应该为Liberay标签创建方法。(FOR循环)。
<parent>
<Body class="student" id="181_student_method_3">
<Book class="Book_In_School_11" id="181_student_method_11"/>
<subject class="subject_information " id="181_student_subject_12"/>
<div class="div_passage " id="181_div_method_3">
<p class=" paragraph_book_name" id="181_paragraph_13">
<LiberaryBook class="Liberary" id="181_Liberary_9" >
<Liberary class="choice " Uninversity="University_Liberary_1">Dubliners</Liberary>
<Liberary class="choice " Uninversity="University_Liberary_2">Adventure if sherlock Holmes</Liberary>
<Liberary class="choice " Uninversity="University_Liberary_3">Charlotte’s Web</Liberary>
<Liberary class="choice " Uninversity="University_Liberary_4">The Outsiders</Liberary>
</LiberaryBook>
</p>
</div>
</Body>
</parent>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.