Hello,
I have an application that uses an XML file as a configuration file. For example: A department store company that uses an XML file for configuring: different sections (men's clothing, women's clothing, jewelry, household, furniture, kid's clothing and toys etc) and the merchandise they carry. Some department stores do not have certain sections. If they have the same sections, they carry similar merchandise.
There is a DTD file that specifies each section (men's clothing), its subsection (shoes) and its merchandise type (running). There is an XML file that lists all its elements and attributes, and this file gets really big. Also a lot of very similar information gets repeated over and over again. I am using Entity Reference to solve some of the data repetition. For parsing, I use the DOM object.
When some of the department stores do not have the exact same sections, I need to create a different XML file for it. For example, the department store A has Men's Clothing, Women's Clothing, Jewelry, and Kid's Clothing. Department store B has sections in addition to those A has; it has Household and Furniture. Department store C has an Optical section in addition to the ones store A and B have.
The goals are:
1. Allow one XML file and one corresponding DTD file to work with different department stores.
2. If the XML file gets too big, break it into different small XML files (men_clothing.xml, household.xml)
3. Minimize data repetitions.
I did some research in XML books and web sites, and could not really find what I need. Using an improper solution, I am able to accomplish the above 3 goals by
1. Running a C Preprocessor with the original XML file to generate a specific XML file using this command:
cpp -P -tradition -Ddepartment_C data.xml data.xml.C
I surround the Optical section in data.xml with:
#ifdef department_C
<optical>
...
...
</optical>
#endif
Then only data.xml.C contains the Optical section, and Department C uses this XML file. Any new section or merchandize only needs to be added in one place.
2. After breaking the department sections into several small XML files, I add this #include flag in the body of data.xml
#include men_clothing.xml
#include household.xml
...
By running this command:
cpp -P -tradition data.xml data.xml.complete
This combines all the small XML files into a big one.
3. Use programming C macro syntax for parameter substitution..
Question: Does XML provide similar syntax (#ifdef, #include, or macro) to accomplish these goals?
Any insights would be greatly appreaciated.
Fan
I have an application that uses an XML file as a configuration file. For example: A department store company that uses an XML file for configuring: different sections (men's clothing, women's clothing, jewelry, household, furniture, kid's clothing and toys etc) and the merchandise they carry. Some department stores do not have certain sections. If they have the same sections, they carry similar merchandise.
There is a DTD file that specifies each section (men's clothing), its subsection (shoes) and its merchandise type (running). There is an XML file that lists all its elements and attributes, and this file gets really big. Also a lot of very similar information gets repeated over and over again. I am using Entity Reference to solve some of the data repetition. For parsing, I use the DOM object.
When some of the department stores do not have the exact same sections, I need to create a different XML file for it. For example, the department store A has Men's Clothing, Women's Clothing, Jewelry, and Kid's Clothing. Department store B has sections in addition to those A has; it has Household and Furniture. Department store C has an Optical section in addition to the ones store A and B have.
The goals are:
1. Allow one XML file and one corresponding DTD file to work with different department stores.
2. If the XML file gets too big, break it into different small XML files (men_clothing.xml, household.xml)
3. Minimize data repetitions.
I did some research in XML books and web sites, and could not really find what I need. Using an improper solution, I am able to accomplish the above 3 goals by
1. Running a C Preprocessor with the original XML file to generate a specific XML file using this command:
cpp -P -tradition -Ddepartment_C data.xml data.xml.C
I surround the Optical section in data.xml with:
#ifdef department_C
<optical>
...
...
</optical>
#endif
Then only data.xml.C contains the Optical section, and Department C uses this XML file. Any new section or merchandize only needs to be added in one place.
2. After breaking the department sections into several small XML files, I add this #include flag in the body of data.xml
#include men_clothing.xml
#include household.xml
...
By running this command:
cpp -P -tradition data.xml data.xml.complete
This combines all the small XML files into a big one.
3. Use programming C macro syntax for parameter substitution..
Question: Does XML provide similar syntax (#ifdef, #include, or macro) to accomplish these goals?
Any insights would be greatly appreaciated.
Fan