• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Including XML tags from one file in another

 
Chicken Farmer ()
Posts: 1932
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know a schema can include an .xsd in its definition, but can an XML file include actual elements from another XML document?
Basically, I have an XML config file, part of which needs to be shared between subsystems (a shared folder location for writing files). The file builder classes I'm working with need to know this path, but they also need some other information which is only related to them; the other subsystem doesn't need to know about these extra configurations.
So I'd like to share an XML file between systems for a common configuration, but also have a separate XML file for my file builders, but have that XML file include the information in the shared one. *begins to babble incoherently*
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think it might make sense to have each of the (separate) XML config files, have the name of the common one. Then, have the code that processes the config file interpret the reference to the common file and read that one as well.
 
jason adam
Chicken Farmer ()
Posts: 1932
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's a good option, David. Didn't even think about that *baps himself over the head*
Thanks!
 
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are doing ant build, the common part as XML fragnent is stored in a file, then the build.xml will include an external system entity. This is a kind of standard way to do it.
If it is configuration, we use component replacement to include other well-formed xml files.
reply
    Bookmark Topic Watch Topic
  • New Topic