|C++ XML Objects Use: Generics|
Previous Next Usage Home Installation Docs
It is possible that you don't want, or need, to care about the syntax of the XML file that is read. So far, each tag that appears in the XML file needed to have an associated object registered with that name, or be a member of an object.
By overriding a different type of "xmlobj_context" called "generic_context" when you read in the file, you will get a new type of object called "generic" which will be created for any objects that appear in the file that aren't registered.
Studying the way that generic was developed can also help in working out ways in which you can non-intrusively extend C++ XML Objects to do other interesting things.
Here is a possible XML file that we might have which defines the values for the objects, and also provides
for the composite objects (including the pointer):
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
The big difference with this example is that we never registered the objects "genroot", "genfoo" or "genbar". If this file is read in using a derivation of "generic_context", a new object will be created without any syntax errors being generated.
You can still register your own objects with the system as well as using the generic one for objects that you don't. Just derived from generic_context rather than xmlobj_context.
To include a generic object in your hierarchy, make sure you use the more general xmlobj_ref and xmlobj_vector rather than the typed variety to hold the new objects, since they won't have internal C++ types (other than xmlobj::generic).
Previous Usage Home Installation Docs
Generated: Wed Apr 5 23:00:20 EST 2006
Copyright (c) 2005; Paul Hamilton; pHamtec P/L.
Use, modification, and distribution is provided free of any limitations.