version 1.1, 2001/01/14 19:53:33
|
version 1.34, 2002/07/26 20:01:19
|
|
|
//BEGIN_LICENSE |
//%///////////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM |
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM, |
|
// The Open Group, Tivoli Systems |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a |
// Permission is hereby granted, free of charge, to any person obtaining a copy |
// copy of this software and associated documentation files (the "Software"), |
// of this software and associated documentation files (the "Software"), to |
// to deal in the Software without restriction, including without limitation |
// deal in the Software without restriction, including without limitation the |
// the rights to use, copy, modify, merge, publish, distribute, sublicense, |
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
// and/or sell copies of the Software, and to permit persons to whom the |
// sell copies of the Software, and to permit persons to whom the Software is |
// Software is furnished to do so, subject to the following conditions: |
// furnished to do so, subject to the following conditions: |
// | // |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN |
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED |
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT |
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
// DEALINGS IN THE SOFTWARE. |
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
|
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
// | // |
//END_LICENSE |
//============================================================================== |
//BEGIN_HISTORY |
|
// | // |
// Author: |
// Author: Mike Brasher (mbrasher@bmc.com) |
// | // |
// $Log$ |
// Modified By: Carol Ann Krug Graves, Hewlett-Packard Company |
// Revision 1.1 2001/01/14 19:53:33 mike |
// (carolann_graves@hp.com) |
// Initial revision |
// Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com) |
|
// Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) |
// | // |
// |
//%///////////////////////////////////////////////////////////////////////////// |
//END_HISTORY |
|
|
|
//////////////////////////////////////////////////////////////////////////////// |
|
// |
|
// XmlReader.h |
|
// |
|
//////////////////////////////////////////////////////////////////////////////// |
|
| |
#ifndef Pegasus_XmlReader_h | #ifndef Pegasus_XmlReader_h |
#define Pegasus_XmlReader_h | #define Pegasus_XmlReader_h |
| |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
#include <Pegasus/Common/XmlParser.h> | #include <Pegasus/Common/XmlParser.h> |
#include <Pegasus/Common/Flavor.h> |
#include <Pegasus/Common/CIMFlavor.h> |
#include <Pegasus/Common/Scope.h> |
#include <Pegasus/Common/CIMScope.h> |
#include <Pegasus/Common/Reference.h> |
#include <Pegasus/Common/CIMType.h> |
|
#include <Pegasus/Common/CIMObjectPath.h> |
|
#include <Pegasus/Common/Linkage.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
class Qualifier; |
class CIMQualifier; |
class QualifierDecl; |
class CIMQualifierDecl; |
class ClassDecl; |
class CIMClass; |
class InstanceDecl; |
class CIMInstance; |
class Property; |
class CIMProperty; |
class Parameter; |
class CIMParameter; |
class Method; |
class CIMMethod; |
|
class CIMObject; |
|
class CIMParamValue; |
|
class CIMValue; |
| |
class PEGASUS_COMMON_LINKAGE XmlReader | class PEGASUS_COMMON_LINKAGE XmlReader |
{ | { |
public: | public: |
| |
static void expectXmlDeclaration( |
static void getXmlDeclaration( |
|
XmlParser& parser, |
|
const char*& xmlVersion, |
|
const char*& xmlEncoding); |
|
|
|
static Boolean testXmlDeclaration ( |
XmlParser& parser, | XmlParser& parser, |
XmlEntry& entry); | XmlEntry& entry); |
| |
|
|
XmlParser& parser, | XmlParser& parser, |
XmlEntry& entry); | XmlEntry& entry); |
| |
static void testCimStartTag(XmlParser& parser); |
static void getCimStartTag( |
|
XmlParser& parser, |
static Boolean getIsArrayAttribute( |
const char*& cimVersion, |
Uint32 lineNumber, |
const char*& dtdVersion); |
const XmlEntry& entry, |
|
const char* tagName, |
|
Boolean& value); |
|
| |
static String getCimNameAttribute( | static String getCimNameAttribute( |
Uint32 lineNumber, | Uint32 lineNumber, |
|
|
const XmlEntry& entry, | const XmlEntry& entry, |
const char* tagName); | const char* tagName); |
| |
static Type getCimTypeAttribute( |
static CIMType getCimTypeAttribute( |
Uint32 lineNumber, | Uint32 lineNumber, |
const XmlEntry& entry, | const XmlEntry& entry, |
const char* tagName); |
const char* tagName, |
|
const char* attributeName = "TYPE", |
|
Boolean required = true); |
| |
static Boolean getCimBooleanAttribute( | static Boolean getCimBooleanAttribute( |
Uint32 lineNumber, | Uint32 lineNumber, |
|
|
const char* stringValue, | const char* stringValue, |
Uint64& x); | Uint64& x); |
| |
static Value stringToValue( |
static CIMValue stringToValue( |
Uint32 lineNumber, | Uint32 lineNumber, |
const char* valueString, | const char* valueString, |
Type type); |
CIMType type); |
| |
|
/* getValueElement - Gets the CIMType and CIMValue for a single |
|
XML Value element. It expects <VALUE> as the start tag. |
|
@return Returns True if the value element exists |
|
*/ |
static Boolean getValueElement( | static Boolean getValueElement( |
XmlParser& parser, | XmlParser& parser, |
Type type, |
CIMType type, |
Value& value); |
CIMValue& value); |
|
|
|
static Boolean getStringValueElement( |
|
XmlParser& parser, |
|
String& str, |
|
Boolean required); |
| |
static Value stringArrayToValue( |
static CIMValue stringArrayToValue( |
Uint32 lineNumber, | Uint32 lineNumber, |
const Array<const char*>& array, | const Array<const char*>& array, |
Type type); |
CIMType type); |
| |
static Boolean getValueArrayElement( | static Boolean getValueArrayElement( |
XmlParser& parser, | XmlParser& parser, |
Type type, |
CIMType type, |
Value& value); |
CIMValue& value); |
| |
static Uint32 getFlavor( | static Uint32 getFlavor( |
XmlEntry& entry, | XmlEntry& entry, |
|
|
| |
static Boolean getQualifierElement( | static Boolean getQualifierElement( |
XmlParser& parser, | XmlParser& parser, |
Qualifier& qualifier); |
CIMQualifier& qualifier); |
| |
static Boolean getPropertyElement( | static Boolean getPropertyElement( |
XmlParser& parser, | XmlParser& parser, |
Property& property); |
CIMProperty& property); |
| |
static Boolean getArraySizeAttribute( | static Boolean getArraySizeAttribute( |
Uint32 lineNumber, | Uint32 lineNumber, |
|
|
| |
static Boolean getPropertyArrayElement( | static Boolean getPropertyArrayElement( |
XmlParser& parser, | XmlParser& parser, |
Property& property); |
CIMProperty& property); |
| |
static Boolean getHostElement( | static Boolean getHostElement( |
XmlParser& parser, | XmlParser& parser, |
|
|
String& className, | String& className, |
Array<KeyBinding>& keyBindings); | Array<KeyBinding>& keyBindings); |
| |
|
static Boolean getInstanceNameElement( |
|
XmlParser& parser, |
|
CIMObjectPath& instanceName); |
|
|
static Boolean getInstancePathElement( | static Boolean getInstancePathElement( |
XmlParser& parser, | XmlParser& parser, |
Reference& reference); |
CIMObjectPath& reference); |
| |
static Boolean getLocalInstancePathElement( | static Boolean getLocalInstancePathElement( |
XmlParser& parser, | XmlParser& parser, |
Reference& reference); |
CIMObjectPath& reference); |
| |
static Boolean getClassPathElement( | static Boolean getClassPathElement( |
XmlParser& parser, | XmlParser& parser, |
Reference& reference); |
CIMObjectPath& reference); |
| |
static Boolean getLocalClassPathElement( | static Boolean getLocalClassPathElement( |
XmlParser& parser, | XmlParser& parser, |
Reference& reference); |
CIMObjectPath& reference); |
| |
static Boolean getValueReferenceElement( | static Boolean getValueReferenceElement( |
XmlParser& parser, | XmlParser& parser, |
Reference& reference); |
CIMObjectPath& reference); |
|
|
|
static Boolean getValueReferenceArrayElement( |
|
XmlParser& parser, |
|
CIMValue& value); |
| |
static Boolean getPropertyReferenceElement( | static Boolean getPropertyReferenceElement( |
XmlParser& parser, | XmlParser& parser, |
Property& property); |
CIMProperty& property); |
| |
static Boolean getParameterElement( | static Boolean getParameterElement( |
XmlParser& parser, | XmlParser& parser, |
Parameter& parameter); |
CIMParameter& parameter); |
| |
static Boolean getParameterArrayElement( | static Boolean getParameterArrayElement( |
XmlParser& parser, | XmlParser& parser, |
Parameter& parameter); |
CIMParameter& parameter); |
| |
static Boolean getParameterReferenceElement( | static Boolean getParameterReferenceElement( |
XmlParser& parser, | XmlParser& parser, |
Parameter& parameter); |
CIMParameter& parameter); |
|
|
|
static Boolean getParameterReferenceArrayElement( |
|
XmlParser& parser, |
|
CIMParameter& parameter); |
| |
static Boolean getQualifierDeclElement( | static Boolean getQualifierDeclElement( |
XmlParser& parser, | XmlParser& parser, |
QualifierDecl& qualifierDecl); |
CIMQualifierDecl& qualifierDecl); |
| |
static Boolean getMethodElement( | static Boolean getMethodElement( |
XmlParser& parser, | XmlParser& parser, |
Method& method); |
CIMMethod& method); |
| |
static Boolean getClassElement( | static Boolean getClassElement( |
XmlParser& parser, | XmlParser& parser, |
ClassDecl& classDecl); |
CIMClass& cimClass); |
| |
static Boolean getInstanceElement( | static Boolean getInstanceElement( |
XmlParser& parser, | XmlParser& parser, |
InstanceDecl& instanceDecl); |
CIMInstance& cimInstance); |
| |
static void getObject(XmlParser& parser, ClassDecl& x) |
static Boolean getNamedInstanceElement( |
{ |
XmlParser& parser, |
if (!getClassElement(parser, x)) |
CIMInstance& namedInstance); |
{ |
|
throw XmlValidationError(parser.getLine(), |
|
"expected CLASS element"); |
|
} |
|
} |
|
| |
static void getObject(XmlParser& parser, QualifierDecl& x) |
static void getObject(XmlParser& parser, CIMClass& x); |
{ |
|
if (!getQualifierDeclElement(parser, x)) |
static void getObject(XmlParser& parser, CIMInstance& x); |
{ |
|
throw XmlValidationError(parser.getLine(), |
static void getObject(XmlParser& parser, CIMQualifierDecl& x); |
"expected QUALIFIER.DECLARATION element"); |
|
} |
|
} |
|
| |
static Boolean getMessageStartTag( | static Boolean getMessageStartTag( |
XmlParser& parser, | XmlParser& parser, |
Uint32& id, |
String& id, |
const char*& protocolVersion); |
String& protocolVersion); |
| |
static Boolean getIMethodCallStartTag( | static Boolean getIMethodCallStartTag( |
XmlParser& parser, | XmlParser& parser, |
|
|
XmlParser& parser, | XmlParser& parser, |
const char*& name); | const char*& name); |
| |
|
static Boolean getPropertyValue( |
|
XmlParser& parser, |
|
CIMValue& cimValue); |
|
|
static Boolean getBooleanValueElement( | static Boolean getBooleanValueElement( |
XmlParser& parser, | XmlParser& parser, |
Boolean& result, | Boolean& result, |
|
|
| |
static Boolean getErrorElement( | static Boolean getErrorElement( |
XmlParser& parser, | XmlParser& parser, |
CimException::Code& code, |
CIMException& cimException, |
const char*& description, |
|
Boolean required = false); | Boolean required = false); |
| |
|
static Boolean getValueObjectElement( |
|
XmlParser& parser, |
|
CIMObject& object); |
|
|
|
static Boolean getValueObjectWithPathElement( |
|
XmlParser& parser, |
|
CIMObject& objectWithPath); |
|
|
|
static Boolean getValueObjectWithLocalPathElement( |
|
XmlParser& parser, |
|
CIMObject& objectWithPath); |
|
|
|
static void getObjectArray( |
|
XmlParser& parser, |
|
Array<CIMObject>& objectArray); |
|
|
|
static Boolean getObjectNameElement( |
|
XmlParser& parser, |
|
CIMObjectPath& objectName); |
|
|
|
static Boolean getObjectPathElement( |
|
XmlParser& parser, |
|
CIMObjectPath& objectPath); |
|
|
|
static Boolean getEMethodCallStartTag( |
|
XmlParser& parser, |
|
const char*& name); |
|
|
|
static Boolean getEMethodResponseStartTag( |
|
XmlParser& parser, |
|
const char*& name); |
|
|
|
static Boolean getMethodCallStartTag( |
|
XmlParser& parser, |
|
const char*& name); |
|
|
|
static Boolean getMethodResponseStartTag( |
|
XmlParser& parser, |
|
const char*& name); |
|
|
|
static Boolean getParamValueElement( |
|
XmlParser& parser, |
|
CIMParamValue& paramValue); |
|
|
|
static Boolean getReturnValueElement( |
|
XmlParser& parser, |
|
CIMValue& returnValue); |
|
|
private: | private: |
| |
XmlReader() | XmlReader() |