C# Class DevUtils.Xml.XmlUtils

The XmlUtils type provides an implementation of the IXmlUtils interface that provides utility methods for common XML operations.

Base project reference: https://github.com/cjaehnen/OpenLib.Utils

Inheritance: IXmlUtils
Exibir arquivo Open project: jornfilho/.net-Dev-Utils

Private Properties

Property Type Description

Public Methods

Method Description
CreateDocument ( string path, string fileName, string xml, string xsd, string ns ) : bool

Create a XML document

GetElement ( string path, string element, System.Xml.Linq.XNamespace ns ) : string

Gets the value of the specified XML element from the specified XML file.

UpdateElement ( string path, string element, string value, System.Xml.Linq.XNamespace ns ) : bool

Updates the specified XML element with a value for the specified XML file.

ValidateDocument ( string xml, string xsd, string ns ) : bool

Validates if the specified XML document conforms to the specified XSD schema containing the specified namespace.

XmlUtils ( ) : System

Creates a new instance of the XmlUtils class.

XmlUtils ( IIoDirectoryUtils ioDirectoryUtils ) : System

Creates a new instance of the XmlUtils class.

XmlUtils ( IIoDirectoryUtils ioDirectoryUtils, IIoFileUtils ioFileUtils ) : System

Creates a new instance of the XmlUtils class.

XmlUtils ( IIoFileUtils ioFileUtils ) : System

Creates a new instance of the XmlUtils class.

Method Details

CreateDocument() public method

Create a XML document
public CreateDocument ( string path, string fileName, string xml, string xsd, string ns ) : bool
path string The path to the file.
fileName string The file name.
xml string The XML document as a string to validate.
xsd string The XSD schema as a string used for validation.
ns string The target namespace.
return bool

GetElement() public method

Gets the value of the specified XML element from the specified XML file.
public GetElement ( string path, string element, System.Xml.Linq.XNamespace ns ) : string
path string The path to the file.
element string The name of the XML element.
ns System.Xml.Linq.XNamespace An optional namespace for the XML element. (Set null to ignore)
return string

UpdateElement() public method

Updates the specified XML element with a value for the specified XML file.
public UpdateElement ( string path, string element, string value, System.Xml.Linq.XNamespace ns ) : bool
path string The path to the file.
element string The name of the XML element.
value string The value to update for the XML element.
ns System.Xml.Linq.XNamespace An optional namespace for the XML element. (Set null to ignore)
return bool

ValidateDocument() public method

Validates if the specified XML document conforms to the specified XSD schema containing the specified namespace.
public ValidateDocument ( string xml, string xsd, string ns ) : bool
xml string The XML document as a string to validate.
xsd string The XSD schema as a string used for validation.
ns string The target namespace.
return bool

XmlUtils() public method

Creates a new instance of the XmlUtils class.
public XmlUtils ( ) : System
return System

XmlUtils() public method

Creates a new instance of the XmlUtils class.
public XmlUtils ( IIoDirectoryUtils ioDirectoryUtils ) : System
ioDirectoryUtils IIoDirectoryUtils A reference to the IIoDirectoryUtils for performing I/O directory operations.
return System

XmlUtils() public method

Creates a new instance of the XmlUtils class.
public XmlUtils ( IIoDirectoryUtils ioDirectoryUtils, IIoFileUtils ioFileUtils ) : System
ioDirectoryUtils IIoDirectoryUtils A reference to the IIoDirectoryUtils for performing I/O directory operations.
ioFileUtils IIoFileUtils A reference to the IIoFileUtils for performing I/O file operations.
return System

XmlUtils() public method

Creates a new instance of the XmlUtils class.
public XmlUtils ( IIoFileUtils ioFileUtils ) : System
ioFileUtils IIoFileUtils A reference to the IIoFileUtils for performing I/O file operations.
return System