OpenPetra
Free Administration Software for Non-Profits
Ict.Tools.DBXML.TDataDefinitionParser Class Reference

This is a special XML parser for the datadefinition file for Petra More...

Inheritance diagram for Ict.Tools.DBXML.TDataDefinitionParser:
Ict.Common.IO.TXMLParser

Public Member Functions

 TDataDefinitionParser (string filename, bool withValidation)
 constructor More...
 
 TDataDefinitionParser (string filename)
 constructor More...
 
Object Parse (XmlNode cur, ref int groupId, string entity)
 Knows how to parse all the entities in the document. Reads one or more entities of the same type. More...
 
Boolean ParseDocument (ref TDataDefinitionStore myStore, Boolean ADoValidation, Boolean AAddAutoGeneratedFields)
 This will parse the xml document and store the contents in our Datadefinition Store More...
 
Boolean ParseDocument (ref TDataDefinitionStore myStore, Boolean ADoValidation)
 overloaded method of ParseDocument, always with adding special fields (createdby etc) More...
 
Boolean ParseDocument (ref TDataDefinitionStore myStore)
 overloaded version of ParseDocument, always add special fields, and validate the document More...
 
XmlDocument GetDocument ()
 retrieves the document, in case the document should be parsed not by a derived class More...
 

Static Public Member Functions

static string XmlToString (XmlDocument ADoc)
 print an xml document to string; this can be necessary for transmitting between server and client, since XmlDocument is not serializable More...
 
static string XmlToStringIndented (XmlDocument ADoc)
 print an xml document to string with indentation More...
 
static string XmlToString2 (XmlDocument ADoc)
 this is necessary to be able to store XML files that can be parsed by DTD/Schema mechanisms; for YML, we have the name of an element not as an attribute, but the element name itself; this would never work for validating xml; therefore all Elements are called XmlElement, with attribute name More...
 
static XmlNode NextNotBlank (XmlNode cur2)
 test the given node, if it is a comment or is empty; if it is empty, try the next nodes. More...
 
static XmlNode GetNextEntity (XmlNode cur)
 get the next code that is a proper entity (i.e. no comment, not empty) More...
 
static XmlNode GetChild (XmlNode cur, string name)
 return the child with the given name, if it exists; otherwise return null More...
 
static XmlNode FindNodeRecursive (XmlNode AParentNode, string ANodeNameToSearch)
 find a node somewhere in the xml document by its tag name More...
 
static XmlNode FindNodeRecursive (XmlNode AParentNode, string ANodeNameToSearch, string ANameAttribute)
 find a node somewhere in the xml document by its tag name and attribute name More...
 
static void SetAttribute (XmlNode cur, string AAttribName, string AAttribValue)
 add or set an attribute value More...
 
static void RenameAttribute (XmlNode cur, string AAttribOldName, string AAttribNewName)
 rename an existing attribute More...
 
static string GetAttribute (XmlNode cur, string attrib)
 Retrieve an XML attribute. Empty if attribute is not present More...
 
static string GetAttributeRecursive (XmlNode cur, string attrib, bool AInheritAttributes)
 Retrieve an XML attribute. Empty if attribute is not present. Check the parent nodes, if the current node does not have that attribute More...
 
static Boolean HasAttribute (XmlNode cur, string attrib)
 retrieve whether the node has an attribute with the given name or not More...
 
static Int32 GetIntAttribute (XmlNode cur, string attrib)
 retrieve the int value of an attribute. Does prevent unnecessary exceptions, if the attribute is not existing More...
 
static bool GetBoolAttribute (XmlNode cur, string attrib, bool defaultvalue)
 retrieve the boolean value of an attribute. Understands all sorts of notation (yes|no, true|false, 0|1) More...
 
static bool GetBoolAttribute (XmlNode cur, string attrib)
 overload for GetBoolAttribute, assuming default value is false More...
 
static double GetDoubleAttribute (XmlNode cur, string attrib)
 retrieve the double value of an attribute. Does prevent unnecessary exceptions, if the attribute is not existing More...
 
