version 1.92, 2003/10/16 23:25:03
|
version 1.95, 2004/04/19 22:09:17
|
|
|
//%///////////////////////////////////////////////////////////////////////////// |
//%2003//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM, |
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Development |
// The Open Group, Tivoli Systems |
// Company, L. P., IBM Corp., The Open Group, Tivoli Systems. |
|
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.; |
|
// IBM Corp.; EMC Corporation, The Open Group. |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a copy | // Permission is hereby granted, free of charge, to any person obtaining a copy |
// of this software and associated documentation files (the "Software"), to | // of this software and associated documentation files (the "Software"), to |
|
|
| |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
// | // |
|
// testStartTagOrEmptyTag() |
|
// |
|
//------------------------------------------------------------------------------ |
|
|
|
Boolean XmlReader::testStartTagOrEmptyTag( |
|
XmlParser& parser, |
|
XmlEntry& entry) |
|
{ |
|
if (!parser.next(entry) || |
|
(entry.type != XmlEntry::START_TAG && |
|
entry.type != XmlEntry::EMPTY_TAG)) |
|
{ |
|
parser.putBack(entry); |
|
return false; |
|
} |
|
|
|
return true; |
|
} |
|
|
|
//------------------------------------------------------------------------------ |
|
// |
// testContentOrCData() | // testContentOrCData() |
// | // |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
|
|
return true; | return true; |
} | } |
| |
static inline Uint8 _hexCharToNumeric(const char c) |
inline Uint8 _xmlReader_hexCharToNumeric(const char c) |
{ | { |
Uint8 n; | Uint8 n; |
| |
|
|
| |
} | } |
| |
Uint8 digit1 = _hexCharToNumeric(char(uriString[++i])); |
Uint8 digit1 = _xmlReader_hexCharToNumeric(char(uriString[++i])); |
Uint8 digit2 = _hexCharToNumeric(char(uriString[++i])); |
Uint8 digit2 = _xmlReader_hexCharToNumeric(char(uriString[++i])); |
if ( (digit1 > 15) || (digit2 > 15) ) | if ( (digit1 > 15) || (digit2 > 15) ) |
{ | { |
// l10n | // l10n |
|
|
x = x << 4; | x = x << 4; |
| |
// Make sure we don't overflow when we add the next digit | // Make sure we don't overflow when we add the next digit |
Sint64 newDigit = Sint64(_hexCharToNumeric(*p++)); |
Sint64 newDigit = Sint64(_xmlReader_hexCharToNumeric(*p++)); |
if (PEGASUS_SINT64_MIN - x > -newDigit) | if (PEGASUS_SINT64_MIN - x > -newDigit) |
{ | { |
return false; | return false; |
|
|
x = x << 4; | x = x << 4; |
| |
// We can't overflow when we add the next digit | // We can't overflow when we add the next digit |
Uint64 newDigit = Uint64(_hexCharToNumeric(*p++)); |
Uint64 newDigit = Uint64(_xmlReader_hexCharToNumeric(*p++)); |
if (PEGASUS_UINT64_MAX - x < newDigit) | if (PEGASUS_UINT64_MAX - x < newDigit) |
{ | { |
return false; | return false; |
|
|
| |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
// | // |
|
// skipElement() |
|
// |
|
//------------------------------------------------------------------------------ |
|
void XmlReader::skipElement( |
|
XmlParser& parser, |
|
XmlEntry& entry) |
|
{ |
|
const char * tag_name = entry.text; |
|
|
|
if (entry.type == XmlEntry::EMPTY_TAG) |
|
{ |
|
return; |
|
} |
|
|
|
while (testStartTagOrEmptyTag(parser, entry)) |
|
{ |
|
skipElement(parser, entry); |
|
} |
|
|
|
if (testContentOrCData(parser, entry)) |
|
{ |
|
; // skip |
|
} |
|
|
|
expectEndTag(parser, tag_name); |
|
return; |
|
} |
|
|
|
//------------------------------------------------------------------------------ |
|
// |
// getValueElement() | // getValueElement() |
// | // |
// <!ELEMENT VALUE (#PCDATA)> | // <!ELEMENT VALUE (#PCDATA)> |
|
|
| |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
// | // |
// getErrorElement() |
// DMTF CR Pending |
// | // |
// <!ELEMENT ERROR EMPTY> |
// <!ELEMENT ERROR (INSTANCE*)> |
// <!ATTLIST ERROR | // <!ATTLIST ERROR |
// CODE CDATA #REQUIRED | // CODE CDATA #REQUIRED |
// DESCRIPTION CDATA #IMPLIED> | // DESCRIPTION CDATA #IMPLIED> |
|
|
entry.getAttributeValue("DESCRIPTION", tmpDescription); | entry.getAttributeValue("DESCRIPTION", tmpDescription); |
| |
if (!empty) | if (!empty) |
|
{ |
|
while (testStartTagOrEmptyTag(parser, entry)) |
|
{ |
|
skipElement(parser, entry); |
|
} |
|
|
expectEndTag(parser, "ERROR"); | expectEndTag(parser, "ERROR"); |
|
} |
| |
cimException = PEGASUS_CIM_EXCEPTION(CIMStatusCode(tmpCode), tmpDescription); | cimException = PEGASUS_CIM_EXCEPTION(CIMStatusCode(tmpCode), tmpDescription); |
return true; | return true; |
|
|
} | } |
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |
|
|