Skip to content

KVSCCXMLHandling#

Procedures#

AddRootElement(XmlDocument, Text, XmlElement) :#

Summary: Provides XML handling functionalities for sanction check operations.

procedure AddRootElement(var XmlDoc: XmlDocument; NodeName: Text; var CreatedXMLNode: XmlElement): 

Parameters:

  • XmlDoc: The XML document to be manipulated.
  • NodeName: The name of the XML node to be created.
  • CreatedXMLNode: The created XML element.

Remarks: This codeunit contains procedures for creating and manipulating XML documents, including adding elements, attributes, and searching for nodes within the XML structure.

AddRootElementWithPrefix(XmlDocument, Text, Text, Text, XmlElement) :#

Summary: Adds the root element with a namespace prefix to the XML document.

procedure AddRootElementWithPrefix(var XmlDoc: XmlDocument; NodeName: Text; Prefix: Text; NameSpace: Text; var CreatedXMLNode: XmlElement): 

Parameters:

  • XmlDoc: The XML document to be manipulated.
  • NodeName: The name of the XML node to be created.
  • Prefix: The namespace prefix for the XML node.
  • NameSpace: The namespace URI for the XML node.
  • CreatedXMLNode: The created XML element.

Remarks: This procedure creates a root XML element with the specified namespace prefix and adds it to the XML document.

AddElement(XmlElement, Text, Text, Text, XmlElement) : Integer#

Summary: Adds an element to the specified XML node.

procedure AddElement(var TargetXmlNode: XmlElement; NodeName: Text; NodeText: Text; NodeNamespace: Text; var CreatedXMLNode: XmlElement): Integer

Parameters:

  • TargetXmlNode: The target XML node to which the new element will be added.
  • NodeName: The name of the new XML element.
  • NodeText: The text content of the new XML element.
  • NodeNamespace: The namespace URI for the new XML element.
  • CreatedXMLNode: The created XML element.

Returns: An integer status code indicating the result of the operation.

Remarks: This procedure creates a new XML element with the specified name, text, and namespace, and adds it as a child to the target XML node.

AddElementWithPrefix(XmlElement, Text, Text, Text, Text, XmlElement) : Integer#

Summary: Adds an element with a namespace prefix to the specified XML node.

procedure AddElementWithPrefix(var TargetXmlNode: XmlElement; NodeName: Text; NodeText: Text; Prefix: Text; NodeNamespace: Text; var CreatedXMLNode: XmlElement): Integer

Parameters:

  • TargetXmlNode: The target XML node to which the new element will be added.
  • NodeName: The name of the new XML element.
  • NodeText: The text content of the new XML element.
  • Prefix: The namespace prefix for the new XML element.
  • NodeNamespace: The namespace URI for the new XML element.
  • CreatedXMLNode: The created XML element.

Returns: An integer status code indicating the result of the operation.

Remarks: This procedure creates a new XML element with the specified name, text, namespace and prefix, and adds it as a child to the target XML node.

AddAttribute(XmlElement, Text, Text) : Integer#

Summary: Adds an attribute to the specified XML node.

procedure AddAttribute(var TagetXmlNode: XmlElement; Name: Text; NodeValue: Text): Integer

Parameters:

  • TagetXmlNode: The target XML node to which the attribute will be added.
  • Name: The name of the attribute.
  • NodeValue: The value of the attribute.

Returns: An integer status code indicating the result of the operation.

Remarks: This procedure creates a new XML attribute with the specified name and value, and adds it to the target XML node. If the attribute name starts with 'xmlns:', it is treated as a namespace declaration.

AddAttributeWithNamespaceDeclaration(XmlElement, Text, Text) : Integer#

Summary: Adds a namespace declaration attribute to the specified XML element.

procedure AddAttributeWithNamespaceDeclaration(var TargetXmlElement: XmlElement; Prefix: Text; NodeValue: Text): Integer

Parameters:

  • TargetXmlElement: The target XML element to which the namespace declaration will be added.
  • Prefix: The namespace prefix.
  • NodeValue: The namespace URI.

Returns: An integer status code indicating the result of the operation.

Remarks: This procedure creates a namespace declaration attribute with the specified prefix and URI, and adds it to the target XML element.

FindNode(XmlElement, Text, XmlNode) : Boolean#

Summary: Finds a node within the specified XML root node.

procedure FindNode(XmlRootNode: XmlElement; NodePath: Text; var FoundXMLNode: XmlNode): Boolean

Parameters:

  • XmlRootNode: The root XML element to search within.
  • NodePath: The XPath expression to locate the desired node.
  • FoundXMLNode: The found XML node.

Returns: True if the node is found; otherwise, false.

Remarks: This procedure searches for a node within the given XML root node using the specified XPath expression. If the node is found, it is returned in the FoundXMLNode parameter.

FindDocNodeWithNamespace(XmlDocument, Text, Text, Text, XmlNode) : Boolean#

Summary: Finds a node within the XML document using a namespace.

procedure FindDocNodeWithNamespace(XmlDoc: XmlDocument; NodePath: Text; Prefix: Text; NameSpace: Text; var FoundXMLNode: XmlNode): Boolean

