PC SOFT

AYUDA EN LÍNEA
DE WINDEV, WEBDEV Y WINDEV MOBILE

  • Declaring an xmlNode variable
  • Properties specific to the description of xmlNode variables
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Otros
Procedimientos almacenados
The xmlNode type is used to handle a node of an XML document. The characteristics of this node can be defined and modified by several WLanguage properties.
This type of variable is used by:
Remark: See Declaring a variable for more details on the declaration of this type of variable and the use of WLanguage properties.
Versiones 17 y posteriores
iPhone/iPad This type of variable is now available for the iPhone/iPad applications.
WINDEVJava This type of variable is now available for Java applications.
Android This type of variable is now available for Android applications.
Android This type of variable is now available from Android version 2.2.
Nueva funcionalidad versión 17
iPhone/iPad This type of variable is now available for the iPhone/iPad applications.
WINDEVJava This type of variable is now available for Java applications.
Android This type of variable is now available for Android applications.
Android This type of variable is now available from Android version 2.2.
iPhone/iPad This type of variable is now available for the iPhone/iPad applications.
WINDEVJava This type of variable is now available for Java applications.
Android This type of variable is now available for Android applications.
Android This type of variable is now available from Android version 2.2.
Versiones 21 y posteriores
Universal Windows 10 App This type of variable is now available in Universal Windows 10 App mode.
Nueva funcionalidad versión 21
Universal Windows 10 App This type of variable is now available in Universal Windows 10 App mode.
Universal Windows 10 App This type of variable is now available in Universal Windows 10 App mode.
Ejemplo
MyXMLText is string = [
<?xml version="1.0"?>
<!DOCTYPE PLAY SYSTEM "play.dtd">
<PLAY>
<TITLE>The Tragedy of Romeo and Juliet</TITLE>
<ACT><TITLE>ACT I</TITLE>
<PROLOGUE><TITLE>PROLOGUE</TITLE></PROLOGUE>
<SCENE><TITLE>SCENE I.  Verona. A public place.</TITLE></SCENE>
</ACT>
<ACT><TITLE>ACT II</TITLE>

<PROLOGUE><TITLE>PROLOGUE</TITLE></PROLOGUE>
<SCENE><TITLE>SCENE I.  A lane by the wall of Capulet's orchard.</TITLE></SCENE>
</ACT>
<ACT><TITLE>ACT III</TITLE>

<PROLOGUE><TITLE>PROLOGUE</TITLE></PROLOGUE>
<SCENE><TITLE>SCENE I.  A public place.</TITLE></SCENE>
</ACT>
</PLAY>
]

// Load an XML document
RomeoAndJuliet is xmlDocument
RomeoAndJuliet = XMLOpen(MyXMLText, fromString)

// Display the title of acts
Act is xmlNode
FOR EACH Act OF RomeoAndJuliet.PLAY ON Act
Trace(Act.TITLE)
END
// Validation from the schema defined during the declaration
cMyNode is xmlNode, description="ProjectXSDSchema.RootNode"
// The variable can also be declared as follows:
// cMyNode is xmlNode <description="ProjectXSDSchema.RootNode">
cMyNode..Text = "21"
IF XMLValidNode(cMyNode) = False THEN
Error(ErrorInfo())
ELSE
Info("The XML node is valid")
END
Observaciones

Declaring an xmlNode variable

The xmlNode variables can be declared by specifying a template node (node in an XSD file). The structure of this document will be read by WINDEV and the automatic completion will be available for the names of nodes in the code editor.
To declare an xmlNode variable with a sample document:
  1. Add the XML or XSD document into the project.
  2. The XML or XSD document appears in the project browser, in the "XML descriptions" branch. You have the ability to see its structure.
  3. Declare the variable as follows:
    <Variable name> is xmlNode, description =  <Path of node in XSD document>
Remark: the syntax for node declaration can also be obtained by performing a "Drag and Drop" of the node into the project explorer.
The child nodes of the variable can now be directly accessed by their names. These names are automatically proposed by the mechanism for automatic completion of the code editor.

Properties specific to the description of xmlNode variables

The following properties can be used to handle an xmlNode variable:
NameType usedEffect
AttributeArray of xmlAttributeArray of XML attributes associated with the node.
ExistBoolean
  • True if the node exists,
  • False otherwise.
This property is used for example to check the existence of a specific child of a document node.
This property is available in read-only.
NamespacexmlNamespace variableXML namespace of node.
NamespaceDeclaredArray of xmlNamespaceArray of XML namespaces declared by the node.
ChildNodeArray of xmlNodeArray of child nodes.
NameUNICODE character stringName of node.
Android Caution: You cannot create elements (tag or attribute) with accented characters.
OccurrenceIntegerNumber of nodes of same level and with the same name in the XML document.
This property is available in read-only.
XMLSourceUNICODE character stringFragment of XML code corresponding to the node. This property also returns the XML code of the child nodes.
This property is available in read-only.
TextUNICODE character stringText found in the node.
TypeIntegerType of node. The possible types are as follows:
  • XMLTag (default value): Simple XML node that may contain children.
    For example:
    <NODE> <CHILDNODE> </CHILDNODE> </NODE>
  • XMLText: XML node containing text.
    For example:
    <NODE> Text </NODE>
  • XMLCDATA: XML node containing data that must be ignored by the XML analyzer.
    For example:
    <NODE><![CDATA[This data is not
    processed by the XML analyzer.]]>
    </NODE>
Remarks:
  • The type can be assigned once only. Then, the property is read-only.
  • If ..Name is assigned, the node will automatically be an XMLTag node.
  • If ..Text is assigned, the node will automatically be an XMLText node.
  • When assigning ..Text, all the child nodes whose type is XMLText and XMLCData are deleted.
Remark: These properties can be used with one of the following syntaxes:
  • <Variable name>..<Property name>
  • <Variable name>.<Property name>
AndroidJava Caution: The iteration order is not necessarily the order in which the attributes are declared in the document (in most cases, the attributes are listed in alphabetical order).
Versión mínima requerida
  • Versión 15
Esta página también está disponible para…
Comentarios
video ler itens xml
https://youtu.be/rxH5QnpbXXY
amarildo
25 11 2018
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
15 12 2017