xsi:nil and pub.xml:xmlNodeToDocument

The documentation for pub.xml:xmlNodeToDocument states that any XML elements containing an attribute will be converted to an IS document with the attribute (with @ prefix) and *body as children. For an element such as the resulting document will be

@xsi:nil = true

Reviewing various posts it is inferred that xmlNodeToDocument, when used with documentTypeName input specified and the document type defines the field as a string to allow nulls, that it would convert the element to a null object instead of an IS document.

…myField = $null

I’ve tried a number of things but it always converts the element to an IS document. Having it behave this way would be helpful in a variety of ways. :slight_smile:

Pertinent info:

  • xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” is present in the root element of the document
  • Other needed namespaces are present in the rool element of the document
  • The document type defines elements with the namespaces
  • nsDecls is set with the desired namespaces and prefixes
  • preserveUndeclaredNS is not set (default is false)
  • IS 9.7, fix 8

If anyone has info that would enable this behavior it would be very appreciated. Or if someone has info that indicates xmlNodeToDocument cannot be made to do this, that would be good too.



You can try this: