nsprefix

The nsprefix option allows your RPG program to determine the values of the namespaces that were removed from the XML names when option ns=remove was specified.

The nsprefix option specifies the prefix for the names of the subfields that are to receive the value of the namespace. The nsprefix option is ignored unless option ns=remove is specified.

For example, if the XML element <abc:def>hello</abc:def>, and options ns=remove and nsprefix=PFX_ are specified, then RPG subfield DEF will receive the value "hello" and RPG subfield PFX_DEF will receive the value "abc".

Rules for the nsprefix option:
  1. The nsprefix subfield must have alphanumeric or UCS-2 type.
  2. If a subfield matched by XML data is an array, the nsprefix subfield must also be an array, with the same number of elements. If a subfield matched by XML data is not an array, the nsprefix subfield must not be an array.
  3. If an XML element does not have a namespace, the empty string '' will be placed in the nsprefix subfield.
  4. It is not considered an error if a subfield has the correct name for an nsprefix subfield but it does not meet the criteria for being an nsprefix subfield. For example, if nsprefix=ns is specified, and the data structure has array subfield NAME with two elements, and it has alphanumeric array subfield NSNAME with three elements, the subfield NSNAME is not considered to be an nsprefix subfield, so XML-INTO will expect to find XML data to set its value.
  5. The case option does not affect the namespace value that is placed in the nsprefix subfield. For example, if the case=convert option is specified, and the XML name is a--b:name, the value "a--b" will be placed in the nsprefix subfield.
  6. The nsprefix option is not considered for the datasubf subfield.