Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Including other XML documents in XML

Status
Not open for further replies.

Windrider

Programmer
Jul 26, 2002
8
FI
Hi,

I was wondering whether it would be possible to somehow include multiple documents in XML -file that also has includes from other xml files?

For example with entities and SYSTEM command, it's possible to include other documents, e.g. test.xml

<?xml version="1.0" standalone="yes" ?>
<!DOCTYPE testi [
<!ENTITY C SYSTEM "./test2.xml">
]>

<root>

<testing>
&C;
</testing>
</root>

But if test2.xml has entity declaration, the file test.xml cannot be loaded, because there is multiple entities.

Is there any way to workaround this?


Also is it possible to include data to specific location of XML-file from the same document with XPath or some other way create a reference to it, e.g.

<DOCUMENT>
<SECT>
<data>some data</data>
<!-- can I somehow get section 2 here ? -->
</SECT>

<SECT2>
<data>some data in sect2</data>
</SECT2>
</DOCUMENT>

so the document would look then like this:

<DOCUMENT>
<SECT>
<data>some data</data>
<SECT2>
<data>some data in sect2</data>
</SECT2>
</SECT>

<SECT2>
<data>some data in sect2</data>
</SECT2>
</DOCUMENT>


I'm using Perl and XML::XPath for processing the XML-data, so could it be possible for it to "see" the data like presented above. It handles the ENTITY -declarations ok, but can data be referenced somehow, so that e.g. SECT2 could be referenced in SECT and it would look like the data would be there?

Thank you!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top