Reading an XML file with references to other XML files

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hello,
I am very new to XML and I have tried to find the answer but failed.
I need to have an XML file that has references of links to other XML files that need to be included when the main file is loaded and capable of being loaded by themselves.
here is a sample from my test project:
<div style="color:Black;background-color:White; <pre>
Mainfile.xml
<span style="color:Blue; <?<span style="color:#A31515; xml <span style="color:Red; version<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 1.0<span style="color:Black; " <span style="color:Red; encoding<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; UTF-8<span style="color:Black; "<span style="color:Blue; ?>
<span style="color:Blue; <<span style="color:#A31515; book <span style="color:Red; xmlns:xi<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; http://www.w3.org/2001/XInclude<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; title<span style="color:Blue; >The Wit and Wisdom<span style="color:Blue; </<span style="color:#A31515; title<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xi<span style="color:Blue; :<span style="color:#A31515; include <span style="color:Red; href<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; anincludedfile1.xml<span style="color:Black; "<span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; xi<span style="color:Blue; :<span style="color:#A31515; include <span style="color:Red; href<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; anincludedfile2.xml<span style="color:Black; "<span style="color:Blue; />
<span style="color:Blue; </<span style="color:#A31515; book<span style="color:Blue; >

anincludedfile1.xml
<span style="color:Blue; <?<span style="color:#A31515; xml <span style="color:Red; version<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 1.0<span style="color:Black; " <span style="color:Red; encoding<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; UTF-8<span style="color:Black; " <span style="color:Blue; ?>
<span style="color:Blue; <<span style="color:#A31515; anode <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; test1<span style="color:Black; " <span style="color:Blue; />

anincludedfile2.xml
<span style="color:Blue; <?<span style="color:#A31515; xml <span style="color:Red; version<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 1.0<span style="color:Black; " <span style="color:Red; encoding<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; utf-8<span style="color:Black; " <span style="color:Blue; ?>
<span style="color:Blue; <<span style="color:#A31515; anode <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; test2<span style="color:Black; " <span style="color:Blue; />
[/code]
Some parts of the program will read Mainfile.xml and I need it to either automatily replace the reference nodes with the contents of the files or set up an intermediate function within deserialization to do the replacing.
Please post any code in VB.net as I am not very experianced with C# and the translation programs dont always work right.
Thankyou,
Rykazz

View the full article
 
Back
Top