XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old March 31st, 2003, 01:42 PM
kalpana_kk kalpana_kk is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 11 kalpana_kk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question XML in another XML

Could someone tell me how to include an XML document within another XML document?


Thanks
Kalpana

Reply With Quote
  #2  
Old April 7th, 2003, 12:46 PM
VAYKENT VAYKENT is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: Provo
Posts: 36 VAYKENT User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
CDATA tags.

If you search the XML recommendation, you'll find a section explaining what CDATA tags are.

Reply With Quote
  #3  
Old April 8th, 2003, 03:46 AM
Wingman Wingman is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Bavaria, Germany
Posts: 140 Wingman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 40 m 41 sec
Reputation Power: 6
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>

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > XML in another XML


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway