SOL9 2.0 Class: Schema

 SOL9 C++ Class Library  SOL9 Samples  SOL9 Tutorial  SOL9 FAQ  SOL9 ClassTree 

Source code

/*
 * Schema.h 
 * Copyright (c) 2011 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED. 
 */


// SOL9
// 2011/02/06
#pragma once

#include <sol/xml/SchemaItem.h>
#include <sol/xml/SchemaItemCollection.h>
#include <sol/xml/SchemaStringCollection.h>

namespace SOL {

class Schema : public SchemaItem {

public:
    Schema(MSXML2::ISchemaPtr pSchema)
    :SchemaItem((MSXML2::ISchemaItemPtr)pSchema)
    {

    }

public:
    MSXML2::ISchemaPtr getSchemaPtr()
    {
        return(MSXML2::ISchemaPtr)SchemaItem::getItemPtr();
    }

public:
    _bstr_t getTargetNamespace()
    {
        return getSchemaPtr()->GettargetNamespace();
    }

    _bstr_t getVersion()
    {
        return getSchemaPtr()->Getversion();
    }
    
    MSXML2::ISchemaItemCollectionPtr getTypes()
    {
        return getSchemaPtr()->Gettypes();
    }
    
    MSXML2::ISchemaItemCollectionPtr getElements()
    {
        return getSchemaPtr()->Getelements();
    }
    
    MSXML2::ISchemaItemCollectionPtr getAttributes()
    {
        return getSchemaPtr()->Getattributes();
    }
    
    MSXML2::ISchemaItemCollectionPtr getAttributeGroups()
    {
        return getSchemaPtr()->GetattributeGroups();
    }
    
    MSXML2::ISchemaItemCollectionPtr getModelGroups()
    {
        return getSchemaPtr()->GetmodelGroups();
    }
    
    MSXML2::ISchemaItemCollectionPtr getNotations()
    {
        return getSchemaPtr()->Getnotations();
    }
    
    MSXML2::ISchemaStringCollectionPtr getSchemaLocations()
    {
        return getSchemaPtr()->GetschemaLocations();
    }

public:
    void display()
    {
        printf("<Schema>\n");
        try {
        _tprintf(_T("<Namespace>%<Namespace>\n"), (const TCHAR*)getTargetNamespace());
        } catch (...) {
        }

        try {
        _tprintf(_T("<Version>%s</Version>\n"), (const TCHAR*)getVersion() );
        } catch (...) {
        }

        try {
            SchemaItemCollection types = getTypes();
            types.display(_T("Types"));
        } catch (...) {
        }

        try {
            SchemaItemCollection elements = getElements();
            elements.display(_T("Elements"));
        } catch (...) {
        }

        try {
            SchemaItemCollection attr = getAttributes();
            attr.display(_T("Attributes"));
        } catch (...) {
        }

        try {
            SchemaItemCollection attrGroups = getAttributeGroups();
            attrGroups.display(_T("AttributesGroups"));
        } catch (...) {
        }

        try {
            SchemaItemCollection modelGroups = getModelGroups();
            modelGroups.display(_T("ModelGroups"));
        } catch (...) {
        }

        try {
            SchemaItemCollection notations = getNotations();
            notations.display(_T("Notations"));
        } catch (...) {
        }
        try {
            SchemaStringCollection locations =  getSchemaLocations();
            locations.display(_T("Locations"));
        } catch (...) {
        }
        printf("</Schema>\n");

    }


};

}


Last modified: 1 Feb 2012

Copyright (c) 2009-2012 Antillia.com ALL RIGHTS RESERVED.