XML schemas for begginers!
-
Hi Guys, I am relatively new to XML and it's associated technologies and was looking for some help / advice. We have a bunch of classes that are arranged into a hierarchy and we now want to represent these classes in XML. Its just so happens that there is already a standard for encoding the object which my classes represent into XML. This encoding is represented in a set XML Schemas. XML schemas is something before today I knew very little about, so I have spent that afternoon reading up on them. Now I have an understanding of what they are and what they do / represent. What I need now is some direction on how to accomplish the task in hand. What I am asking for is some help / advice on how I should now go about using the schemas to create some XML. It does look very much like the XML elements and my classes could be one in the same, so it is very tempting to add a "GetXML" function to my classes. I am reluctant to do this as I am trying to keep my classes very light weight and loosely coupled to other classes. Should I therefore create a set of classes based on the elements in the schema, and these objects get constructed from my current set of classes, and these new classes have the "GetXML" function. It does sound like I am almost answering my own question, and it is sounding less and less like an XML question and more of a structural question. But I would be very interested in any feed back from anybody who has faced and solved similar problems when dealing with encoding objects to XML. Cheers AndyC :)
-
Hi Guys, I am relatively new to XML and it's associated technologies and was looking for some help / advice. We have a bunch of classes that are arranged into a hierarchy and we now want to represent these classes in XML. Its just so happens that there is already a standard for encoding the object which my classes represent into XML. This encoding is represented in a set XML Schemas. XML schemas is something before today I knew very little about, so I have spent that afternoon reading up on them. Now I have an understanding of what they are and what they do / represent. What I need now is some direction on how to accomplish the task in hand. What I am asking for is some help / advice on how I should now go about using the schemas to create some XML. It does look very much like the XML elements and my classes could be one in the same, so it is very tempting to add a "GetXML" function to my classes. I am reluctant to do this as I am trying to keep my classes very light weight and loosely coupled to other classes. Should I therefore create a set of classes based on the elements in the schema, and these objects get constructed from my current set of classes, and these new classes have the "GetXML" function. It does sound like I am almost answering my own question, and it is sounding less and less like an XML question and more of a structural question. But I would be very interested in any feed back from anybody who has faced and solved similar problems when dealing with encoding objects to XML. Cheers AndyC :)
Representing classes in xml. hmmm. Shameless plug here, but it sounds like what you're looking for is MyXaml (see sig). Marc MyXaml Advanced Unit Testing