static decimal GetDecimalAttribute (XmlNode cur, string attrib)
 retrieve the decimal value of an attribute. Does prevent unnecessary exceptions, if the attribute is not existing More...
 

Public Attributes

bool SupportPetra2xLegacyStandard = false
 if this is set to true, primary key fields with NULL will be allowed. otherwise the DumpPetra2x does not work. More...
 

Protected Member Functions

TTable ParseTable (XmlNode cur2)
 Parse the definition of one database table More...
 
TTableField ParseTableField (XmlNode cur2)
 parse the definition of one table column More...
 
TConstraint ParseConstraint (XmlNode cur2, String AThisTableName)
 parse the definition of one constraint (unique, primary or foreign key) More...
 
TIndex ParseIndex (XmlNode cur2)
 Parse the definition of one index in the database More...
 
TIndexField ParseIndexField (XmlNode cur2)
 parse the field that is part of an index definition More...
 
TSequence ParseSequence (XmlNode cur2)
 parse the definition of a database sequence More...
 

Protected Attributes

XmlDocument myDoc
 the XmlDocument that is currently parsed More...
 

Detailed Description

This is a special XML parser for the datadefinition file for Petra

Constructor & Destructor Documentation

◆ TDataDefinitionParser() [1/2]

Ict.Tools.DBXML.TDataDefinitionParser.TDataDefinitionParser ( string  filename,
bool  withValidation 
)
inline

constructor

Parameters
filenamethe xml file that should be parsed
withValidationif true then the xml file will be validated

◆ TDataDefinitionParser() [2/2]

Ict.Tools.DBXML.TDataDefinitionParser.TDataDefinitionParser ( string  filename)
inline

constructor

Parameters
filenamethe xml file that should be parsed

Member Function Documentation

◆ FindNodeRecursive() [1/2]

static XmlNode Ict.Common.IO.TXMLParser.FindNodeRecursive ( XmlNode  AParentNode,
string  ANodeNameToSearch 
)
inlinestaticinherited

find a node somewhere in the xml document by its tag name

Parameters
AParentNode
ANodeNameToSearch
Returns

◆ FindNodeRecursive() [2/2]

static XmlNode Ict.Common.IO.TXMLParser.FindNodeRecursive ( XmlNode  AParentNode,
string  ANodeNameToSearch,
string  ANameAttribute 
)
inlinestaticinherited

find a node somewhere in the xml document by its tag name and attribute name

Parameters
AParentNode
ANodeNameToSearch
ANameAttribute
Returns

◆ GetAttribute()

static string Ict.Common.IO.TXMLParser.GetAttribute ( XmlNode  cur,
string  attrib 
)
inlinestaticinherited

Retrieve an XML attribute. Empty if attribute is not present

Parameters
curthe current node
attribthe name of the attribute
Returns
the value of the attribute, or an empty string if it is not existing

◆ GetAttributeRecursive()

static string Ict.Common.IO.TXMLParser.GetAttributeRecursive ( XmlNode  cur,
string  attrib,
bool  AInheritAttributes 
)
inlinestaticinherited

Retrieve an XML attribute. Empty if attribute is not present. Check the parent nodes, if the current node does not have that attribute

Parameters
curthe current node
attribthe name of the attribute
AInheritAttributesreturn all the values of the parent nodes as well
Returns
the value of the attribute, or the CSV list of attribute values of the parents and the node, or an empty string if the attribute is not existing

◆ GetBoolAttribute() [1/2]

static bool Ict.Common.IO.TXMLParser.GetBoolAttribute ( XmlNode  cur,
string  attrib 
)
inlinestaticinherited

overload for GetBoolAttribute, assuming default value is false

Parameters
curthe current node
attribthe name of the attribute
Returns
the value of the attribute, or false if it is not existing

◆ GetBoolAttribute() [2/2]

static bool Ict.Common.IO.TXMLParser.GetBoolAttribute ( XmlNode  cur,
string  attrib,
bool  defaultvalue 
)
inlinestaticinherited