Parameters:

  • XmlDoc: The XML document to search within.
  • NodePath:
  • Prefix:
  • NameSpace:
  • FoundXMLNode:

Returns:

FindNodeWithNamespace(XmlElement, Text, Text, Text, XmlNode) : Boolean#

Summary: Finds a node within the specified XML root node using a namespace.

procedure FindNodeWithNamespace(XmlRootNode: XmlElement; NodePath: Text; Prefix: Text; NodeNamespace: Text; var FoundXMLNode: XmlNode): Boolean

Parameters:

  • XmlRootNode: The root XML element to search within.
  • NodePath: The XPath expression to locate the desired node.
  • Prefix: The namespace prefix.
  • NodeNamespace: The namespace URI.
  • FoundXMLNode: The found XML node.

Returns: The found XML node.

Remarks: This procedure searches for a node within the given XML root node using the specified XPath expression and namespace. If the node is found, it is returned in the FoundXMLNode parameter.

FindNodeWithNamespaceManager(XmlElement, Text, XmlNamespaceManager, XmlNode) : Boolean#

Summary: Finds a node within the specified XML root node using a namespace manager.

procedure FindNodeWithNamespaceManager(XmlRootNode: XmlElement; NodePath: Text; XmlNamespaceMgr: XmlNamespaceManager; var FoundXMLNode: XmlNode): Boolean

Parameters:

  • XmlRootNode: The root XML element to search within.
  • NodePath: The XPath expression to locate the desired node.
  • XmlNamespaceMgr: The XML namespace manager.
  • FoundXMLNode: The found XML node.

Returns: True if the node is found; otherwise, false.

Remarks: This procedure searches for a node within the given XML root node using the specified XPath expression and namespace manager. If the node is found, it is returned in the FoundXMLNode parameter.

FindNodes(XmlElement, Text, XmlNodeList) : Boolean#

Summary: Finds nodes within the specified XML root node.

procedure FindNodes(XmlRootNode: XmlElement; NodePath: Text; var FoundXmlNodeList: XmlNodeList): Boolean

Parameters:

  • XmlRootNode: The root XML element to search within.
  • NodePath: The XPath expression to locate the desired nodes.
  • FoundXmlNodeList: The found XML node list.

Returns: True if nodes are found; otherwise, false.

Remarks: This procedure searches for nodes within the given XML root node using the specified XPath expression. If nodes are found, they are returned in the FoundXmlNodeList parameter.

FindNodesWithNamespace(XmlElement, Text, Text, Text, XmlNodeList) : Boolean#

Summary: Finds nodes within the specified XML root node using a namespace.

procedure FindNodesWithNamespace(XmlRootNode: XmlElement; NodePath: Text; Prefix: Text; NameSpaceNode: Text; var FoundXmlNodeList: XmlNodeList): Boolean

Parameters:

  • XmlRootNode: The root XML element to search within.
  • NodePath: The XPath expression to locate the desired nodes.
  • Prefix: The namespace prefix.
  • NameSpaceNode: The namespace URI.
  • FoundXmlNodeList: The found XML node list.

Returns: True if nodes are found; otherwise, false.

Remarks: This procedure searches for nodes within the given XML root node using the specified XPath expression and namespace. If nodes are found, they are returned in the FoundXmlNodeList parameter.

FindDocNodesWithNamespaceManager(XmlDocument, Text, XmlNamespaceManager, XmlNodeList) : Boolean#

Summary: Finds nodes within the XML document using a namespace manager.

procedure FindDocNodesWithNamespaceManager(XmlDoc: XmlDocument; NodePath: Text; XmlNamespaceMgr: XmlNamespaceManager; var FoundXMLNodeList: XmlNodeList): Boolean

Parameters:

  • XmlDoc: The XML document to search within.
  • NodePath: The XPath expression to locate the desired nodes.
  • XmlNamespaceMgr: The XML namespace manager.
  • FoundXMLNodeList: The found XML node list.

Returns: True if nodes are found; otherwise, false.

Remarks: This procedure searches for nodes within the given XML document using the specified XPath expression and namespace manager. If nodes are found, they are returned in the FoundXMLNodeList parameter.

FindNodesWithNamespaceManager(XmlElement, Text, XmlNamespaceManager, XmlNodeList) : Boolean#

Summary: Finds nodes within the specified XML root node using a namespace manager.

procedure FindNodesWithNamespaceManager(XmlRootNode: XmlElement; NodePath: Text; XmlNamespaceMgr: XmlNamespaceManager; var FoundXMLNodeList: XmlNodeList): Boolean

Parameters:

  • XmlRootNode: The root XML element to search within.
  • NodePath: The XPath expression to locate the desired nodes.
  • XmlNamespaceMgr: The XML namespace manager.
  • FoundXMLNodeList: >The found XML node list.

Returns: True if nodes are found; otherwise, false.

Remarks: This procedure searches for nodes within the given XML root node using the specified XPath expression and namespace manager. If nodes are found, they are returned in the FoundXMLNodeList parameter.

