From: Scott N. <sni...@sc...> - 2003-12-22 22:50:54
|
>>>> To be honest, my manager is the one that sent me an email saying to try and make the XML more "generic for business changes down the road", but how would I do the second example you gave? <<<<< Frankly, I don't think that attempts to genericize XML have much = benefit. The most generic schema basically says the XML can be = anything, something like <element name=3D"foo"> <complexType> <complexContent> <any/> </complexContent> </complexType> </element> The schema need never change, but code for people reading the XML must = change every time the actual, possible content changes. This is extreme, of course, but the same problem applies when coding a = series of bits into a single int. When a new bit is defined, the code = that interprets the XML must change in order to use the new information. = There is, however, one benefit to merging bits into a single int = element: even as new bits are defined, the structure of the XML document = itself does not change, so no readers of the document should break. = When adding new elements, the issue is that some clients, specifically = those that statically bind de-serialization of XML to a particular = schema, will break when trying to handle XML containing the new = element(s). Still, if you need to add a new string or int element, such = clients will break unless you do something absurd with your schema, such = as encoding all the data into a single string that then must be parsed. The bottom line for me is that I live in reality, and in reality things = change, and we all must change to accomodate that. You will want to = change the XML schema at some time in a way that forces client to break = or change. It is better to have them change than to have you distort = your schema and XML content. So, putting bits in a single int will = cause grief for some clients (where the programmers have problems = decoding bits), but it will allow you to add bits without changing the = schema and does not particularly obfuscate the document structure. = However, going further to do something like encoding lots of different = fields into a single string, while avoiding the client breakage problem, = adds to much structure to the document content which cannot be specified = by the schema. >>>> Do I need to replace 'type'=3D>'string' to 'type'=3D>'xsd:string' for = all of them too? When I view the response, it has xsd:int for my store_number, so do I need to change this? <<<< Basically, you need to specify the namespace for the data types. Things = like int, string, boolean, and date come from the XML Schema Definition. = NuSOAP always has a prefix of 'xsd' in the WSDL file for the XSD = definition. Scott Nichol Do not send e-mail directly to this e-mail address, because it is filtered to accept only mail from specific mail lists. |