This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Including XML tags from one file in another Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Including XML tags from one file in another" Watch "Including XML tags from one file in another" New topic
Author

Including XML tags from one file in another

jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
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

Joined: Jul 01, 2002
Posts: 65
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

Joined: May 08, 2001
Posts: 1932
That's a good option, David. Didn't even think about that *baps himself over the head*
Thanks!
Roseanne Zhang
Ranch Hand

Joined: Nov 14, 2000
Posts: 1953
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.
 
Consider Paul's rocket mass heater.
 
subject: Including XML tags from one file in another