IPWorks EDI 2020 Python Edition

Questions / Feedback?

x_path Property

Provides a way to point to a specific segment in the document.

Syntax

def get_x_path() -> str: ...
def set_x_path(value: str) -> None: ...

x_path = property(get_x_path, set_x_path)

Default Value

""

Remarks

The path is a series of one or more segment accessors separated by '/'. The path can be absolute (starting with '/') or relative to the current x_path location.

The following are possible values for an element accessor:

IXRefers to the Interchange (root) node
FGRefers to a Functional Group node
TXRefers to a Transaction Set node
'name'The first segment or loop of the current container with the given schema name
name[i]The i-th segment of the current container with the given schema-name
[i]The i-th segment of the current container
[last()]The last segment of the current container
[last()-i]The segment located at the last location minus i in the current container
..The parent of the current container

When x_path is set to a valid path, x_segment points to the name of the segment, with x_tag, x_segment_type, and x_children providing other properties of the segment. The elements of the current segment are provided in the x_elements properties.

build_dom must be set to bdEntireDocument or bdTransaction prior to parsing the document for the x_path functionality to be available.

Example (Setting XPath)

Document root (Interchange)EDIReaderControl.XPath = "/"
N1 segment in the first transactionEDIReaderControl.XPath = "/IX/FG/TX/N1Loop1/N1"
3-th instance of the N2 segmentEDIReaderControl.XPath = "/IX/FG/TX/N1Loop1/N2[3]"

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks EDI 2020 Python Edition - Version 20.0 [Build 8162]