first commit
This commit is contained in:
30
HelpersXml/XmlHelper.cs
Normal file
30
HelpersXml/XmlHelper.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace EFCDesk.HelpersXml
|
||||
{
|
||||
public static class XmlHelper
|
||||
{
|
||||
public static string Value(XElement? parent, XName elementName)
|
||||
=> parent?.Element(elementName)?.Value?.Trim() ?? string.Empty;
|
||||
|
||||
public static string Value(XElement? parent, string elementName)
|
||||
=> parent?.Element(elementName)?.Value?.Trim() ?? string.Empty;
|
||||
|
||||
public static decimal? Decimal(XElement parent, XName elementName)
|
||||
{
|
||||
var value = Value(parent, elementName);
|
||||
if (decimal.TryParse(value, out var result))
|
||||
return result;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<XElement> Elements(XElement? parent, XName elementName)
|
||||
=> parent?.Elements(elementName)?.ToList() ?? new List<XElement>();
|
||||
}
|
||||
}
|
||||
22
HelpersXml/XmlNamespaces.cs
Normal file
22
HelpersXml/XmlNamespaces.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace EFCDesk.HelpersXml
|
||||
{
|
||||
public sealed class XmlNamespaces
|
||||
{
|
||||
public readonly XNamespace S =
|
||||
"http://schemas.xmlsoap.org/soap/envelope/";
|
||||
|
||||
public readonly XNamespace ns2 =
|
||||
"http://www.ventanillaunica.gob.mx/pedimentos/ws/oxml/consultarpedimentocompleto";
|
||||
|
||||
public readonly XNamespace ns3 =
|
||||
"http://www.ventanillaunica.gob.mx/common/ws/oxml/respuesta";
|
||||
|
||||
public readonly XNamespace comunes =
|
||||
"http://www.ventanillaunica.gob.mx/pedimentos/ws/oxml/comunes";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user