A parsed xmlschema file. More...
#include <xmlschema.h>

Public Types | |
| enum | extspec { forbid = false, allow = true } |
Public Member Functions | |
| xmlschema (const string &name) | |
| xmlschema (hardCodedSchema i) | |
| xmlschema (void) | |
| void | load (const string &name) |
| void | xmlrootschema (void) |
| void | xmlbaseschema (void) |
| void | netdbschema (void) |
| void | runoptschema (void) |
| void | validatorschema (void) |
| void | plistschema (void) |
| void | addbasemembers (value &) |
| void | addbaseclass (const statstring &bt, const char *it, const char *cd, const char *icd) |
| bool | hasnamespaces (void) |
| bool | hasrootclass (void) |
| bool | tagkey (void) |
| const string & | getrootclass (void) |
| bool | hasdoctype (void) |
| const value & | doctype (void) |
| void | nstranstype (value &ns, statstring &typ) |
| void | nstransattr (value &nm, statstring &at, const value &v) |
| bool | knownclass (const string &) |
| const string & | resolveid (const string &cl, const string &scl) |
| bool | wouldneedprecedents (const statstring &) |
| const string & | resolvetype (const statstring &cl) |
| const string & | resolvetypeattrib (const statstring &cl, const statstring &an) |
| const statstring & | resolveindexname (const statstring &) |
| void | resolveclass (const statstring &, const statstring &, const statstring &, const statstring &, statstring &) |
| const statstring & | resolveidexport (const statstring &, const statstring &, const statstring &, const statstring &) |
| bool | stringclassisbase64 (const statstring &) |
| bool | iswrapcontainer (const statstring &) |
| bool | iswrap (const statstring &) |
| bool | iscontainerclass (const statstring &) |
| bool | isunion (const statstring &) |
| const statstring & | resolveunion (const value *, const statstring &) |
| void | resolveunionbase (statstring &) |
| bool | containerhasattributes (const statstring &) |
| bool | containerhasattribute (const statstring &, const statstring &) |
| bool | hasvalueattribute (const statstring &) |
| const string & | resolvevalueattribute (const statstring &) |
| bool | isimplicitarray (const statstring &) |
| const string & | resolvecontainerenvelope (const statstring &) |
| const string & | resolvecontainerwrapclass (const statstring &) |
| const string & | resolvecontaineridclass (const statstring &) |
| const string & | resolvecontainervalueclass (const statstring &) |
| string * | resolvecontainerboolclass (const statstring &, bool) |
| string * | resolvecontainertypeclass (const statstring &, unsigned char) |
| string * | resolvecontainerarrayclass (const statstring &) |
| string * | resolvecontainerdictclass (const statstring &) |
| bool | isinternaltype (const statstring &) |
| bool | validate (const value &, const value &, extspec) |
| value * | create (const statstring &) |
| value & | inspectcode (const char *) |
| bool | isattribute (const char *) |
| bool | isindex (const char *) |
| bool | isprecedent (const char *) |
| const string & | xmltype (const char *) |
| const string & | attributelabel (const char *) |
| const string & | xmlclass (const char *) |
| bool | isdict (const char *) |
| bool | hasimplicit (const char *) |
| const string & | implicitid (const char *) |
| const string & | precedentclass (const char *) |
| const char * | resolvecode (const statstring &) |
| const char * | resolvecodeid (const statstring &) |
| const char * | resolvecodeattrib (const statstring &, const statstring &) |
Static Public Member Functions | |
| static xmlschema & | root (void) |
| static xmlschema & | base (void) |
| static xmlschema & | runopt (void) |
| static xmlschema & | validator (void) |
| static xmlschema & | netdb (void) |
| static xmlschema & | plist (void) |
Public Attributes | |
| value | schema |
Protected Attributes | |
| value | codecache |
This class is used by the value class for XML exports and imports.
| xmlschema::xmlschema | ( | const string & | name | ) |
Creator.
Loads disk schema file.
| name | path to schema file. |
References value::loadxml(), and root().

| xmlschema::xmlschema | ( | hardCodedSchema | i | ) |
Creator.
Initialize as a builtin schema.
References netdbschema(), plistschema(), runoptschema(), value::type(), validatorschema(), xmlbaseschema(), and xmlrootschema().

| void xmlschema::addbaseclass | ( | const statstring & | bt, | |
| const char * | it, | |||
| const char * | cd, | |||
| const char * | icd | |||
| ) |
Add a primitive type.
| bt | The registered type. | |
| it | The intrinsic type. | |
| cd | CXML code for the class. | |
| icd | CXML code for the index attribute. |
References value::setattrib(), and value::type().
Referenced by xmlbaseschema().

| bool xmlschema::containerhasattribute | ( | const statstring & | theclass, | |
| const statstring & | theattrib | |||
| ) |
Return true if the provided class has a specific attribute.
Referenced by value::printxml().
| bool xmlschema::containerhasattributes | ( | const statstring & | theclass | ) |
Return true if the provided class has attributes.
References value::exists().
Referenced by value::fromxml(), and value::printxml().

| value * xmlschema::create | ( | const statstring & | type | ) |
Create new value object with all mandatory schema elements filled in.
References value::attributes(), visitor< kind >::enter(), value::exists(), visitor< kind >::first(), value::label(), visitor< kind >::next(), visitor< kind >::obj(), and visitor< kind >::up().

| const value & xmlschema::doctype | ( | void | ) |
Get the doctype information.
The string data of the value is the doctype string, with the attribute 'dtd' containing the URI for the doctype DTD, the attribute 'name' containing the short name for the doctype and the attribute 'status' indicating the doctype being either public or private.
Referenced by value::toxml().
| const string & xmlschema::getrootclass | ( | void | ) |
Return the root class if defined in the xml.schema.options section.
References value::sval().
Referenced by value::printxml().

