Public Function cleanXmlns(ByVal str As String) As String
Dim root As XElement = XElement.Parse(str)
root.DescendantsAndSelf.Attributes.Where(Function(x) x.IsNamespaceDeclaration).Remove()
For Each el As XElement In root.DescendantsAndSelf()
el.Name = el.Name.LocalName
Next
Return root.ToString
End Function
martes, 25 de septiembre de 2018
viernes, 21 de septiembre de 2018
Existe registro en una tabla
jueves, 13 de septiembre de 2018
Encoding e Indentar xml
Dim xml_test As New XmlDocument
xml_test.LoadXml(xml)
Dim setting As New XmlWriterSettings
setting.Indent = True
setting.Encoding = System.Text.Encoding.GetEncoding("ISO-8859-1")
Dim out As XmlWriter = XmlWriter.Create("archivo.xml", setting)
xml_test.Save(out)
out.Close()
xml_test.LoadXml(xml)
Dim setting As New XmlWriterSettings
setting.Indent = True
setting.Encoding = System.Text.Encoding.GetEncoding("ISO-8859-1")
Dim out As XmlWriter = XmlWriter.Create("archivo.xml", setting)
xml_test.Save(out)
out.Close()
miércoles, 12 de septiembre de 2018
Leer un archivo xml en una sola línea
Dim xml As String = File.ReadAllText("archivo.xml")
viernes, 7 de septiembre de 2018
String cabecera xml
Dim header As String = "<?xml version=""1.0"" encoding=""UTF-8""?>"
Dim ISO8859 As String = "<?xml version=""1.0"" encoding=""ISO-8859-1""?>"
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim nombre_xml As String = "archivo.xml"
'Dim root As String = "<DATA></DATA>"
Dim xml As New XmlDocument
Dim node As XmlNode = xml.CreateXmlDeclaration("1.0", "UTF-8", Nothing)
xml.InnerXml = node.OuterXml & "<data><conex></conex><creacion>" & Now.ToString("yyyy-MM-ddTHH:mm:ss") & "</creacion><actualizacion></actualizacion></data>"
Dim settings As New XmlWriterSettings
settings.Indent = True
Dim out As XmlWriter = XmlWriter.Create(nombre_xml, settings)
xml.Save(out)
out.Close()
'xml.Save(nombre_xml)
MessageBox.Show("fin!")
End Sub
Dim ISO8859 As String = "<?xml version=""1.0"" encoding=""ISO-8859-1""?>"
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim nombre_xml As String = "archivo.xml"
'Dim root As String = "<DATA></DATA>"
Dim xml As New XmlDocument
Dim node As XmlNode = xml.CreateXmlDeclaration("1.0", "UTF-8", Nothing)
xml.InnerXml = node.OuterXml & "<data><conex></conex><creacion>" & Now.ToString("yyyy-MM-ddTHH:mm:ss") & "</creacion><actualizacion></actualizacion></data>"
Dim settings As New XmlWriterSettings
settings.Indent = True
Dim out As XmlWriter = XmlWriter.Create(nombre_xml, settings)
xml.Save(out)
out.Close()
'xml.Save(nombre_xml)
MessageBox.Show("fin!")
End Sub
Crear archivo xml
Dim nombre_xml As String = "archivo.xml"
Dim xml As New XmlDocument
Dim node As XmlNode = xml.CreateXmlDeclaration("1.0", "UTF-8", Nothing)
xml.InnerXml = node.OuterXml & "<DATA>hola</DATA>"
xml.Save(nombre_xml)
Dim xml As New XmlDocument
Dim node As XmlNode = xml.CreateXmlDeclaration("1.0", "UTF-8", Nothing)
xml.InnerXml = node.OuterXml & "<DATA>hola</DATA>"
xml.Save(nombre_xml)
jueves, 6 de septiembre de 2018
martes, 4 de septiembre de 2018
Ejemplo query en archivo xml con LIKE
SELECT * FROM tabla WHERE dte LIKE '%' + @dte AND folio LIKE '%' + @folio AND cliente=@rut
Suscribirse a:
Entradas (Atom)