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 sTagName was |
System.ArgumentException | The parameter sTagName was not a valid tag name. |
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()
Remarks
This is an abstract method declaration only and must be overridden in a derived class.
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 |
OnReadXml(XmlReader, SepaMessageInfo)
Reads this SEPA object.
Declaration
protected abstract void OnReadXml(XmlReader aXmlReader, SepaMessageInfo aMessageInfo)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlReader | aXmlReader | |
SepaMessageInfo | aMessageInfo |
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 | |
System.String | sPath |
Remarks
This is called from Validate(ICollection<SepaException>, String) only, if this object is not IsEmpty.
OnWriteXml(XmlWriter, SepaMessageInfo)
Must be overriden in order to write the content and childs of a SEPA object.
Declaration
protected abstract void OnWriteXml(XmlWriter aXmlWriter, SepaMessageInfo aMessageInfo)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlWriter | aXmlWriter | |
SepaMessageInfo | aMessageInfo |
ReadXml(XmlReader, SepaMessageInfo)
Reads this SEPA object, if it is present.
Declaration
public virtual 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, 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
|
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The parameter |
WriteXml(XmlWriter, SepaMessageInfo)
Declaration
public virtual 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 |