PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Special cases
  • Code wizard
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Returns the value of an XML element or the value of the attribute for an XML element.
Versions 15 and later
PHP This function is now available for the PHP sites.
New in version 15
PHP This function is now available for the PHP sites.
PHP This function is now available for the PHP sites.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 18 and later
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Universal Windows 10 App This function is now available in Windows Store apps mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Example
MyDoc is string = fLoadText("example.xml")
XMLDocument("DOM", MyDoc)
sFunctionName is string = XMLRead("DOM","/Example/Help/Function")
sFunctionType is string = XMLRead("DOM","Help/Function/@type")
sFunctionName2 is string = XMLRead("DOM","Help/Function[2]")
sImage is string = XMLRead("DOM","Help[2]/@image")
sImageType is string = XMLRead("DOM","/Example/Help[@image=""line.jpg""]/@format", "NotDefined")
XMLClose("DOM")
// Applies to the next XML document:
// <Example>
// <Help>
// <Function type="1">Read</Function>
// <Function>Write</Function>
// </Help>
// <Image help="line.jpg" format="jpg" />
// </Example>
Syntax
<Result> = XMLRead(<Name of XML Document> , <Path of Element to Read> [, <Not Found>])
<Result>: Character string
  • Value of element or value of attribute,
  • Empty string ("") or value of <Not Found> parameter in the following cases:
    • if the element was not found.
    • if the element has no value
    • if the XPath query is not a query for selecting records.
      In this case, the ErrorOccurred variable is set to True and ErrorInfo returns more details about the error.
<Name of XML Document>: Character string (with quotes)
Name of XML document where the reading will be performed. This document contains the XML code to study and it was created by XMLDocument.
<Path of Element to Read>: Character string (with quotes)
Can correspond to:
  • the path of the value to read in the XML file. Caution: the case is taken into account (lowercase and uppercase characters). To read the value of an attribute, the name of the attribute must be preceded by the "@" character.
  • the text of an XPath query to run. The XPath query must be a query for "selecting records". If several elements match the selection, the first element found is used.
If this path does not start with "/", the name of the root node is automatically added. If the XML document has no root, <Result> corresponds to <Not Found>.
<Not Found>: Optional character string (with quotes)
Text to return if the element was not found. This parameter corresponds to an empty string ("") by default.
Remarks

Special cases

  • XMLRead does not modify the current position in the document.
  • Several XML browse queries cannot be nested.
  • XMLRead must not be used with an XMLDocument variable. To read the content of an XMLDocument variable, use the "FOR EACH" syntax.
WINDEVWEBDEV - Server codeWINDEV Mobile

Code wizard

The code editor proposes a code wizard used to generate the code of XMLRead. To use it, type "XMLRead(" in the code editor and select "Wizard for XMLRead".
Components
WINDEVWEBDEV - Server codeReports and Queries wd230xml.dll
Windows Mobile wp230xml.dll
Linux wd230xml.so
Minimum required version
  • Version 12
This page is also available for…
Comments
LER ITEM XML
PROCEDURE ler_danfe_itens_impostos_xml()
documento is string = EDT_Xml_nfe
xml_nfe is a xmlDocument
xml_nfe=XMLOpen(documento,fromString)
det is xmlNode
_sequencia is int=0
FOR EACH det OF xml_nfe.nfeProc.NFe.infNFe on det
TableAddLine(TABLE_itens) // Adicionando a tabela
n_ocorrencia is int= TABLE_itens..Occurrence //vou ter o numero atual linha tabela
_sequencia++
TABLE_itens.COL_01_sequencia[n_ocorrencia]=_sequencia
TABLE_itens.COL_02_id_nota_fiscal_iten[n_ocorrencia]=0
TABLE_itens.COL_03_cProd[n_ocorrencia]=det.prod.cProd
TABLE_itens.COL_04_cEAN[n_ocorrencia]=det.prod.cEAN
TABLE_itens.COL_18_ICMS_ICMSSN_orig[n_ocorrencia]=det.imposto.ICMS..ChildNode[1].orig
TABLE_itens.COL_19_ICMS_ICMSSN_CST_CSOSN[n_ocorrencia]=det.imposto.ICMS..ChildNode[1].CST

END
//=================================

AULA 1307 WINDEV XML 017 - LER ITENS NOTA NFE

http://windevdesenvolvimento.blogspot.com.br/2017/12/aula-1307-windev-xml-017-ler-itens-nota.html

https://www.yout
De matos
Dec. 15 2017
PEGAR ITEN XML
LOOP
n_contador++
//mdfeProc/MDFe/infMDFe/infDoc/infMunDescarga/infNFe[1]/chNFe
//mdfeProc/MDFe/infMDFe/infDoc/infMunDescarga/infNFe[2]/chNFe
s_chNFe is string=XMLRead("XML","/mdfeProc/MDFe/infMDFe/infDoc/infMunDescarga/infNFe["+n_contador+"]/chNFe")

IF s_chNFe="" THEN
BREAK
ELSE
s_infDoc_chNFe+="CT-E "+s_chNFe+CR
END

END

// NESSE BLOG E VIDEO MOSTRO COMO PEGAR ITEN XML

http://windevdesenvolvimento.blogspot.com.br/2017/09/aula-1256-xml-016-itens-xml.html

https://www.youtube.com/watch?v=IqsKTY64ZO4

De matos
Sep. 06 2017
PEGAR ID NOTA XML
XMLDocument("XML",pXML)
XMLFind("XML",Null,XMLContinue+XMLChildItem)
s_ide_id_nota is string=XMLRead("XML","/mdfeProc/MDFe/infMDFe/@Id")
// VAI RETORNAR => MDFe43170800397887000101580010000000731000001825
s_ide_cUF is string=XMLRead("XML","/mdfeProc/MDFe/infMDFe/ide/cUF")
// VAI RETORNAR => 43
XMLClose("xml")

// BLOG COM VIDEO E EXEMPLO
http://windevdesenvolvimento.blogspot.com/2017/09/aula-1253-xml-013-ler.html

https://www.youtube.com/watch?v=MQ8M3kg43gI



De matos
Sep. 02 2017