retrieve the boolean value of an attribute. Understands all sorts of notation (yes|no, true|false, 0|1)

Parameters
curthe current node
attribthe name of the attribute
defaultvaluethe default value if the attribute is not existing; optional: false
Returns
the value of the attribute, or the default value if it is not existing

◆ GetChild()

static XmlNode Ict.Common.IO.TXMLParser.GetChild ( XmlNode  cur,
string  name 
)
inlinestaticinherited

return the child with the given name, if it exists; otherwise return null

Returns
void

◆ GetDecimalAttribute()

static decimal Ict.Common.IO.TXMLParser.GetDecimalAttribute ( XmlNode  cur,
string  attrib 
)
inlinestaticinherited

retrieve the decimal value of an attribute. Does prevent unnecessary exceptions, if the attribute is not existing

Parameters
curthe current node
attribthe name of the attribute
Returns
the value of the attribute, or -1 if it is not existing

◆ GetDocument()

XmlDocument Ict.Common.IO.TXMLParser.GetDocument ( )
inlineinherited

retrieves the document, in case the document should be parsed not by a derived class

Returns
void

◆ GetDoubleAttribute()

static double Ict.Common.IO.TXMLParser.GetDoubleAttribute ( XmlNode  cur,
string  attrib 
)
inlinestaticinherited

retrieve the double value of an attribute. Does prevent unnecessary exceptions, if the attribute is not existing

Parameters
curthe current node
attribthe name of the attribute
Returns
the value of the attribute, or -1 if it is not existing

◆ GetIntAttribute()

static Int32 Ict.Common.IO.TXMLParser.GetIntAttribute ( XmlNode  cur,
string  attrib 
)
inlinestaticinherited

retrieve the int value of an attribute. Does prevent unnecessary exceptions, if the attribute is not existing

Parameters
curthe current node
attribthe name of the attribute
Returns
the value of the attribute, or -1 if it is not existing

◆ GetNextEntity()

static XmlNode Ict.Common.IO.TXMLParser.GetNextEntity ( XmlNode  cur)
inlinestaticinherited

get the next code that is a proper entity (i.e. no comment, not empty)

Parameters
curthe current node
Returns
the next node with actual content

◆ HasAttribute()

static Boolean Ict.Common.IO.TXMLParser.HasAttribute ( XmlNode  cur,
string  attrib 
)
inlinestaticinherited

retrieve whether the node has an attribute with the given name or not

Parameters
curthe current node
attribthe name of the attribute
Returns
true if the attribute is existing

◆ NextNotBlank()

static XmlNode Ict.Common.IO.TXMLParser.NextNotBlank ( XmlNode  cur2)
inlinestaticinherited

test the given node, if it is a comment or is empty; if it is empty, try the next nodes.

Parameters
cur2the current node
Returns
the current or the first next node with actual content

◆ Parse()

Object Ict.Tools.DBXML.TDataDefinitionParser.Parse ( XmlNode  cur,
ref int  groupId,
string  entity 
)
inline

Knows how to parse all the entities in the document. Reads one or more entities of the same type.

Parameters
curThe current node
groupIdThe id of the current group that the elements will belong to
entityThe name of the entity that should be read
Returns
the last of the read entities

◆ ParseConstraint()

TConstraint Ict.Tools.DBXML.TDataDefinitionParser.ParseConstraint ( XmlNode  cur2,
String  AThisTableName 
)
inlineprotected

parse the definition of one constraint (unique, primary or foreign key)

Parameters
cur2the current node
AThisTableNamethe name of the table that this constraint belongs to
Returns
the constraint

◆ ParseDocument() [1/3]

Boolean Ict.Tools.DBXML.TDataDefinitionParser.ParseDocument ( ref TDataDefinitionStore  myStore)
inline

overloaded version of ParseDocument, always add special fields, and validate the document

Parameters
myStorethe destination for all the parsed information
Returns

◆ ParseDocument() [2/3]

