OpenPetra
Free Administration Software for Non-Profits
|
TSimpleYmlParser is mainly used for restoring a database saved as yml.gz; avoids loading a huge XmlDocument with all tables at once. for smaller files, the other implementation, TYml2Xml, is much easier to step through, since you get an XmlDocument More...
Public Member Functions | |
TSimpleYmlParser (string AFilename) | |
constructor More... | |
TSimpleYmlParser (string[] ALines) | |
constructor More... | |
void | ParseCaptions () |
parse all captions, ie nodes that do not have attributes, but children More... | |
bool | StartParseList (string ACaption) |
parse a list of simple rows, with their attributes More... | |
SortedList< string, string > | GetNextLineAttributes () |
get the attributes of the next row More... | |
XmlDocument | ParseYML2XML () |
loads an yml document into one xml document More... | |
XmlDocument | ParseYML2XML (XmlDocument AMergeDoc, int ADepth) |
merges several yml documents into one xml document, and maintains their inheritance hierarchy for nodes that have the same name More... | |
XmlNode | ParseYML2TaskListRoot () |
loads an yml document into one xml document; then returns only the part meant to be passed directly to a TaskList constructor as the TaskList root. More... | |
Static Public Member Functions | |
static string | GetElementName (XmlNode ANode) |
return either the name from the attribute, or the element name More... | |
static bool | CheckName (string AElementName) |
check if the name can be used as an element name for XML More... | |
static string | Xml2YmlGz (XmlDocument ADoc) |
format the XML into zipped YML and return as Base64 string More... | |
static string | Xml2Yml (XmlDocument ADoc) |
format the XML into YML and return as string More... | |
static bool | Xml2Yml (XmlDocument ADoc, string AOutYMLFile) |
format the XML into YML to increase readability and save to file More... | |
static bool | ReadHeader (string AFilename, out string baseYamlOrClass) |
This method can be used to check if this is the correct file type, and also find out the baseyaml or baseclass More... | |
static SortedList | ReferenceNodes (XmlDocument myDoc) |
fill sorted list which contains a reference to each node by name More... | |
static XmlDocument | CreateXmlDocument () |
create an empty xml document, which will be filled with the data from the yaml file More... | |
static bool | Merge (ref XmlDocument AMergeDoc, XmlDocument ANewDoc, int ADepth) |
merge the specificDoc into the mergeDoc. merges 2 xml documents, maintains their inheritance hierarchy for nodes that have the same name. allows caching of base yaml files. More... | |
static List< XmlNode > | GetChildren (XmlNode node, bool AConsiderBase) |
get all children nodes of a given node; depending on parameter, include the inherited nodes or not the nodes will be sorted by the order flag (AlwaysFirst, AlwaysLast) More... | |
static XmlNode | Parent (XmlNode node) |
get the parent node More... | |
static void | SetAttribute (XmlNode xmlNode, string name, string value) |
SetAttribute will never consider the base and the xml hierarchy; use Tag to move things to base. More... | |
static void | ClearAttribute (XmlNode xmlNode, string name) |
remove attribute More... | |
static bool | HasAttribute (XmlNode xmlNode, string name) |
check for the attribute; if the current node does not have it, check the base node More... | |
static string | GetAttribute (XmlNode xmlNode, string name) |
get the attribute; if the current node does not have it, check the base node More... | |
static string | GetAttributeRecursive (XmlNode xmlNode, string name) |
if the current node does not have the attribute, try the parent nodes More... | |
static bool | HasAttributeRecursive (XmlNode xmlNode, string name) |
if the current node does not have the attribute, try the parent nodes More... | |
static SortedList< string, string > | GetAttributes (XmlNode xmlNode) |
get all attributes, even from base node More... | |
static XmlNode | GetChild (XmlNode node, string childName) |
get the child node with the given name; considers base nodes as well More... | |
static StringCollection | GetElements (XmlNode node, string childName) |
overload for GetElements, with the main node and the name of the child node that has the elements More... | |
static StringCollection | GetElements (XmlNode node) |
static void | Tag (XmlNode ANode) |
Tag will move all leafs to a new child element called base a leaf is an XmlNode that has no children, only attributes all attributes are moved to base can only be called once todo: what about sequences More... | |
Static Public Attributes | |
const string | XMLLIST = "XmlList" |
the name used for elements in a list More... | |
const string | XMLELEMENT = "XmlElement" |
the name used for elements in generated xml code More... | |
const string | ROOTNODEINTERNAL = "RootNodeInternal" |
the name used for root node in generated xml code More... | |
Protected Member Functions | |
void | ThrowException (string AMessage, Int32 lineNr) |
throw an exception and tell the current position while reading the yaml file More... | |
Int32 | GetAbsoluteIndentation (Int32 lineNr) |
Int32 | GetAbsoluteIndentationNext (Int32 lineNr) |
Int32 | GetIndentationNext (Int32 lineNr) |
string | GetNextLine () |
does not return comment lines More... | |
bool | SplitNode (string line, out string nodeName, out string nodeContent) |
split a line into the node name and the node content More... | |
string | StripQuotes (string s) |
strip the quotes from a string More... | |
Static Protected Member Functions | |
static XmlNode | LoadChild (XmlNode parent, string nodeName, int ADepth) |
static XmlNode | GetBaseNode (XmlNode ANode) |
check if parent already has a base element More... | |
Protected Attributes | |
string[] | lines = null |
contains the lines of the yml document More... | |
Int32 | currentLine = -1 |
the current line that we are parsing More... | |
string | filename = "" |
the filename of the file that we are parsing More... | |
TSimpleYmlParser is mainly used for restoring a database saved as yml.gz; avoids loading a huge XmlDocument with all tables at once. for smaller files, the other implementation, TYml2Xml, is much easier to step through, since you get an XmlDocument
|
inline |
constructor
AFilename |
|
inline |
constructor
|
inlinestaticinherited |
check if the name can be used as an element name for XML
|
inlinestaticinherited |
remove attribute
xmlNode | |
name |
|
inlinestaticinherited |
create an empty xml document, which will be filled with the data from the yaml file
|
inlineprotectedinherited |
returns -1 for comments or invalid line numbers, otherwise the number of spaces throws exception if there is a tab in the indentation
|
inlineprotectedinherited |
|
inlinestaticinherited |
get the attribute; if the current node does not have it, check the base node
|
inlinestaticinherited |
if the current node does not have the attribute, try the parent nodes
|
inlinestaticinherited |
get all attributes, even from base node
xmlNode |
|
inlinestaticprotectedinherited |
check if parent already has a base element
|
inlinestaticinherited |
get the child node with the given name; considers base nodes as well
node | |
childName |
|
inlinestaticinherited |
get all children nodes of a given node; depending on parameter, include the inherited nodes or not the nodes will be sorted by the order flag (AlwaysFirst, AlwaysLast)
node | |
AConsiderBase | include the inherited nodes |
|
inlinestaticinherited |
return either the name from the attribute, or the element name
|
inlinestaticinherited |
convert elements of a sequence into a string collection checks for duplicates, and removes names with a tilde character ~ in front
|
inlinestaticinherited |
overload for GetElements, with the main node and the name of the child node that has the elements
node | |
childName |
|
inlineprotectedinherited |
|
inlineprotectedinherited |
does not return comment lines
|
inline |
get the attributes of the next row
|
inlinestaticinherited |
check for the attribute; if the current node does not have it, check the base node
|
inlinestaticinherited |
if the current node does not have the attribute, try the parent nodes
|
inlinestaticprotectedinherited |
TYml2Xml.LoadChild will either reuse an element, move an existing leaf from base to the main node, or create a new element
|
inlinestaticinherited |
merge the specificDoc into the mergeDoc. merges 2 xml documents, maintains their inheritance hierarchy for nodes that have the same name. allows caching of base yaml files.
|
inlinestaticinherited |
get the parent node
|
inline |
parse all captions, ie nodes that do not have attributes, but children
|
inlineinherited |
loads an yml document into one xml document; then returns only the part meant to be passed directly to a TaskList constructor as the TaskList root.
|
inlineinherited |
loads an yml document into one xml document
|
inlineinherited |
merges several yml documents into one xml document, and maintains their inheritance hierarchy for nodes that have the same name
AMergeDoc | |
ADepth |
|
inlinestaticinherited |
This method can be used to check if this is the correct file type, and also find out the baseyaml or baseclass
|
inlinestaticinherited |
fill sorted list which contains a reference to each node by name
|
inlinestaticinherited |
SetAttribute will never consider the base and the xml hierarchy; use Tag to move things to base.
|
inlineprotectedinherited |
split a line into the node name and the node content
|
inline |
parse a list of simple rows, with their attributes
ACaption |
|
inlineprotectedinherited |
strip the quotes from a string
|
inlinestaticinherited |
Tag will move all leafs to a new child element called base a leaf is an XmlNode that has no children, only attributes all attributes are moved to base can only be called once todo: what about sequences
ANode |
|
inlineprotectedinherited |
throw an exception and tell the current position while reading the yaml file
|
inlinestaticinherited |
format the XML into YML and return as string
|
inlinestaticinherited |
format the XML into YML to increase readability and save to file
|
inlinestaticinherited |
format the XML into zipped YML and return as Base64 string
|
protectedinherited |
the current line that we are parsing
|
protectedinherited |
the filename of the file that we are parsing
|
protectedinherited |
contains the lines of the yml document
|
staticinherited |
the name used for root node in generated xml code
|
staticinherited |
the name used for elements in generated xml code
|
staticinherited |
the name used for elements in a list