• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
CDP Studio logo

CDP Studio

Software development tool for distributed control systems

  • Why CDP
    • Software developers
    • Automation engineers
    • Managers
  • Product
    • Design UI
    • Develop
    • Analyze and test
    • Deploy
    • Framework and toolbox
    • Compatibility
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • Framework - XMLParser
  • XMLPrimitive

XMLPrimitive Class

The XMLPrimitive is the base-class for all other XML primitives. It has a Type, Previous, Next and Parent. More...

Header: #include <XMLPrimitive>
Inherited By:

XMLAttribute, XMLCData, XMLComment, XMLElementEx, XMLEntity, and XMLText

  • List of all members, including inherited members

Public Functions

XMLPrimitive(XMLType_e eType = e_XMLUnknown)
virtual ~XMLPrimitive()
void Callback(IXMLCallback *pComponent, IXMLCALLBACK_FUNC_PTR pCallbackFunction = & IXMLCallback::XMLParserCallback)
virtual bool Dump(FILE *pFile)
virtual char *Dump(char *pzBuffer)
virtual void Dump(XMLBuffer &strBuffer)
XMLPrimitive *FindFirstPrimitive(XMLType_e MatchType, const char *pName, int nMaxLevel)
XMLPrimitive *GetChild() const
XMLString GetChildElementValue(const char *pzName)
std::string GetChildElementValue(const std::string &name)
XMLPrimitive *GetLast()
int GetLevel()
int GetLineNumber() const
const XMLString &GetName() const
XMLPrimitive *GetNext() const
XMLPrimitive *GetParent()
std::string GetPathName()
XMLPrimitive *GetPrevious() const
const char *GetPrintableType() const
std::string GetStrName() const
XMLType_e GetType()
XMLPrimitive *GetValidNextOrParent()
virtual unsigned int GetWriteBufferSize()
virtual void InsertChildBefore(XMLPrimitive *pNewFirstChild)
virtual void InsertChildLast(XMLPrimitive *pNewLastChild)
virtual void InsertNext(XMLPrimitive *pNewNext)
virtual void InsertPrevious(XMLPrimitive *pNewPrevious)
virtual void Merge(XMLPrimitive *pOther)
virtual const char *Parse(const char *pStart, unsigned int &nLineNumber) = 0
void SetChild(XMLPrimitive *child)
void SetErrorReporter(IErrorReporter *pEHI)
void SetLevel(int nLevel, bool bUpdateChildren = false)
void SetLineNumber(int linenumber)
void SetName(const char *newName)
virtual void SetNext(XMLPrimitive *next)
void SetParent(XMLPrimitive *parent)
virtual void SetPrevious(XMLPrimitive *prev)
void SetType(XMLType_e eType)
void Unlink(void)

Static Public Members

XMLPrimitive *GetType(const char *pStart, int nLevel, IErrorReporter *pErrorReporter = nullptr)

Related Non-Members

enum XMLType_e { e_XMLUnknown, e_XMLHeader, e_XMLComment, e_XMLElement, ..., e_XMLQMark }

Detailed Description

The XMLPrimitive is the base-class for all other XML primitives. It has a Type, Previous, Next and Parent.

Member Function Documentation

XMLPrimitive::XMLPrimitive(XMLType_e eType = e_XMLUnknown)

Contructs the primitive with the supplied type.

[virtual] XMLPrimitive::~XMLPrimitive()

Destroys the instance of XMLPrimitive. The destructor is virtual.

void XMLPrimitive::Callback(IXMLCallback *pComponent, IXMLCALLBACK_FUNC_PTR pCallbackFunction = & IXMLCallback::XMLParserCallback)

Calls callback function pCallbackFunction on pComponent with 'this'.

[virtual] bool XMLPrimitive::Dump(FILE *pFile)

Appends the primitive to the open file pFile.

[virtual] char *XMLPrimitive::Dump(char *pzBuffer)

Appends the primitive to the buffer pzBuffer.

[virtual] void XMLPrimitive::Dump(XMLBuffer &strBuffer)

Appends the primitive to the string strBuffer.

XMLPrimitive *XMLPrimitive::FindFirstPrimitive(XMLType_e MatchType, const char *pName, int nMaxLevel)

Returns the first primitive of a given MatchType, pName and nMaxLevel level (level=tree-depth) or nullptr if not found.

XMLPrimitive *XMLPrimitive::GetChild() const

Gets the first child primitive, or nullptr if not set.

XMLString XMLPrimitive::GetChildElementValue(const char *pzName)

Returns the value of the child element matching pzName, or empty string if not found.

See also FindFirstPrimitive.

std::string XMLPrimitive::GetChildElementValue(const std::string &name)

Returns the value of the child element matching name, or empty string if not found.

See also FindFirstPrimitive.

XMLPrimitive *XMLPrimitive::GetLast()

Gets the last XMLPrimitive that is non-nullptr.

int XMLPrimitive::GetLevel()

Gets the level (tree-depth) of this primitive.

int XMLPrimitive::GetLineNumber() const

Gets the line number for this primitive.

const XMLString &XMLPrimitive::GetName() const