FindDocNodeXMLWithNamespace(XmlDocument, Text, Text, Text) : Text#

Summary: Finds a node within the XML document using a namespace.

procedure FindDocNodeXMLWithNamespace(XmlDoc: XmlDocument; NodePath: Text; Prefix: Text; NameSpaceNode: Text): Text

Parameters:

  • XmlDoc: The XML document to search within.
  • NodePath: The XPath expression to locate the desired node.
  • Prefix: The namespace prefix.
  • NameSpaceNode: The namespace URI.

Returns: The found XML node's value as text.

Remarks: This procedure searches for a node within the given XML document using the specified XPath expression and namespace. If the node is found, its value is returned as text.

FindDocNodeXMLWithNamespaceManager(XmlDocument, Text, XmlNamespaceManager) : Text#

Summary: Finds a node within the XML document using a namespace manager.

procedure FindDocNodeXMLWithNamespaceManager(XmlDoc: XmlDocument; NodePath: Text; XmlNamespaceMgr: XmlNamespaceManager): Text

Parameters:

  • XmlDoc: The XML document to search within.
  • NodePath: The XPath expression to locate the desired node.
  • XmlNamespaceMgr: The XML namespace manager.

Returns: The found XML node's value as text.

Remarks: This procedure searches for a node within the given XML document using the specified XPath expression and namespace manager. If the node is found, its value is returned as text.

FindNodeXML(XmlElement, Text) : Text#

Summary: Finds a node within the specified XML root node.

procedure FindNodeXML(XmlRootNode: XmlElement; NodePath: Text): Text

Parameters:

  • XmlRootNode: The root XML element to search within.
  • NodePath: The XPath expression to locate the desired node.

Returns: The found XML node's value as text.

Remarks: This procedure searches for a node within the given XML root node using the specified XPath expression. If the node is found, its value is returned as text.

FindNodeXMLWithNamespace(XmlElement, Text, Text, Text) : Text#

Summary: Finds a node within the specified XML root node using a namespace.

procedure FindNodeXMLWithNamespace(XmlRootNode: XmlElement; NodePath: Text; Prefix: Text; NameSpaceNode: Text): Text

Parameters:

  • XmlRootNode: The root XML element to search within.
  • NodePath: The XPath expression to locate the desired node.
  • Prefix: The namespace prefix.
  • NameSpaceNode: The namespace URI.

Returns: >The found XML node's value as text.

Remarks: This procedure searches for a node within the given XML root node using the specified XPath expression and namespace. If the node is found, its value is returned as text.

FindNodeXMLWithNamespacemanager(XmlElement, Text, XmlNamespaceManager) : Text#

Summary: Finds a node within the specified XML root node using a namespace manager.

procedure FindNodeXMLWithNamespacemanager(XmlRootNode: XmlElement; NodePath: Text; XmlNamespaceMgr: XmlNamespaceManager): Text

Parameters:

  • XmlRootNode: The root XML element to search within.
  • NodePath: The XPath expression to locate the desired node.
  • XmlNamespaceMgr: The XML namespace manager.

Returns: >The found XML node's value as text.

Remarks: This procedure searches for a node within the given XML root node using the specified XPath expression and namespace manager. If the node is found, its value is returned as text.

GetAttributeValue(XmlElement, Text) : Text#

Summary: Gets the value of a specified attribute from the given XML root node.

procedure GetAttributeValue(XmlRootNode: XmlElement; AttributeName: Text): Text

Parameters:

  • XmlRootNode: The XML element from which to retrieve the attribute value.
  • AttributeName: The name of the attribute whose value is to be retrieved.

Returns: >The value of the specified attribute as text. If the attribute does not exist, an empty string is returned.

Remarks: This procedure iterates through the attributes of the provided XML root node to find the attribute with the specified name and returns its value.

GetNodelistElement(XmlNodeList, Integer, XmlElement) : Boolean#

Summary: Gets the XML element at the specified index from the given XML node list.

procedure GetNodelistElement(ElementNodeList: XmlNodeList; Index: Integer; var OutputXmlElement: XmlElement): Boolean

Parameters:

  • ElementNodeList: The XML node list from which to retrieve the element.
  • Index: The index of the desired XML element (1-based).
  • OutputXmlElement: The output XML element retrieved from the node list.

Returns: >True if the element is found; otherwise, false.

Remarks: This procedure retrieves the XML element at the specified index from the provided XML node list. If the index is valid and the node at that index is an XML element, it is returned in the OutputXmlElement parameter.

AddDeclaration(XmlDocument, Text, Text, Text) :#

Summary: Adds an XML declaration to the XML document.

procedure AddDeclaration(var XmlDoc: XmlDocument; VersionTxt: Text; Encoding: Text; Standalone: Text): 

Parameters:

  • XmlDoc: The XML document to which the declaration will be added.
  • VersionTxt: The version text for the XML declaration.
  • Encoding: The encoding for the XML declaration.
  • Standalone: The standalone attribute for the XML declaration.

Remarks: This procedure creates an XML declaration with the specified version, encoding, and standalone attributes, and sets it in the provided XML document.