.xmlElementBlockSize()

Method checks the content length of an element.

Description of the method

Description: xmlElementBlockSize method checks the content length of an element. This lenght includes tags as well as values without pretty printing the XML.
Available for: any
Parameters: -
Return type: integer

Example

Context: PartyIdentification
OCL: self.xmlElementBlockSize() = 17
Description: The example rule checks the lenght of PartyIdentification content including tags and values.

 

The XML snippet below would pass this check.

<Debtor>
  <Name>name</Name>
</Debtor>


The following data is taken into account when calculating the length in the above example "<Name>name</Name>". The indentation before the name element as well as the line feed before and after the element are omitted.

Some more examples below:
 

 <Debtor>
     <!--comment-->
      <Name>name</Name>
</Debtor>
xmlElementBlockSize = 31
Comments are included to length.
<h:Debtor>
      <h:Name>name</h:Name>
</h:Debtor>

xmlElementBlockSize = 21
If element is not in the default namespace and namespace prefixes are used, the prefixes will also be included to length.

 

Attached you can find example schema and files which you can use for testing:

xmlElementBlockSize-withcomment.xml

xmlElementBlockSize-withnamespaceprefix,xml

Studio_manuals_example_schema.xsd