XMLAttribute Class
The XMLAttribute is used for parsing and storing XML attributes. More...
Header: | #include <XMLAttribute> |
Inherits: | XMLPrimitive |
Public Functions
XMLAttribute(void) | |
virtual | ~XMLAttribute(void) |
std::string | GetStrValue() |
XMLString & | GetValue() |
void | SetStrValue(const std::string &value) |
void | SetValue(XMLString newValue) |
Reimplemented Public Functions
virtual bool | Dump(FILE *pFile) |
virtual char * | Dump(char *pzBuffer) |
virtual void | Dump(XMLBuffer &strBuffer) |
virtual unsigned int | GetWriteBufferSize() |
virtual void | Merge(XMLPrimitive *pOther) |
virtual const char * | Parse(const char *pStart, unsigned int &nLineNumber) |
virtual void | SetNext(XMLPrimitive *next) override |
virtual void | SetPrevious(XMLPrimitive *prev) override |
- 37 public functions inherited from XMLPrimitive
Additional Inherited Members
- 1 static public member inherited from XMLPrimitive
Detailed Description
The XMLAttribute is used for parsing and storing XML attributes.
Functions can be called to parse an attribute, set and retrieve name and value, and to generate XML.
Attribute example
Attribute="Value"
From the above, 'Attribute' is the attribute Name. It can be retrieved by the GetName() function. "Value" is the attribute value (without quotes). It can be retrieved by the GetValue() or GetStrValue() functions.
Example code:
XMLAttribute* attr = elementPtr->FindAttribute("Value"); if(attr!=nullptr && attr->GetValue()>1) HandleValuesAboveOne();
Member Function Documentation
XMLAttribute::XMLAttribute(void)
Constructs the XMLAttribute and sets the Type to e_XMLAttribute.
[virtual]
XMLAttribute::~XMLAttribute(void)
Deletes attached memory.
[virtual]
bool XMLAttribute::Dump(FILE *pFile)
Reimplemented from XMLPrimitive::Dump().
Appends the XMLAttribute to an open file as supplied in pFile.
[virtual]
char *XMLAttribute::Dump(char *pzBuffer)
Reimplemented from XMLPrimitive::Dump().
Appends the XMLAttribute content into pzBuffer.
See also GetWriteBufferSize().
[virtual]
void XMLAttribute::Dump(XMLBuffer &strBuffer)
Reimplemented from XMLPrimitive::Dump().
Appends the XMLAttribute content into strBuffer
std::string XMLAttribute::GetStrValue()
Gets the attribute value as an std::string.
XMLString &XMLAttribute::GetValue()
Gets the attribute value.
[virtual]
unsigned int XMLAttribute::GetWriteBufferSize()
Reimplemented from XMLPrimitive::GetWriteBufferSize().
Returns the size that this XMLAttribute will occupy in a string.
[virtual]
void XMLAttribute::Merge(XMLPrimitive *pOther)
Reimplemented from XMLPrimitive::Merge().
Searches all XMLAttributes (including and after this) for pOther, and if not found, add it as last XMLAttribute in this branch. This function is used to help merge two XML trees together so that one tree will get attributes that are in the other tree and not in the first. Example:
XMLAttribute* attributeMergeTarget = element->GetAttribute(); attributeMergeTarget->Merge(otherAttribute); // will append otherAttribute to end of attribute chain
[virtual]
const char *XMLAttribute::Parse(const char *pStart, unsigned int &nLineNumber)
Reimplemented from XMLPrimitive::Parse().
Parses pStart to get Attribute name,value and possible white-space. If errors are encountered, a descriptive error is added to the ErrorReporter (if set). Returns pointer to characters after this attribute (returned pointer never points to a white-space).
[override virtual]
void XMLAttribute::SetNext(XMLPrimitive *next)
Reimplemented from XMLPrimitive::SetNext().
Sets the next XMLAttribute to next and adds a white-space in-between if needed.
[override virtual]
void XMLAttribute::SetPrevious(XMLPrimitive *prev)
Reimplemented from XMLPrimitive::SetPrevious().
Sets the previous XMLPrimitive to prev.
void XMLAttribute::SetStrValue(const std::string &value)
Sets the attribute value to value.
void XMLAttribute::SetValue(XMLString newValue)
Sets the attribute value to newValue.
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.