Uploaded image for project: 'yangtools'
  1. yangtools
  2. YANGTOOLS-1544

Enhance XML prefix assignment

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: High High
    • 9.0.9, 10.0.10, 11.0.3
    • None
    • codecs

      When yang-data-codec-xml emits namespace declarations as part of, for example, instance-identifier writeout, we assign linear prefixes ('a', 'b') to any mapping we need to define, in their encounter order (and then write them out in any order).

      This is correct in XML terms, as parser are required to look at the NamespaceContext.

      Unfortunately this requires some cognitive load on people interacting with these XMLs and we can do better. RFCs since RFC6020 use YANG module stament's prefix statement argument as the XML prefix.

      This is not always desirable in the context of the XML document, where there are externally-defined mappings (which we want to reuse to reduce clutter).

      This is not even always possible, as an EffectiveModelContext is valid even when two distinct modules have the same prefix.

      Enhance RandomPrefix to prefer assignment of YANG-defined XML prefixes where possible, falling back to the current way of assignment.

            rovarga Robert Varga
            rovarga Robert Varga
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: