Ver Mensaje Individual
  #9 (permalink)  
Antiguo 07/04/2014, 21:04
wwwmaster
 
Fecha de Ingreso: noviembre-2002
Ubicación: DF
Mensajes: 1.056
Antigüedad: 21 años, 5 meses
Puntos: 37
Respuesta: Crear XML para factura electronica

Public xmlnsxsi As String
Public xsischemaLocation As String



Dim atributo_schemaLocation As XmlAttribute = Doc.CreateAttribute("xsi:schemaLocation", "http://www.w3.org/2001/XMLSchema-instance")

atributo_schemaLocation.Value = "http://www.sat.gob.mx/cfd/3 http://www.sat.gob.mx/sitio_internet/cfd/3/cfdv32.xsd http://www.sat.gob.mx/implocal http://www.sat.gob.mx/sitio_internet/cfd/implocal/implocal.xsd"

NdCom.Attributes.Append(atributo_schemaLocation)


o con:
agregaAtributo("S", "C", Doc, NdCom, "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance")

Private Sub agregaAtributo(ByVal obligatorio As String, ByVal tipo As String, ByRef ccxml As XmlDocument, ByRef nodo As XmlNode, ByVal atributo As String, ByVal valor As String)
'RUTINA PARA AGREGAR ATRIBUTOS AL XML, LLAMA A SU VEZ A OTRAS 2 FUNCIONES
' la ultima variable indicador viene mayormente en blanco (quitar para version ASP)
log("cComprobante.agregaAtributo obligatorio=" & obligatorio & " tipo=" & tipo & " atributo=" & atributo & " valor=" & valor)
Dim nTemporal As XmlAttribute
If tipo = "$" Then valor = String.Format("{0:0.00}", Convert.ToDouble(valor))

valor = quitarCaracteresInvalidos(valor)
If (agregar(obligatorio, tipo, valor)) = "SI" Then

nTemporal = ccxml.CreateAttribute(atributo)
nTemporal.Value = valor
nodo.Attributes.Append(nTemporal)
End If
End Sub