Class SepaObject
Abstract base class of all SEPA objects that can be read and written in XML format.
Inheritance
Inherited Members
Namespace: Subsembly.Sepa
Assembly: Subsembly.Sepa.dll
Syntax
public abstract class SepaObject
Constructors
SepaObject(String, Boolean)
Declaration
public SepaObject(string sTagName, bool fIsMandatory)
Parameters
Type | Name | Description |
---|---|---|
System.String | sTagName | The local name of the XML element tag that represents this object. |
System.Boolean | fIsMandatory | If the XML element represented by this object is mandatory within its XML parent
element, then this must be |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The parameter |
System.ArgumentException | The parameter |
Properties
IsEmpty
Checks whether this object, and all its child objects, are completely empty, such that it won't write anything.
Declaration
public abstract bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsMandatory
Indicates whether the XML element represented by this object is mandatory within its XML parent element
Declaration
public bool IsMandatory { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsValid
Indicates whether all properties of this SEPA object and all child SEPA objects are correctly set up.
Declaration
public bool IsValid { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
See Also
TagName
The local name of the XML tag that represents this object.
Declaration
public string TagName { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
Clear()
Clear the current content and the content of all childs of this SEPA object.
Declaration
public abstract void Clear()
OnAfterXmlRead(SepaMessageInfo)
Called after an xml object has been completely read. This is the perfect location to do some additional logical checks.
Declaration
protected virtual void OnAfterXmlRead(SepaMessageInfo aMessageInfo)
Parameters
Type | Name | Description |
---|---|---|
SepaMessageInfo | aMessageInfo |
OnReadObjectXml(XmlReader, SepaMessageInfo, String)
May be overridden instead of OnReadXml(XmlReader, SepaMessageInfo) in order to take over
complete control over how this object is read from the
aXmlReader
.
Declaration
protected virtual bool OnReadObjectXml(XmlReader aXmlReader, SepaMessageInfo aMessageInfo, string sTagName)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlReader | aXmlReader | |
SepaMessageInfo | aMessageInfo | |
System.String | sTagName | The object shall be read using this XML tag, instead of TagName. |
Returns
Type | Description |
---|---|
System.Boolean | If the object was successfully read from the |
Remarks
If this is overridden, then OnWriteObjectXml(XmlWriter, SepaMessageInfo, String) must be overridden, too. In addition, OnWriteXml(XmlWriter, SepaMessageInfo) and OnReadXml(XmlReader, SepaMessageInfo) must be overridden with an usually empty implementation.
The default implementation tries to read the opening sTagName
,
then, if such tag was read, calls OnReadXml(XmlReader, SepaMessageInfo) and finally reads the
closing tag.
OnReadXml(XmlReader, SepaMessageInfo)
Must be overridden in order to read the content and childs of this SEPA object.
Declaration
protected abstract void OnReadXml(XmlReader aXmlReader, SepaMessageInfo aMessageInfo)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlReader | aXmlReader | |
SepaMessageInfo | aMessageInfo |
Remarks
Before this method is called, the method Clear() was called. Only if the appropriate XML element tag was read, then this method is invoked to read the content of the element. The implementation shall not read the ending element tag. This is not invoked for empty elements.
OnValidate(ICollection<SepaException>, String)
Override this in order to validate this SEPA object and all its child objects.
Declaration
protected abstract void OnValidate(ICollection<SepaException> vErrors, string sPath)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.ICollection<SepaException> | vErrors | Container that receives all diagnostic output from validation. For each error found, an implementation shall create a SepaException and add it to this container. |
System.String | sPath | The complete path from the SEPA document root to this object, including the
TagName of this object as the last part of the path. This path
shall be used for any SepaException objects added to the
|
Remarks
This is called from Validate(ICollection<SepaException>, String) only, if this object is not IsEmpty.
OnWriteObjectXml(XmlWriter, SepaMessageInfo, String)
May be overridden instead of OnWriteXml(XmlWriter, SepaMessageInfo) in order to take over
complete control over how this object is written to the
aXmlWriter
.
Declaration
protected virtual void OnWriteObjectXml(XmlWriter aXmlWriter, SepaMessageInfo aMessageInfo, string sTagName)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlWriter | aXmlWriter | |
SepaMessageInfo | aMessageInfo | |
System.String | sTagName | The object shall be written using this XML tag, instead of TagName. |
Remarks
If this is overridden, then OnReadObjectXml(XmlReader, SepaMessageInfo, String) must be overridden, too. In addition, OnWriteXml(XmlWriter, SepaMessageInfo) and OnReadXml(XmlReader, SepaMessageInfo) must be overridden with an usually empty implementation.
The default implementation writes the opening sTagName
, calls
OnWriteXml(XmlWriter, SepaMessageInfo) and then writes the closing tag.
OnWriteXml(XmlWriter, SepaMessageInfo)
Must be overrieden in order to write the content and childs of this SEPA object.
Declaration
protected abstract void OnWriteXml(XmlWriter aXmlWriter, SepaMessageInfo aMessageInfo)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlWriter | aXmlWriter | |
SepaMessageInfo | aMessageInfo |
Remarks
This is only called, when this object is IsMandatory or is not IsEmpty.
ReadXml(XmlReader, SepaMessageInfo)
Reads this SEPA object, if it is present.
Declaration
public void ReadXml(XmlReader aXmlReader, SepaMessageInfo aMessageInfo)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlReader | aXmlReader | |
SepaMessageInfo | aMessageInfo |
Remarks
If the XML reader is not at a TagName starting tag, then nothing will be read. Still, Clear() and OnAfterXmlRead(SepaMessageInfo) will be called.
ReadXml(XmlReader, SepaMessageInfo, String)
Reads this SEPA object, if it is present.
Declaration
public void ReadXml(XmlReader aXmlReader, SepaMessageInfo aMessageInfo, string sTagName)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlReader | aXmlReader | |
SepaMessageInfo | aMessageInfo | |
System.String | sTagName | XML tag name that is expected for the object. This overrides the TagName, which would otherwise be expected. |
Remarks
If the XML reader is not at a sTagName
starting tag, then
nothing will be read. Still, Clear() and OnAfterXmlRead(SepaMessageInfo)
will be called.
Validate(ICollection<SepaException>, String)
Validate this SEPA object and all its child objects without throwing an exception.
Declaration
public void Validate(ICollection<SepaException> vErrors, string sPath)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.ICollection<SepaException> | vErrors | Container that receives all diagnostic output from validation. For each error found, a SepaException is created and added to this container. |
System.String | sPath | The complete path from the SEPA document root to this object, including the
TagName of this object as the last part of the path. This path
shall be used for any SepaException objects added to the
|
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The parameter |
WriteXml(XmlWriter, SepaMessageInfo)
Declaration
public void WriteXml(XmlWriter aXmlWriter, SepaMessageInfo aMessageInfo)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlWriter | aXmlWriter | |
SepaMessageInfo | aMessageInfo |
Remarks
This will only write this element when it is mandatory OR it is not empty.
WriteXml(XmlWriter, SepaMessageInfo, String)
Declaration
public void WriteXml(XmlWriter aXmlWriter, SepaMessageInfo aMessageInfo, string sTagName)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlWriter | aXmlWriter | |
SepaMessageInfo | aMessageInfo | |
System.String | sTagName |