4D v16.3

SAX GET XML ELEMENT

Home

 
4D v16.3
SAX GET XML ELEMENT

SAX GET XML ELEMENT 


 

SAX GET XML ELEMENT ( document ; name ; prefix ; attrNames ; attrValues ) 
Parameter Type   Description
document  DocRef in Reference of open document
name  String in Element name
prefix  String in Namespace
attrNames  String array in Attribute names
attrValues  String array in Attribute values

The SAX GET XML ELEMENT command returns various information about the element name that is present in the XML document reference in the document parameter. This command must be called with the XML Start Element or XML End Element SAX events. In the specific case of XML End Element, the attribute parameters are not handled. For more information about SAX events, refer to the description of the SAX Get XML node command.

The name parameter contains the name of the element.

The prefix parameter returns the namespace of the element. This parameter is empty if no namespace is linked to the element.

The command fills the attrNames array with the names of attributes of the target element. If necessary, the command creates and sizes the array automatically.

The command also fills the attrValues array with the values of attributes of the target element. If necessary, the command creates and sizes the array automatically.

Example  

Let's look at the following piece of XML code:

 <RootElement>
 <Child Att1="111"Att2="222"Att3="333">MyText</Child>
 </RootElement>

Once the following statement has been executed:

 SAX GET XML ELEMENT(DocRef;vName;vPrefix;tAttrNames;tAttrValues)

...vName will contain “Child”
vPrefix will contain “”
tAttrNames{1} will contain “Att1”, tAttrNames{2} will contain “Att2”, tAttrNames{3} will contain “Att3”
tAttrValues{1} will contain “111”, tAttrValues{2} will contain “222”, tAttrValues{3} will contain “333”

If the command has been executed correctly, the system variable OK is set to 1. Otherwise, it is set to 0 and an error is generated.



See also 

SAX Get XML node

 
PROPERTIES 

Product: 4D
Theme: XML SAX
Number: 876

The OK variable is changed by the commandThis command can be run in preemptive processes

 
HISTORY 

Created: 4D 2004

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)