| bool xmlschema::hasnamespaces | ( | void | ) |
Returns true if the schema has namespace definitions.
References value::exists().
Referenced by value::fromxml().

| bool xmlschema::hasrootclass | ( | void | ) |
Returns true if a root class is defined in the xml.schema.options section.
References value::exists().
Referenced by value::printxml().

| bool xmlschema::hasvalueattribute | ( | const statstring & | theclass | ) |
If true, the class has an attribvalue attribute, indicating that the class data should be stored inside an attribute.
References value::exists().
Referenced by value::fromxml(), and value::printxml().

| bool xmlschema::iscontainerclass | ( | const statstring & | theclass | ) |
Returns true if a class uses the 'container' method for encoding.
The main difference with regular methods is that child nodes instead of attributes are used for implying an object's type or id.
References visitor< kind >::enter(), and visitor< kind >::obj().
Referenced by value::fromxml(), and value::printxml().

| bool xmlschema::iswrap | ( | const statstring & | theclass | ) |
Returns true if the class is defined with a wrap="true" attribute, indicating that its contents should be wrapped into the parent (container) class.
References value::exists().
Referenced by value::fromxml().

| bool xmlschema::iswrapcontainer | ( | const statstring & | theclass | ) |
Returns true if the class is a container with child objects having a wrap="true" attribute indicating this class should only do type wrapping and has no child nodes.
References value::exists().
Referenced by value::printxml().

| bool xmlschema::knownclass | ( | const string & | name | ) |
Returns true of a registered type is defined by the schema.
References value::exists().
Referenced by value::fromxml(), and value::printcompressed().

| void xmlschema::load | ( | const string & | name | ) |
Load a schema file.
| name | File name. |
References value::loadxml(), and root().
Referenced by configdb< appclass >::load().

| void xmlschema::nstransattr | ( | value & | nm, | |
| statstring & | at, | |||
| const value & | v | |||
| ) |
Perform namespace translation of an attribute label.
| nm | Namespace data. | |
| at | Attribute name. Will be changed. | |
| v | Reference to the value implicated. |
References string::crop(), string::cutat(), value::exists(), visitor< kind >::first(), value::id, visitor< kind >::next(), visitor< kind >::obj(), string::strcat(), string::strchr(), string::strlen(), value::sval(), and statstring::sval().
Referenced by value::fromxml().

| void xmlschema::nstranstype | ( | value & | ns, | |
| statstring & | typ | |||
| ) |
Perform namespace translation of a type.
| ns | Namespace data. | |
| typ | The type. Will be changed by this method. |
References string::cutat(), value::exists(), statstring::str(), string::strchr(), value::strlen(), value::sval(), and statstring::sval().
Referenced by value::fromxml().

| void xmlschema::resolveclass | ( | const statstring & | id, | |
| const statstring & | currentclass, | |||
| const statstring & | superclass, | |||
| const statstring & | superid, | |||
| statstring & | into | |||
| ) |
Determines implicit class.
Looks at the context of the currently resolved class, superclass, key and the parent's key to see if any of these imply that the node should be written with another registered type.
References visitor< kind >::enter(), value::exists(), visitor< kind >::first(), visitor< kind >::id(), visitor< kind >::next(), visitor< kind >::obj(), visitor< kind >::root(), statstring::str(), and value::strlen().
Referenced by value::printcompressed(), and value::printxml().

Determines an implicit id.
| cl | The current class. | |
| scl | The super-class. |
References visitor< kind >::enter(), visitor< kind >::obj(), and tagkey().
Referenced by value::fromxml().

| const statstring & xmlschema::resolveidexport | ( | const statstring & | id, | |
| const statstring & | currentclass, | |||
| const statstring & | superclass, | |||
| const statstring & | superid | |||
| ) |
Resolve type to key.
If the schema implies that objects of a certain class have a defined index key, this method will return the value for that key.
References value::attributes(), visitor< kind >::enter(), value::exists(), visitor< kind >::first(), visitor< kind >::next(), visitor< kind >::obj(), and visitor< kind >::up().
Referenced by value::printcompressed(), and value::printxml().

| const string & xmlschema::resolvetype | ( | const statstring & | cl | ) |
Resolve a class to its intrinsic type.
| cl | Class name. |
References value::exists(), and statstring::sval().
Referenced by value::fromxml(), value::printcompressed(), and wouldneedprecedents().

| const string & xmlschema::resolvetypeattrib | ( | const statstring & | cl, | |
| const statstring & | an | |||
| ) |
Resolve an attribute to its intrinsic type.
| cl | Class name. | |
| an | Attribute name. |
References visitor< kind >::enter(), visitor< kind >::obj(), value::sval(), and statstring::sval().
Referenced by value::printcompressed().

| const string & xmlschema::resolvevalueattribute | ( | const statstring & | theclass | ) |
Return the attribute name for a type that encodes its value as such.
Referenced by value::fromxml(), and value::printxml().
| bool xmlschema::stringclassisbase64 | ( | const statstring & | theclass | ) |
Returns true if the schema defined a string object to use base64 encoding.
References visitor< kind >::enter(), and visitor< kind >::obj().
Referenced by value::fromxml(), and value::printxml().

| bool xmlschema::tagkey | ( | void | ) |
Returns true if unknown tags should be treated as keys.
References value::exists().
Referenced by resolveid().

| bool xmlschema::wouldneedprecedents | ( | const statstring & | forclass | ) |
Used by CXML.
Determines whether attribute data should preceed object data.
References resolvetype().
Referenced by value::printcompressed().

1.6.1