FirmaSAT Manual

Simplified XPath expressions for the elementName parameter

The elementName parameter in the GetXmlAttribute function now supports a simplified xpath expression to find attribute values in the more complicated structure of CFDiv3.3 XML documents.

Simple element name

Set the elementName argument to the simple name of the element to be found, e.g. "Comprobante" or "cfdi:Comprobante". This will find the first occurence of the element anywhere in the document. To find the Nth element, write as elementName[N] where N is a positive decimal integer (N=1,2,3,...). For example, "Concepto[3]" will find the third element named Concepto anywhere in the document.

Set elementName as the empty string "" to specify the root element. Set both elementName and attrname to "" to find the name of the root element.

XPath Expression

For a more detailed search, specify an xpath expression in the elementName parameter using the child path operator "/" and the descendant operator "//", together with an optional element predicate of the form [N] where N is a positive integer (N=1,2,3,...). For example, "/Comprobante/Emisor" or "//Concepto[2]//Retencion[3]".

Simplified Xpath syntax:

This behaviour is similar to XPath except it selects the first occurrence of the element matching the expression (whereas XPath would select all elements). The elementName xpath expression must begin with a "/" or "//" and must not end with a "/". The expression "//" by itself is not valid. No other XPath function or operator is accepted - including the "@" operator. The required attribute name must be specified separately in the attributeName parameter.

Namespaces are ignored when matching against a path expression. A path element name with prefix - e.g. "/cfdi:Comprobante" - is invalid.

To test for the existence of an element, specify attrname="". This will return the (qualified) name of the element if found, or !NO MATCH! if not found.

[PREV: Get XML Attribute...]   [Contents]   [Index]   
   [NEXT: Asciify an XML Document...]

Copyright © 2007-24 D.I. Management Services Pty Ltd. All rights reserved. Generated 2024-04-08T04:07:56Z.