Delphi7 + nativexml development, how to manage the class XML document format (fixed)? XML document formats (simplified) as follows:
<? The XML version="1.0" encoding="GB2312"?>
What are the potential energy will unit file after generalization, post, And generated after class, whether there is a function of the loading XML DOC document? Use this class to have a XML DOC document?
Add: I now use NativeXml is version 3.26, the following {$# ifndef D12up} Type UnicodeString=WideString; RawByteString=AnsiString; {$endif}
Const
//the Current version of the NativeXml unit CNativeXmlVersion='v3.26';
//TXmlNode is the ancestor for all nodes in the XML document. See TsdElement //for the elements, TsdAttribute for attributes. TXmlNode=class (TDebugPersistent) Private //inherited from TDebugPersistent: FOwner: TDebugComponent FParent: TXmlNode; .
CodePudding user response:
Passing UP friendship
CodePudding user response:
Scripting language is difficult, unless by DELPHI
CodePudding user response:
The upstairs friends, how to say it is difficult to? Generalization is!
CodePudding user response:
Delphi client define the mapping class
CodePudding user response:
Actually is kind of mapping of XML
CodePudding user response:
Why generalization? Need to generate the source code in translating, much trouble ah,,,,,,, so some people say that upstairs with a script
Implement a class, in fact, according to the name from the XML value (if need be, and can write value function),! Such a class is common, become just the XML data content If the class, the class will also changes with the structure of the XML, is the trouble
CodePudding user response:
Can you write it,
CodePudding user response:
XML structure is fixed It's convenient to make generalization, development time,
CodePudding user response:
If it is a simple class
Can use keys list instead of
Does not attribute - the values
If there is a child attributes or array
So big deal to define a single list of classes can completely meet the demand
CodePudding user response:
Feeling is too old to DELPHI, a lot of new technology, originally the DELPHI did not consider that lead to begin to disconnect from the OBJECT, so can't
CodePudding user response:
The structure of an XML document is relatively complex, attributes, deep level So let's class,
CodePudding user response:
I said don't know whether you know
Delphi list of key values such as Stringlist
Sl. The name [' Caption] :='value';
Sl. The name [' XXXX '] :='XX';
Describe like this is not a simple class?
If if there is object hierarchy
By SL. ADDOBJECT (' Child 'object); Implement Really can't define a class list, similar to the cycle of XML to add