Skip to content
English
  • There are no suggestions because the search field is empty.

.path()

Returns path to the element as a string.

Description of the method
Description:

.path() returns path to the element as a string. The path contains the index information of the elements. Example of a return value: 

//Document[1]/CstmrCdtTrfInitn[1]/PmtInf[1]/Dbtr[1]/Nm[1]

Available for:

any element

Parameters: None
Return type: String

Example 1

Context: PostalAddress24
OCL: self.path().contains("DbtrAgt") implies self.Ctry->size() = 1
Description: The example rule checks if one of the elements in the PstlAdr elements path is DbtrAgt. In case it is, then we require PstlAdr to have one Ctry child element present. 

 

The XML snippet below would pass this check.

<PmtInf>
      <PmtInfId>1234</PmtInfId>
      <PmtMtd>TRF</PmtMtd>
      <PmtTpInf>
    ...

       <DbtrAgt>
          <FinInstnId>
             <PstlAdr>
              <Ctry>FI</Ctry>
            </PstlAdr>
          </FinInstnId>
        </DbtrAgt>
  

    ...
    </PmtInf>

The other snippet below however would not pass this check as the element Ctry is not given.

<PmtInf>
      <PmtInfId>1234</PmtInfId>
      <PmtMtd>TRF</PmtMtd>
      <PmtTpInf>
    ...

       <DbtrAgt>
          <FinInstnId>
             <PstlAdr>
              <TwnNm>Hammaslahti</TwnNm>
            </PstlAdr>
          </FinInstnId>
        </DbtrAgt>
  

    ...
    </PmtInf>

 

Example 2

Context: Max140Text
OCL: self.path().contains("DbtrAgt") or self.path().contains("Cdtr[") implies self.size() <= 10
Description: The example rule checks that Max140Text simple types do not contain more than 10 characters when element path contains DbtrAgt or Cdtr. Example highlights a case where contains is aimed to check for "Cdtr[" so that the contains method does not target elements such as CdtrAgt. 

 

The XML snippet below would pass this check.

<PmtInf>
      <PmtInfId>1234</PmtInfId>
      <PmtMtd>TRF</PmtMtd>
      <PmtTpInf>
    ...

       <DbtrAgt>
          <FinInstnId>
              <Nm>Test name</Nm>
          </FinInstnId>
        </DbtrAgt>
  

    ...
    </PmtInf>

The other snippet below however would not pass this check as the element Nm contains values that are too long.

<PmtInf>
      <PmtInfId>1234</PmtInfId>
      <PmtMtd>TRF</PmtMtd>
      <PmtTpInf>
    ...

       <DbtrAgt>
          <FinInstnId>
              <Nm>Failing test name</Nm>
          </FinInstnId>
        </DbtrAgt>
  

    ...
    </PmtInf>