#include <SchemaParser.h>
Public Types | |
typedef std::list< Element > | ElementList |
typedef std::list< Attribute > | AttributeList |
typedef std::list< Group > | GroupList |
typedef std::list < AttributeGroup * > | AttributeGroupList |
typedef std::list< Constraint * > | ConstraintList |
typedef std::list< Qname > | QNameList |
typedef std::list< const XSDType * > | ConstTypeList |
Public Member Functions | |
Constructors and Destructors | |
SchemaParser (const std::string &Uri, std::string tns="", std::ostream &log=std::cout, const std::string &confPath="") | |
SchemaParser (XmlPullParser *parser, std::string tns="", std::ostream &log=std::cout, const std::string &confPath="") | |
~SchemaParser () | |
methods used for parsing | |
bool | parseSchemaTag () |
Various Getter methods | |
const XSDType * | getType (const Qname &type) |
const XSDType * | getType (int id) const |
const XSDType * | getType (int id, std::string &nameSpace) |
ConstTypeList * | getAllTypes () const |
const Element * | getElement (const Qname &element) const |
const ElementList & | getElements () const |
int | getNumElements () const |
Attribute * | getAttribute (const Qname &attribute) |
const AttributeList & | getAttributes () const |
int | getNumAttributes () const |
std::string | getNamespace (void) const |
int | getNumTypes () const |
int | getTypeId (const Qname &, bool create=false) |
bool | isBasicType (int sType) const |
int | getBasicContentType (int typeId) const |
Group * | getGroup (const Qname &name) |
AttributeGroup * | getAttributeGroup (const Qname &name) |
Methods for handling Imports | |
bool | isImported (const std::string &ns) const |
const SchemaParser * | getImportedSchemaParser (const std::string &ns) const |
bool | addImport (std::string ns, std::string location="") |
bool | addImport (SchemaParser *sp) |
bool | addImports (const std::vector< SchemaParser * > &schemaParsers) |
Miscellaneous Methods | |
bool | finalize (void) |
void | setWarningLevel (int l) |
void | setSchemaPath (const std::string &s) |
void | setUri (const std::string &u) |
std::string | getTypeName (Schema::Type t) const |
TypesTable * | getTypesTable () |
const SchemaParser * | getImportedSchema (std::string &nameSpace) |
std::vector< ImportedSchema > & | getImportedSchemas () |
std::string | getVersion () const |
bool | getElementQualified () const |
std::string | getTnsPrefix (void) const |
Classes | |
struct | ImportedSchema |
Definition at line 42 of file SchemaParser.h.
typedef std::list<Element> Schema::SchemaParser::ElementList |
typedefs
Definition at line 50 of file SchemaParser.h.
typedef std::list<Attribute> Schema::SchemaParser::AttributeList |
Definition at line 51 of file SchemaParser.h.
typedef std::list<Group> Schema::SchemaParser::GroupList |
Definition at line 52 of file SchemaParser.h.
typedef std::list<AttributeGroup*> Schema::SchemaParser::AttributeGroupList |
Definition at line 53 of file SchemaParser.h.
typedef std::list<Constraint*> Schema::SchemaParser::ConstraintList |
Definition at line 54 of file SchemaParser.h.
typedef std::list<Qname> Schema::SchemaParser::QNameList |
Definition at line 55 of file SchemaParser.h.
typedef std::list< const XSDType *> Schema::SchemaParser::ConstTypeList |
Definition at line 56 of file SchemaParser.h.
Schema::SchemaParser::SchemaParser | ( | const std::string & | Uri, | |
std::string | tns = "" , |
|||
std::ostream & | log = std::cout , |
|||
const std::string & | confPath = "" | |||
) |
The constructor for SchemaParser
the | URI schema definition file. | |
target | namespace | |
output | stream for any error outputs | |
confPath | The path where schema files for soap and other namespaces are located. This is required only if you have stored them other than src/schemas on windows. On *nix it is almost never required if you install using the make install |
Definition at line 46 of file SchemaParser.cpp.
References XmlPullParser::END_DOCUMENT, FEATURE_PROCESS_NAMESPACES, XmlUtils::fetchUri(), XmlPullParser::getEventType(), XmlPullParser::getName(), XmlPullParser::nextTag(), XmlPullParser::require(), XmlPullParser::setFeature(), XmlPullParser::START_DOCUMENT, and XmlPullParser::START_TAG.
Referenced by addImport().
Schema::SchemaParser::SchemaParser | ( | XmlPullParser * | parser, | |
std::string | tns = "" , |
|||
std::ostream & | log = std::cout , |
|||
const std::string & | confPath = "" | |||
) |
The constructor for SchemaParser
XmlPullParser | instance for the schema definition file. | |
target | namespace | |
output | stream for any error outputs | |
confPath | The path where schema files for soap and other namespaces are located. This is required only if you have stored them other than src/schemas on windows. On *nix it is almost never required if you install using the make install |
Definition at line 29 of file SchemaParser.cpp.
Schema::SchemaParser::~SchemaParser | ( | ) |
bool Schema::SchemaParser::parseSchemaTag | ( | ) |
parseSchemaTag
Definition at line 145 of file SchemaParser.cpp.
References Schema::SchemaParserException::col, XmlPullParserException::col, Schema::SchemaParserException::description, XmlPullParserException::description, XmlPullParser::getAttributeCount(), XmlPullParser::getAttributeName(), XmlPullParser::getAttributeValue(), XmlPullParser::getColumnNumber(), XmlPullParser::getDepth(), XmlPullParser::getEventType(), XmlPullParser::getLineNumber(), XmlPullParser::getNamespaceCount(), XmlPullParser::getNamespacePrefix(), XmlPullParser::getNamespaceUri(), Schema::SchemaParserException::line, XmlPullParserException::line, XmlPullParser::next(), XmlPullParser::nextTag(), XmlPullParser::require(), Schema::SchemaUri, Schema::TypesTable::setTargetNamespace(), and XmlPullParser::START_TAG.
Referenced by addImport(), main(), and Schema::SchemaValidator::validate().
getType
Qname | refering to the type |
Definition at line 1899 of file SchemaParser.cpp.
References getTypeId(), and Schema::TypesTable::getTypePtr().
Referenced by getAllTypes(), Schema::TypeContainer::getAttributeContainer(), Schema::TypeContainer::getBaseTypeContainer(), getBasicContentType(), getType(), Schema::TypeContainer::getValue(), Schema::TypeContainer::rewind(), WsdlPull::WsdlInvoker::setInputValue(), and Schema::SchemaValidator::validate().
const XSDType * Schema::SchemaParser::getType | ( | int | id | ) | const |
the | types unique id |
Definition at line 1892 of file SchemaParser.cpp.
References Schema::TypesTable::getTypePtr().
const XSDType * Schema::SchemaParser::getType | ( | int | id, | |
std::string & | nameSpace | |||
) |
the | types unique id | |
the | namespace of the type |
Definition at line 1912 of file SchemaParser.cpp.
References getImportedSchema(), and getType().
list< const XSDType * > * Schema::SchemaParser::getAllTypes | ( | ) | const |
Definition at line 1944 of file SchemaParser.cpp.
References getNumTypes(), getType(), and Schema::XSD_ANYURI.
Qname | of the element |
Definition at line 1754 of file SchemaParser.cpp.
References Qname::getLocalName(), Qname::getNamespace(), and Schema::SchemaUri.
Referenced by WsdlPull::Soap::handleElement(), WsdlPull::Soap::isSoapBody(), WsdlPull::Soap::isSoapHeader(), and main().
const SchemaParser::ElementList & Schema::SchemaParser::getElements | ( | ) | const [inline] |
returns the std::list of all the global elements in the schema
void |
Definition at line 401 of file SchemaParser.h.
Referenced by main().
int Schema::SchemaParser::getNumElements | ( | ) | const |
Definition at line 1964 of file SchemaParser.cpp.
getAttribute
Qname | of the attribute |
Definition at line 1788 of file SchemaParser.cpp.
References Qname::getLocalName(), Qname::getNamespace(), and Schema::SchemaUri.
const SchemaParser::AttributeList & Schema::SchemaParser::getAttributes | ( | ) | const [inline] |
returns a std::list of global attributes in the schema
void |
Definition at line 408 of file SchemaParser.h.
int Schema::SchemaParser::getNumAttributes | ( | ) | const |
Definition at line 1971 of file SchemaParser.cpp.
std::string Schema::SchemaParser::getNamespace | ( | void | ) | const |
Definition at line 1885 of file SchemaParser.cpp.
Referenced by addImport(), addImports(), Schema::SchemaValidator::instance(), main(), and Schema::SchemaValidator::validate().
int Schema::SchemaParser::getNumTypes | ( | ) | const |
Definition at line 1957 of file SchemaParser.cpp.
References Schema::TypesTable::getNumTypes().
Referenced by getAllTypes().
int Schema::SchemaParser::getTypeId | ( | const Qname & | type, | |
bool | create = false | |||
) |
getTypeId :Search for a type ,if not present create one
Qname | of the type | |
bool:create |
Definition at line 1610 of file SchemaParser.cpp.
References Schema::TypesTable::addExternalTypeId(), addImport(), Qname::getNamespace(), Schema::TypesTable::getTypeId(), Schema::SchemaUri, and Schema::XSD_INVALID.
bool Schema::SchemaParser::isBasicType | ( | int | sType | ) | const |
isBasicType
unique | type identifier |
Definition at line 1592 of file SchemaParser.cpp.
References Schema::XSD_ANYURI, and Schema::XSD_INVALID.
Referenced by getTypeName(), Schema::TypeContainer::getValue(), Schema::TypeContainer::rewind(), and Schema::SchemaValidator::validate().
int Schema::SchemaParser::getBasicContentType | ( | int | typeId | ) | const |
getBasicContentType
If the type has a simple content model then this method returns the basic schema type which defines its contents For example calling on a type like below would return Schema::STRING
<xsd:complexType> <xsd:simpleContent> <xsd:extension base = "xsd:std::string"> <xsd:attribute name = "lang" type = "xsd:std::string"/> </xsd:extension> </xsd:simpleContent> </xsd:complexType>
unique | type identifier |
Definition at line 2099 of file SchemaParser.cpp.
References Schema::XSDType::getContentModel(), Schema::ComplexType::getContentType(), getType(), Schema::XSDType::isSimple(), Schema::Simple, and Schema::XSD_INVALID.
Referenced by Schema::TypeContainer::getValue(), Schema::TypeContainer::print(), Schema::TypeContainer::rewind(), and Schema::SchemaValidator::validate().
getGroup
unique | type identifier |
Definition at line 1819 of file SchemaParser.cpp.
References Qname::getLocalName(), Qname::getNamespace(), and Schema::SchemaUri.
AttributeGroup * Schema::SchemaParser::getAttributeGroup | ( | const Qname & | name | ) |
getAttributeGroup
unique | type identifier |
Definition at line 1852 of file SchemaParser.cpp.
References Qname::getLocalName(), Qname::getNamespace(), and Schema::SchemaUri.
bool Schema::SchemaParser::isImported | ( | const std::string & | ns | ) | const [inline] |
isImported true if the schema parser imports a namespace
Definition at line 421 of file SchemaParser.h.
Referenced by Schema::SchemaValidator::validate().
const SchemaParser * Schema::SchemaParser::getImportedSchemaParser | ( | const std::string & | ns | ) | const [inline] |
bool Schema::SchemaParser::addImport | ( | std::string | ns, | |
std::string | location = "" | |||
) |
addImport .Instructs the schema parser to import a namespace
namespace | of the schema | |
(optional)schemaLocation | .If this is not passed ,schema file is not processed but any refernces to the namespace are not flagged as errors |
Definition at line 2033 of file SchemaParser.cpp.
References XmlUtils::fetchUri(), Schema::SchemaParser::ImportedSchema::ns, parseSchemaTag(), SchemaParser(), setUri(), and Schema::SchemaParser::ImportedSchema::sParser.
Referenced by addImports(), and getTypeId().
bool Schema::SchemaParser::addImport | ( | SchemaParser * | sp | ) |
addImport . imports the namespace of the schemaparser
SchemaParser | instance which has parsed the namespace |
Definition at line 1991 of file SchemaParser.cpp.
References getNamespace(), Schema::SchemaParser::ImportedSchema::ns, and Schema::SchemaParser::ImportedSchema::sParser.
bool Schema::SchemaParser::addImports | ( | const std::vector< SchemaParser * > & | schemaParsers | ) |
bool Schema::SchemaParser::finalize | ( | void | ) |
finalize : tries to match unresolved types and references with imported schemas you *must* call this to ensure successful type resolution
Definition at line 1658 of file SchemaParser.cpp.
References Schema::TypesTable::addExtType(), Schema::TypesTable::detectUndefinedTypes(), Schema::TypesTable::getExtRefName(), Schema::TypesTable::getExtRefType(), Qname::getNamespace(), Schema::TypesTable::getNumExtRefs(), and Schema::TypesTable::printUndefinedTypes().
void Schema::SchemaParser::setWarningLevel | ( | int | l | ) | [inline] |
setWarningLevel default is 0 . 1 is wanrning level 2 is information level //quite verbose
Definition at line 415 of file SchemaParser.h.
Referenced by main().
void Schema::SchemaParser::setSchemaPath | ( | const std::string & | s | ) | [inline] |
Definition at line 438 of file SchemaParser.h.
void Schema::SchemaParser::setUri | ( | const std::string & | u | ) | [inline] |
std::string Schema::SchemaParser::getTypeName | ( | Schema::Type | t | ) | const |
getTypeName() return the type name given the id
Definition at line 2132 of file SchemaParser.cpp.
References Schema::TypesTable::getAtomicTypeName(), Schema::XSDType::getName(), Schema::TypesTable::getTypePtr(), and isBasicType().
TypesTable * Schema::SchemaParser::getTypesTable | ( | ) | [inline] |
Definition at line 452 of file SchemaParser.h.
const SchemaParser * Schema::SchemaParser::getImportedSchema | ( | std::string & | nameSpace | ) |
Definition at line 1926 of file SchemaParser.cpp.
References Schema::SchemaUri.
Referenced by getType().
std::vector< SchemaParser::ImportedSchema > & Schema::SchemaParser::getImportedSchemas | ( | ) | [inline] |
Definition at line 459 of file SchemaParser.h.
std::string Schema::SchemaParser::getVersion | ( | ) | const [inline] |
getVersion() return the schema version
Definition at line 466 of file SchemaParser.h.
bool Schema::SchemaParser::getElementQualified | ( | ) | const [inline] |
Definition at line 473 of file SchemaParser.h.
std::string Schema::SchemaParser::getTnsPrefix | ( | void | ) | const [inline] |
Definition at line 481 of file SchemaParser.h.