Hi Axel, thank you for the reply!
Regarding the validation: Are there any transformations available, which turn the schema into a GUI / PHP page oder editors, which do validation on-the-fly? Regarding the construction of the object: Is it a good idea for the helper classes to have a constructor which takes a string and let is parse its parameters from there (in case there are descending object within the helper)? Do you recycle the parser, or let the helpers have their own parser? Another question is how I should handle/parse types which I often use. I need to supply matrices to the helpers. How can I encapsulate the matrix-parser and reuse it? Cheers & Danke, Michael Freundliche Grüsse Michael Gauckler Zürcher Kantonalbank, VFK Josefstrasse 222, 8005 Zürich Tel. +41 (0) 1 292 45 41, Fax +41 (0) 1 292 45 93 Briefadresse: Postfach 8010, http://www.zkb.ch |---------+--------------------------------> | | Axel Weiß | | | <[EMAIL PROTECTED]| | | -berlin.de> | | | | | | 15.03.2005 22:36 | | | | |---------+--------------------------------> >------------------------------------------------------------------------------------------------------------------------------| | | | An: xerces-c-dev@xml.apache.org, [EMAIL PROTECTED], [EMAIL PROTECTED] | | Kopie: | | Thema: Re: XML OO Parametrization | >------------------------------------------------------------------------------------------------------------------------------| Am Dienstag, 15. März 2005 19:05 schrieb Michael Gauckler: > Dear List, > > I am new to this list and XML in general. > > I'd like to use XML to feed parameters in our modular C++ application. Hi Michael, this is a good idea - I had the same some months ago... > Modular in the sense that, depending on the configuration (determined > at program startup), different types of objects are created through a > factory. > > Example: > > Class A > { > Helper* h; > } > > Class ColoredHelper : public Helper > {..} > > Class StripedHelper : public Helper > {..} > > On construction an instances of A the factory creates the helper > according to the configuration file and lets h point to it. Seems to be the right concept. > The problems we are facing are: > > a) > > The configuration file must be made consistent. I am thinking of a XML > schema, which describes all possible classes that can be used as > Helper's. With the help of this xsd the configuration can be > validated, or maybe can be transformed into a GUI. Before starting the > application the configuration file can easily be checked against the > schema. Ok, this is the purpose of xml-schema. What is the problem regarding this? > b) > > Parametrization of the Helpers. The different helpers might need > different parameters (ColorHelper maybe only one, whereas > StripedHelper needs two parameters). I am thinking of XML fragments, > which are parsed by the helper object to extract the appropriate > parameters. I usually map argument values to attribute values. They can be checked against their valid range during validation. Different arguments have different attribute names (as 'key'), so you can map each Helper class to an xml element that has as many attributes as the number of arguments the constructor takes. > At the moment I am considering the Xerces parser in SAX mode. Is this > the right decision, or should I rather go for DOM? > > Can XML fragments be passed to another object for parsing (upon > detection of the helpers token)? Or should I add new callback > functions according to the object generated? It's maybe a matter of taste, but I prefer handling DOM-trees for the extraction of xml contents. Be sure to have something like a hierarchical desicion-tree and pick the argument values for your object generation at the last step. > Is the approach feasible, or am I missing something fundamentally? In my applications, most of the persistent configuration information is accessible by the user via menu operation or dialogs. The user settings are written back to the xml configuration file after change, for convenience. Cheers, Axel -- Humboldt-Universität zu Berlin Institut für Informatik Signalverarbeitung und Mustererkennung Dipl.-Inf. Axel Weiß Rudower Chaussee 25 12489 Berlin-Adlershof +49-30-2093-3050 ** www.freesp.de ** ___________________________________________________________________ Disclaimer: Diese Mitteilung ist nur fuer die Empfaengerin / den Empfaenger bestimmt. Fuer den Fall, dass sie von nichtberechtigten Personen empfangen wird, bitten wir diese hoeflich, die Mitteilung an die ZKB zurueckzusenden und anschliessend die Mitteilung mit allen Anhaengen sowie allfaellige Kopien zu vernichten bzw. zu loeschen. Der Gebrauch der Information ist verboten. This message is intended only for the named recipient and may contain confidential or privileged information. If you have received it in error, please advise the sender by return e-mail and delete this message and any attachments. Any unauthorised use or dissemination of this information is strictly prohibited. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]