Re: [xml] (Hacky) XML includes



Jason Viers wrote:
Michael Abbott wrote:

As an example for an included file:

  <AnElement>
    blah
  </AnElement>

  <AnotherElement>
    blah
  </AnotherElement>



If that's the full, exact contents if an included file, then the problem is that XML documents can only have 1 root node. Just wrap the entire contents in another tag.

<elements>
 <AnElement>blah</AnElement>
 <AnotherElement>blah</AnotherElement>
 ...
</elements>

That should stop the technical problem, but it'd definitely be good to look into using real XIncludes that Daniel mentioned.


I'll add 2 cents more. If it is possible in your situation, you might look into doing this with XSLT. I do something like this and it's really not that hard. I apply the XSL stylesheet using the libxslt facilities.

- Rush



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]