General information
Title:
Consulta sobre nodo
Environment versions
Network:
Windows 2003 Server
![Click here to see this attachment](Images/AttachmentXML.gif)
Muy Buenas Tardes.
Muchas gracias de antemano
Tengo el archivo XML
adjunto la imagen del xml
Quisiera que me ayudaran en ¿Como seria la programación para poder capturar los valores de cada elementos?
CodigoArticulo = CON-F105SIX
TotalArticulo = 1.00000
CodigoArticulo = CON-CFEA742-0/0
TotalArticulos = 1.00000
CodigoArticulo = CON-EF2401
TotalArticulos =1.00000
Mi programación es la siguiente:
PUBLIC oDocDep
oDocDep=Getfile("XML","Seleccione:","Abrir",0,"Archivos .XML")
IF NOT Cargar_oDOM(oDocDep)
RETURN .f.
ENDIF
Procedure Cargar_oDOM
Lparameter oDoc As MSXML3.DOMDocument.4.0
IF !EMPTY(oDoc)
oDocumento = CREATEOBJECT("MSXML2.DOMDocument.4.0")
lcXML=Filetostr(oDocDep)
oDocumento.Load(oDocDep)
oDocumento.validateOnParse = .F.
oDocumento.Async = .F.
IF oDocumento.ParseError.ErrorCode (diferente) 0
Texto = [Hubo un error en el documento:] + CHR(13) ;
+ [ Linea: ] + TRANSFORM(oDocumento.parseError.Line) + CHR(13) ;
+ [Posición: ] + TRANSFORM(oDocumento.parseError.LinePos) + CHR(13) ;
+ [ razón: ] + TRANSFORM(oDocumento.parseError.Reason)
=MESSAGEBOX( Texto, 16, [Error leyendo XML] )
oDocumento = NULL
RELEASE oDocumento
ELSE
olNodes = oDocumento.selectNodes("//"+"Articulos")
IF olNodes.LENGTH menor= 0 THEN
=MESSAGEBOX("Comprobante inválido. Nodo 'Articulos' no presente.",16,business_loc)
RETURN .F.
ENDIF
ENDIF
ELSE
=MESSAGEBOX("No ha indicado un archivo XML válido",64,business_loc)
RETURN .F.
ENDIF
ENDPROC
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only