I wanted to load external subfiles using ENTITY attribute of XML. I did it using following procedure.
<!DOCTYPE doc [
<!ENTITY A SYSTEM "C:///XML//A.xml">
<!ENTITY B SYSTEM "C://XML//B.xml">
<!ENTITY C SYSTEM "C://CONFIGURATION//XML//C.xml">
]>
<list idPrefix="N" seqIdLength="5">
&A;
</list>
Then in xml, I am referencing these entries using &. And XML goes A.xml and reads each xml element from this file. But if I want to modify this main xml from java, I have problem.First of all, DOCTYPE is deleted. For erased DOCTYPE problem, I changed my xml in following format.
<!DOCTYPE doc SYSTEM "C://XML//test.dtd">
I have copied following lines into test.dtd.
<!ENTITY A SYSTEM "C:///XML//A.xml">
<!ENTITY B SYSTEM "C://XML//B.xml">
<!ENTITY C SYSTEM "C://CONFIGURATION//XML//C.xml">
When I save XML , Now DOCTYPE is not deleted. But I have another problem. Instead of &A reference, content of A file is inserted main xml, and with a reference to ENTITY path.
<list idPrefix="N" seqIdLength="5">
<alist name = "1" xml:base="file:///C://XML//A.xml"/>
<alist name = "2" xml:base="file:///C://XML//A.xml"/>
<alist name = "3" xml:base="file:///C://XML//A.xml"/>
<alist name = "4" xml:base="file:///C://XML//A.xml"/>
<alist name = "5" xml:base="file:///C://XML//A.xml"/>
<alist name = "6" xml:base="file:///C://XML//A.xml"/>
<alist name = "7" xml:base="file:///C://XML//A.xml"/>
</list>
And now I have lost functionality of ENTITY . I have all data in main xml. Do we have a solution for this?