PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Reminder: XML language
  • XML functions and threads
  • Limit
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
XMLDocument (Function)
In french: XMLDocument
Creates a new XML document. This document can be:
  • an empty document. It can be filled by XMLAddAttribute, XMLAddChild, ...
  • a document containing the XML code that will be used by the XML functions of WLanguage. This code can come from a file in XML format or from a Webservice. The current element automatically corresponds to the root tag (the root is not created if it does not exist). This document can be closed by XMLClose.
Note: XMLDocument does not handle a file but an XML code.
Versions 15 and later
Android This function is now available for Android applications.
New in version 15
Android This function is now available for Android applications.
Android This function is now available for Android applications.
Versions 17 and later
iPhone/iPad This function is now available for iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for iPhone/iPad applications.
iPhone/iPad This function is now available for iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget 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.
XMLSource is string
Res is boolean
// Create the XML document
Res = XMLDocument("XMLDoc", XMLSource)
// Was the document created?
IF Res = False THEN
Error("The document was not created.")
ELSE
Info("The document was successfully created. It is ready to be used.")
END
// Modify the document
...
Windows MobileUniversal Windows 10 App
XMLSource is string
Res is boolean
// Load the XML content
XMLSource = fLoadText("C:\Temp\example.xml")
// Create the XML document
Res = XMLDocument("XMLDoc", XMLSource)
// Was the document created?
IF Res = False THEN
Error("The following problem was detected: " + ErrorInfo())
ELSE
Info("The document was successfully created. It is ready to be used.")
END
// Modify the document
...
// Rebuild the XML string
XMLSource = XMLBuildString("XMLDoc")
// Save the XML document in a file
fSaveText("C:\Temp\ModifiedExample.xml", XMLSource)
Syntax
<Result> = XMLDocument(<XML document> [, <XML code> [, <Option>]])
<Result>: Boolean
  • True if the XML document is created,
  • False otherwise. If an error occurs:
    • the current position remains unchanged.
    • the ErrorOccurred variable is set to True. To find out the error details, use ErrorInfo.
<XML document>: Character string with quotes
Name given to the XML document. This name will be used by all the XML functions.
<XML code>: Optional character string (with quotes)
XML code that will be analyzed by the XML functions. If this parameter is not specified, a new empty XML document is created.
Caution:
  • If the encoding of the document is not specified in the XML header, the encoding used is "UTF-8".
  • To specify a different encoding, the "encoding" attribute must be added to the XML tag.
    For example: <?xml version="1.0" encoding="UCS-2"?>
AndroidAndroid Widget To create an empty XML document, this parameter must correspond to an empty string ("").
<Option>: Optional constant
Type of the created XML document (no option is selected by default):
Versions 16 and later
xdHTML
New in version 16
xdHTML
xdHTML
XHTML document. This constant is used to optimize the operating mode of XMLBuildString. The document is processed by using the XHTML mode.
xHTMLHTML document.
Versions 16 and later
Caution: This constant is not available anymore. Indeed, the operating mode of this constant was not optimized: the document was handled by using the XML format then, in case of failure, it was handled by using the XHTML format.
New in version 16
Caution: This constant is not available anymore. Indeed, the operating mode of this constant was not optimized: the document was handled by using the XML format then, in case of failure, it was handled by using the XHTML format.
Caution: This constant is not available anymore. Indeed, the operating mode of this constant was not optimized: the document was handled by using the XML format then, in case of failure, it was handled by using the XHTML format.
AndroidAndroid Widget This parameter is ignored.
Remarks

Reminder: XML language

XML is a language containing tags and attributes (called "elements" in this help). The structure of an XML code corresponds to a tree structure: the information is organized hierarchically.
The following terms are used to describe the different parts of an XML code:

XML functions and threads

If your application uses threads, the XML document is shared between all these threads. See Managing threads for more details.

Limit

XMLDocument is suitable for loading XML documents whose size of text nodes does not exceed 9 MB. To handle documents with a greater size of nodes, you must use the XMLDocument type.
Component : wd240xml.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
ler itens 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
15 Dec. 2017