Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Including XML tags from one file in another

 
jason adam
Chicken Farmer ()
Ranch Hand
Posts: 1932
  • Mark post as helpful
  • send pies
  • 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*
 
David Patterson
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • 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 ()
Ranch Hand
Posts: 1932
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's a good option, David. Didn't even think about that *baps himself over the head*
Thanks!
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic