ExtractXMLStructure()

Syntax

ExtractXMLStructure(Node, *Buffer, Structure [, Flags])
Description
Extract elements from the given XML node into the specified structure memory. The structure will be cleared before extracting XML nodes.

Parameters

Node The XML node containing the structure data.
*Buffer The address of the structure memory to fill.
Structure The type of the structure to fill.
Flags (optional) If this parameter is set to #PB_XML_NoCase then the comparison of XML node and attribute names is performed case insensitive. The default is to be case sensitive.

Return value

None.

Remarks

The content of the structure memory are cleared before extracting the XML nodes. If a structure element does not have a corresponding node in the XML, it is left empty.

The XML nodes must have the form described in the InsertXMLStructure() function. Namely, each node must be named after a structure member with any '*' or '$' characters stripped from the name. If a node for the same structure element exists multiple times, the first node will be used.

Example

  Structure Person
    Name$
    Age.l
  EndStructure
  
  Xml$ = "<Person><Name>John Smith</Name><Age>42</Age></Person>"

  If ParseXML(0, Xml$) And XMLStatus(0) = #PB_XML_Success
    Define P.Person
    ExtractXMLStructure(MainXMLNode(0), @P, Person)
    
    Debug P\Name$
    Debug P\Age
  Else
    Debug XMLError(0)
  EndIf 

See Also

InsertXMLStructure(), ExtractXMLArray(), ExtractXMLList(), ExtractXMLMap()

Supported OS

All

<- ExtractXMLMap() - XML Index - FormatXML() ->