Boolean Ict.Tools.DBXML.TDataDefinitionParser.ParseDocument ( ref TDataDefinitionStore  myStore,
Boolean  ADoValidation 
)
inline

overloaded method of ParseDocument, always with adding special fields (createdby etc)

Parameters
myStorethe destination for all the parsed information
ADoValidationshould the document be validated
Returns

◆ ParseDocument() [3/3]

Boolean Ict.Tools.DBXML.TDataDefinitionParser.ParseDocument ( ref TDataDefinitionStore  myStore,
Boolean  ADoValidation,
Boolean  AAddAutoGeneratedFields 
)
inline

This will parse the xml document and store the contents in our Datadefinition Store

Parameters
myStorethe destination of all the information
ADoValidationdo we want the XmlDocument to be validated
AAddAutoGeneratedFieldsshould some special fields be generated automatically, eg. createdby/datemodified etc
Returns

◆ ParseIndex()

TIndex Ict.Tools.DBXML.TDataDefinitionParser.ParseIndex ( XmlNode  cur2)
inlineprotected

Parse the definition of one index in the database

Parameters
cur2the current node
Returns

◆ ParseIndexField()

TIndexField Ict.Tools.DBXML.TDataDefinitionParser.ParseIndexField ( XmlNode  cur2)
inlineprotected

parse the field that is part of an index definition

Parameters
cur2the current node
Returns

◆ ParseSequence()

TSequence Ict.Tools.DBXML.TDataDefinitionParser.ParseSequence ( XmlNode  cur2)
inlineprotected

parse the definition of a database sequence

Parameters
cur2the current node
Returns

◆ ParseTable()

TTable Ict.Tools.DBXML.TDataDefinitionParser.ParseTable ( XmlNode  cur2)
inlineprotected

Parse the definition of one database table

Parameters
cur2the current node
Returns

◆ ParseTableField()

TTableField Ict.Tools.DBXML.TDataDefinitionParser.ParseTableField ( XmlNode  cur2)
inlineprotected

parse the definition of one table column

Parameters
cur2the current node
Returns

◆ RenameAttribute()

static void Ict.Common.IO.TXMLParser.RenameAttribute ( XmlNode  cur,
string  AAttribOldName,
string  AAttribNewName 
)
inlinestaticinherited

rename an existing attribute

Parameters
cur
AAttribOldName
AAttribNewName

◆ SetAttribute()

static void Ict.Common.IO.TXMLParser.SetAttribute ( XmlNode  cur,
string  AAttribName,
string  AAttribValue 
)
inlinestaticinherited

add or set an attribute value

Parameters
cur
AAttribName
AAttribValue

◆ XmlToString()

static string Ict.Common.IO.TXMLParser.XmlToString ( XmlDocument  ADoc)
inlinestaticinherited

print an xml document to string; this can be necessary for transmitting between server and client, since XmlDocument is not serializable

Parameters
ADoc
Returns

◆ XmlToString2()

static string Ict.Common.IO.TXMLParser.XmlToString2 ( XmlDocument  ADoc)
inlinestaticinherited

this is necessary to be able to store XML files that can be parsed by DTD/Schema mechanisms; for YML, we have the name of an element not as an attribute, but the element name itself; this would never work for validating xml; therefore all Elements are called XmlElement, with attribute name

Parameters
ADoc
Returns

◆ XmlToStringIndented()

static string Ict.Common.IO.TXMLParser.XmlToStringIndented ( XmlDocument  ADoc)
inlinestaticinherited

print an xml document to string with indentation

Parameters
ADoc
Returns

Member Data Documentation

◆ myDoc

XmlDocument Ict.Common.IO.TXMLParser.myDoc
protectedinherited

the XmlDocument that is currently parsed

◆ SupportPetra2xLegacyStandard

bool Ict.Tools.DBXML.TDataDefinitionParser.SupportPetra2xLegacyStandard = false

if this is set to true, primary key fields with NULL will be allowed. otherwise the DumpPetra2x does not work.


The documentation for this class was generated from the following file: