How to create xml document using Schema in MFC application?
-
Hi, Using MFC application, i need to input an xml schema to an MFC exe and i need to generate xml file as an output from the specified schema. I need to do this only in MFC application. Please suggest me some resolution as how to generate xml from schema using MFC application? Regards, Hema K
-
Hi, Using MFC application, i need to input an xml schema to an MFC exe and i need to generate xml file as an output from the specified schema. I need to do this only in MFC application. Please suggest me some resolution as how to generate xml from schema using MFC application? Regards, Hema K
It really depends of what you are trying to achieve. I suppose your xsd has a well defined structure otherwise there is no possible way for your MFC application to magically generate the data that is required to fill your xml file. In that case, what you could do is use a tool to generate classes based on your xsd file (which is called "data binding"). Those classes are added to your project sources and you manipulate them in your MFC application. Once the user has entered the data and you filled the different classes with the user data, you simply use the same library to serialize them into an XML file. You can for instance look at CodeSynthesis[^], which is a free tool. If that doesn't answer your question, then please provide more information about what you are trying to achieve.
Cédric Moonen Software developer
Charting control [v2.0] OpenGL game tutorial in C++ -
It really depends of what you are trying to achieve. I suppose your xsd has a well defined structure otherwise there is no possible way for your MFC application to magically generate the data that is required to fill your xml file. In that case, what you could do is use a tool to generate classes based on your xsd file (which is called "data binding"). Those classes are added to your project sources and you manipulate them in your MFC application. Once the user has entered the data and you filled the different classes with the user data, you simply use the same library to serialize them into an XML file. You can for instance look at CodeSynthesis[^], which is a free tool. If that doesn't answer your question, then please provide more information about what you are trying to achieve.
Cédric Moonen Software developer
Charting control [v2.0] OpenGL game tutorial in C++Hi, My schema file is very large and it contains so many particles, elements and attributes. The data binding provides so many classes for an single schema file. I have several schema files like this. Code will be very complex if i start doing data binding for all the schema files. Is there an Generic utility or Generic API in MFC so that it accepts any schema file and it can create an xml file from specified schema. Regards, Hema K
-
Hi, My schema file is very large and it contains so many particles, elements and attributes. The data binding provides so many classes for an single schema file. I have several schema files like this. Code will be very complex if i start doing data binding for all the schema files. Is there an Generic utility or Generic API in MFC so that it accepts any schema file and it can create an xml file from specified schema. Regards, Hema K
hemamerp wrote:
Is there an Generic utility or Generic API in MFC so that it accepts any schema file and it can create an xml file from specified schema.
This doesn't make sense: you need to have some data to fill your xml file. The xsd only specifies the structure of your final xml file, but you still have to provide the data yourself. So, from where is this data coming from ?
Cédric Moonen Software developer
Charting control [v2.0] OpenGL game tutorial in C++