|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Could someone tell me how to include an XML document within another XML document?
Thanks Kalpana |
|
#2
|
|||
|
|||
|
CDATA tags.
If you search the XML recommendation, you'll find a section explaining what CDATA tags are. |
|
#3
|
|||
|
|||
|
There's no import tag in xml as it's available in xsl (<xsl:import href="..." />), but you can emulate such a behaviour by using your own <import href="" /> tag and then evaluating all import tags in your doc when you load it... (just like a pre-processor)
Example (VB): Code:
MyDoc.xml:
<doc>
<child>
<import href="MyChilds.xml" />
</child>
</doc>
MyChilds.xml:
<sub-doc>
<sub-child-1 />
<sub-child-2 />
<sub-child-3 />
</sub-doc>
Code:
Dim lDoc As DOMDocument
Set lDoc = New DOMDocument
lDoc.Load "MyDoc.xml"
Dim lImportNode As IXMLDOMElement
For Each lImportNode In lDoc.SelectNodes("//import")
Dim lImportDoc As DOMDocument
Set lImportDoc = New DOMDocument
If (lImportDoc.Load(lImportNode.GetAttribute("href"))) Then
lImportNode.ParentNode.ReplaceChild lImportNode, lImportDoc.DocumentElement
End If
Next
...will result in... Code:
<doc>
<child>
<sub-doc>
<sub-child-1 />
<sub-child-2 />
<sub-child-3 />
</sub-doc>
</child>
</doc>
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > XML in another XML |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|