Gets the name of this primitive.

XMLPrimitive *XMLPrimitive::GetNext() const

Get the next XMLPrimitive, or nullptr if not set.

XMLPrimitive *XMLPrimitive::GetParent()

Returns the parent, or nullptr if not set.

std::string XMLPrimitive::GetPathName()

Returns the tree path name of this item in the form 'first/second/third/thisItem'.

XMLPrimitive *XMLPrimitive::GetPrevious() const

Gets the previous XMLPrimitive, or nullptr if not set

const char *XMLPrimitive::GetPrintableType() const

Returns the printable type name of this primitive.

std::string XMLPrimitive::GetStrName() const

Gets the name of this primitive as a std::string.

XMLType_e XMLPrimitive::GetType()

Gets the primitive Type.

[static] XMLPrimitive *XMLPrimitive::GetType(const char *pStart, int nLevel, IErrorReporter *pErrorReporter = nullptr)

Creates the correct primitive type at pStart and returns it (so it is ready for parsing). Returns nullptr on failure

XMLPrimitive *XMLPrimitive::GetValidNextOrParent()

Gets either the next primitive (if non-nullptr) or the parent primitive.

[virtual] unsigned int XMLPrimitive::GetWriteBufferSize()

Returns the size required to store this primitive.

[virtual] void XMLPrimitive::InsertChildBefore(XMLPrimitive *pNewFirstChild)

Inserts a new child-primitive before any other child primitives.

[virtual] void XMLPrimitive::InsertChildLast(XMLPrimitive *pNewLastChild)

Inserts a new child-primitive after any other child primitives.

[virtual] void XMLPrimitive::InsertNext(XMLPrimitive *pNewNext)

Inserts a new next-primitive after this one, updating affected items' next, parent and previous pointers in the process.

[virtual] void XMLPrimitive::InsertPrevious(XMLPrimitive *pNewPrevious)

Inserts a new previous-primitive before this one, updating affected items' next, parent and previous pointers in the process.

[virtual] void XMLPrimitive::Merge(XMLPrimitive *pOther)

Merges pOther into this.

This base-implementation does nothing. Derived classes should provide functionality to add elements pfrom pOther that don't exisit in this primitive.

[pure virtual] const char *XMLPrimitive::Parse(const char *pStart, unsigned int &nLineNumber)

Parses the primitive, returning position of next element in string.

void XMLPrimitive::SetChild(XMLPrimitive *child)

Overwrites the first child with child.

void XMLPrimitive::SetErrorReporter(IErrorReporter *pEHI)

Sets the error reporter to pEHI.

void XMLPrimitive::SetLevel(int nLevel, bool bUpdateChildren = false)

Sets the (tree-depth) level to nLevel, and if bUpdateChildren is set, also updates the level for all children.

void XMLPrimitive::SetLineNumber(int linenumber)

Sets the linenumber for this primitive.

void XMLPrimitive::SetName(const char *newName)

Sets the name to newName.

[virtual] void XMLPrimitive::SetNext(XMLPrimitive *next)

Sets the next XMLPrimitive to next unconditionally, overwriting any existing 'next' primitive.

void XMLPrimitive::SetParent(XMLPrimitive *parent)

Sets the parent to parent.

[virtual] void XMLPrimitive::SetPrevious(XMLPrimitive *prev)

Sets the previous XMLPrimitive to prev unconditionally, overwriting any existing 'previous' primitive.

void XMLPrimitive::SetType(XMLType_e eType)

Sets the Type to eType.

void XMLPrimitive::Unlink(void)

Unlinks this primitive from the tree so it can be manipulated (i.e. deleted) without affecting other items.

Related Non-Members

enum XMLType_e

This enum specifies the type of an XML primitive

ConstantValueDescription
e_XMLUnknown0Unknown xml primitive (error?)
e_XMLHeader1xml header element: <?xml version="1.0" ?>
e_XMLComment2xml comment element: <!-- comment -->
e_XMLElement3xml element: <element/>
e_XMLAttribute4xml attribute: Name="Value"
e_XMLText5xml text: some text that is inbetween <elements/>
e_XMLCData6xml CData element: <![CDATA[unescaped html/xml here]]>
e_XMLEntity7XML Entity: <!unknown>
e_XMLBOM8XML Byte-Order-Mark (UTF-8, preserved)
e_XMLQMark9XML QMark: <?xml-stylesheet name=""?>

The content of this document is confidential information not to be published without the consent of CDP Technologies AS.

CDP Technologies AS, www.cdpstudio.com

Get started with CDP Studio today

Let us help you take your great ideas and turn them into the products your customer will love.

Try CDP Studio for free
Why CDP Studio?

CDP Technologies AS
Hundsværgata 8,
P.O. Box 144
6001 Ålesund, Norway

Tel: +47 990 80 900
E-mail: info@cdptech.com

Company

About CDP

Contact us

Services

Partners

Blog

Developers

Get started

User manuals

Support

Document download

Release notes

Follow CDP

    © Copyright 2021 CDP Technologies. Privacy and cookie policy.

    Return to top