XmlSource<TOutput>
Class XmlSource<TOutput>
Reads data from a xml source. This can be any http resource or a file. By default, data is pulled via httpclient. Use the ResourceType property to read data from a file.
Inheritance
Inherited Members
Namespace: ETLBox.Xml
Assembly: ETLBox.Xml.dll
Syntax
public class XmlSource<TOutput> : DataFlowStreamSource<TOutput>, IDataFlowStreamSource<TOutput>, IDataFlowExecutableSource<TOutput>, IDataFlowSource<TOutput>, IDataFlowStreamSource, IDataFlowExecutableSource, IDataFlowSource, IDataFlowComponent, ILoggableTask
Type Parameters
Name | Description |
---|---|
TOutput |
Examples
XmlSource<POCO> source = new XmlSource<POCO>("https://test.com");
Constructors
XmlSource()
Declaration
public XmlSource()
XmlSource(string)
Declaration
public XmlSource(string uri)
Parameters
Type | Name | Description |
---|---|---|
string | uri | The source xml file name or uri |
XmlSource(string, ResourceType)
Declaration
public XmlSource(string uri, ResourceType resourceType)
Parameters
Type | Name | Description |
---|---|---|
string | uri | The source xml file name or uri |
ResourceType | resourceType | Specifies if data is loaded from a file, a web endpoint or other storage types (e.g. Azure Blob Storage) |
Properties
AttributePrefixForDynamic
The prefix used for XML attributes in dynamic objects. Default is "at_". This helps distinguish attributes from elements when parsing XML dynamically.
Declaration
public string AttributePrefixForDynamic { get; set; }
Property Value
Type | Description |
---|---|
string |
CollectUnparsedData
If set to true, unparsed XML data that is not mapped to the output type will be collected and stored in UnparsedData. Default is false.
Declaration
public override bool CollectUnparsedData { get; set; }
Property Value
Type | Description |
---|---|
bool |
Overrides
ElementName
The XML element name that contains an item of the data to be parsed. This setting applies only when reading dynamic objects. For POCOs, use XML attributes on the class instead.
Declaration
public string ElementName { get; set; }
Property Value
Type | Description |
---|---|
string |
Namespace
Optional: The namespace of the element specified in ElementName. This setting applies only when reading dynamic objects. For POCOs, use XML attributes on the class instead.
Declaration
public string Namespace { get; set; }
Property Value
Type | Description |
---|---|
string |
RetrieveElementFunc
Dynamically determines the ElementName during XML reading. This function is applied only for dynamic objects and overrides any existing ElementName and Namespace settings.
Declaration
public Func<StreamMetaData, bool> RetrieveElementFunc { get; set; }
Property Value
Type | Description |
---|---|
Func<StreamMetaData, bool> |
TextPrefixForDynamic
The prefix used for text values outside of XML elements in dynamic objects. Default is "tx_". This ensures text content is properly distinguished during parsing.
Declaration
public string TextPrefixForDynamic { get; set; }
Property Value
Type | Description |
---|---|
string |
XmlReaderSettings
The XmlReaderSettings used when creating the XmlReader. This controls how XML is read, such as whether whitespace is ignored. Default: XmlReaderSettings with IgnoreWhitespace set to true.
Declaration
public XmlReaderSettings XmlReaderSettings { get; set; }
Property Value
Type | Description |
---|---|
XmlReaderSettings |
XmlSerializer
The XmlSerializer used to deserialize XML into the specified data type.
Declaration
public XmlSerializer XmlSerializer { get; set; }
Property Value
Type | Description |
---|---|
XmlSerializer |
Methods
CheckParameter()
Declaration
protected override void CheckParameter()
Overrides
CloseReader()
Declaration
protected override void CloseReader()
Overrides
InitReader()
Declaration
protected override void InitReader()
Overrides
ReadAllRecords()
Declaration
protected override void ReadAllRecords()