ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / XML file functions
  • Manipulating an XML document
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Manipulating an XML document
Two methods can be used to manipulate an XML document:
  1. Using an xmlDocument variable (Recommended method). This method allows you to use an XSD file.
    Several types of specific variables are available:
    xmlAttributeThe xmlAttribute type is used to handle the attributes of a node in an XML document.
    xmlDocumentThe xmlDocument type is used to handle an XML file.
    xmlNamespaceThe xmlNamespace type is used to handle the XML namespace of a node attribute in an XML document.
    xmlNodeThe xmlNode type is used to handle a node of an XML document.

    Several specific functions allow you to use xmlDocument variables
    XMLBuildStringRetrieves and formats the content of an XML document (created by XMLDocument and modified by the XML functions).
    XMLOpenLoads an XML document from a file, a URL or a string into an xmlDocument variable.
    XMLSaveSaves an XML document in a file.
    XMLValidDocumentValidates an XML document from an XSD schema.
  2. Using a string variable to store the XML document. The XML document can be manipulated using different XML functions.
    The following functions are used to manage XML documents:
    JSONToXMLConverts a JSON string to XML.
    TextToXMLConverts an ANSI string to an XML string.
    XMLAddAttributeAdds an attribute into an XML document.
    XMLAddChildAdds a child tag into an XML document.
    XMLBuildStringRetrieves and formats the content of an XML document (created by XMLDocument and modified by the XML functions).
    XMLCancelSearchCancels the search performed by XMLFind.
    XMLChildPositions on the first child element of current element.
    XMLChildExistSpecifies whether the current tag has children corresponding to the sought type (tag, attribute, ...).
    XMLCloseCloses an XML document created by XMLDocument.
    XMLDataReturns the value of current element (tag or XML attribute) or the value of one of its attributes.
    XMLDeleteDeletes the current element (as well as the entire branch) from an XML document.
    XMLDocumentCreates a new XML document.
    XMLElementNameReturns the name of current element (tag or attribute).
    XMLElementTypeReturns the type of current element (tag or attribute).
    XMLExecuteXPathExecutes an XPATH query:
    • in an XML document.
    • in an xmlDocument variable.
    XMLExtractDocumentCreates a new XML document from an existing XML document.
    XMLExtractStringExtracts the content of a tag found in an XML document.
    XMLFindPerforms a search in an XML document.
    XMLFindNamespaceByNameFinds an XML namespace according to its XML node and in the parents of the node.
    XMLFindNamespaceByURIFinds an XML namespace from its URI (Universal Resource Identifier) in a node and in the parents of this node.
    XMLFirstPositions on the first element (tag or attribute) in the current tree level.
    XMLFoundChecks whether the current element corresponds to the current browse or to the current search.
    XMLInsertDocumentInserts the current XML tag found in an XML document into another XML document.
    XMLInsertElementInserts an XML element (tag or attribute) into an XML document.
    XMLLastPositions on the last element (tag or attribute) of the current tree level.
    XMLModifyModifies the content of the current element found in the XML document.
    XMLNamespaceReturns the prefix of the namespace associated with the current tag in an XML document.
    XMLNamespaceURIReturns the URI of the namespace associated with the current tag in an XML document.
    XMLNextPositionq on the next element (tag or attribute).
    XMLOpenLoads an XML document from a file, a URL or a string into an xmlDocument variable.
    XMLOpenReaderCreates a reader used to read an XML document without loading it in memory.
    XMLOutUsed to find out whether the element (tag or attribute) on which we want to be positioned is outside the XML document.
    XMLParentPositions on the parent element of current element (tag or attribute).
    XMLParentNameReturns the name of parent tag for the current element (tag or attribute).
    XMLPathReturns the current position in the document in XPATH format.
    XMLPreviousPositions on the previous element (tag or attribute).
    XMLReadReturns the value of an XML element or the value of the attribute for an XML element.
    XMLRenameRenames the current element (tag or attribute) in an XML document.
    XMLRestorePositionRestores the previously saved context of an XML document.
    XMLResultReturns the result of a calculation XPath query.
    XMLRootPositions on the root tag of an XML document.
    XMLSaveSaves an XML document in a file.
    XMLSavePositionStores the current position in the XML document.
    XMLSignSigns an XML document.
    XMLToJSONConverts an XML string to JSON.
    XMLToTextConverts a character string in XML format into a standard character string.
    XMLValidDocumentValidates an XML document from an XSD schema.
    XMLValidNodeValidates an XML node, its children and its attributes from its description in the XSD schema linked to the XML document.
    XMLVerifySignatureVerifies the signature of an XML node.
    XMLWriteCreates or modifies the value of an XML element or the value of the attribute for an XML element.
You can also use other functions to manipulate XML documents:
HExportXMLExports the records found in a data file (HFSQL or OLE DB), view or query to an XML file.
HImportXMLImports an XML file into an HFSQL Classic or Client/Server data file. This data file must have been defined in the data model editor, or declared with HDeclare, HDeclareExternal or HDescribeFile).
HRecordToXMLRetrieves the structure and the value of the current record and exports them into a character string in XML format.
J2EERunXMLRuns a procedure on a server of J2EE XML web services.
LooperToXMLCreates an XML file with data from a Looper control (Looper control based on a data file or populated programmatically).
SOAPRunXMLRuns a procedure on a SOAP server.
TableToXMLCreates an XML file from the data found in a Table or TreeView Table control.
Related Examples:
Reading and writing in XML format Unit examples (WINDEV): Reading and writing in XML format
[ + ] Using the XMLxxx functions to:
- Create an XML document
- Read an XML document
XML parser Unit examples (WINDEV): XML parser
[ + ] Studying the content of an XML file via the XMLxxx functions of WINDEV
WD Syntactic Coloring Training (WINDEV): WD Syntactic Coloring
[ + ] This example proposes a base class used to perform a standard syntax highlighting on some text.
This highlighting is based on a rough analysis of the lemmes found in a text in order to identify the elements of a programming language for instance.
It can be overridden or derived in order to customize the system and the highlighting language.
This example is used to highlight SQL code and XML code but it can be extended to highlight other languages or other text formats.
WD Multimedia Complete examples (WINDEV): WD Multimedia
[ + ] This example shows how to play animations, audio and video files (MP3, WAV, AVI, MPEG, etc.) using the Multimedia control in WINDEV.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/25/2024

Send a report | Local help