Skip to content

Add support for arbitrary XML in value/extValue#88

Merged
djc merged 4 commits intodjc:mainfrom
valkum:fix-undef
Feb 25, 2026
Merged

Add support for arbitrary XML in value/extValue#88
djc merged 4 commits intodjc:mainfrom
valkum:fix-undef

Conversation

@valkum
Copy link
Contributor

@valkum valkum commented Feb 20, 2026

Per RFC 5730 these contain children of <any> and also have <anyAttribute>

Replace the static Undef-only ResultValue with a dynamic ValueElement tree that captures namespace, name, attributes, text, and children from any errValueType content. Update EppResult to support multiple <value> and <extValue> elements (unbounded choice per the spec).

Fixes issues where <epp:undef> is replaced with a concrete object type. See the added tests for examples.

There is a rather new spec that gives more context about the extValue and unhandled namespaces with some examples.
https://datatracker.ietf.org/doc/rfc9038/

I am not entirely sure how to cover the <anyAttribute> on <value>. This for now stores it in a vec with all information from the parser.

The schema is:

<complexType name="resultType">
  <sequence>
    <element name="msg" type="epp:msgType" />
    <choice minOccurs="0" maxOccurs="unbounded">
      <element name="value" type="epp:errValueType" />
      <element name="extValue" type="epp:extErrValueType" />
    </choice>
  </sequence>
  <attribute name="code" type="epp:resultCodeType"
    use="required" />
</complexType>

<complexType name="errValueType" mixed="true">
  <sequence>
    <any namespace="##any" processContents="skip" />
  </sequence>
  <anyAttribute namespace="##any" processContents="skip" />
</complexType>

<complexType name="extErrValueType">
  <sequence>
    <element name="value" type="epp:errValueType" />
    <element name="reason" type="epp:msgType" />
  </sequence>
</complexType>

Zero or more OPTIONAL <value> elements that identify a client-provided element (including XML tag and value) or other information that caused a server error condition.

Zero or more OPTIONAL <extValue> elements that can be used to provide additional error diagnostic information, including:

  • A <value> element that identifies a client-provided element(including XML tag and value) that caused a server error condition.

  • A <reason> element containing a human-readable message that describes the reason for the error. The language of the response is identified via an OPTIONAL "lang" attribute. If not specified, the default attribute value MUST be "en" (English).

I guess it could make sense to take this ValueElement and use it as a first impl for djc/instant-xml#115 although the hard part is probably implementing serialize for it, due to the missing stack namespace stack.

@djc
Copy link
Owner

djc commented Feb 23, 2026

Maybe this ValueElement should live in instant-xml? It doesn't seem EPP-specific in any way.

@valkum
Copy link
Contributor Author

valkum commented Feb 23, 2026

I agree. I will create a PR with just the ValueElement there.

This version added support for AnyElement
Copy link
Owner

@djc djc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks okay!

I think this is semver-breaking? If so, can you add a commit with a semver incompatible version bump (if there isn't one already)?

Per RFC 5730 these contain children of <any> and also have
<anyAttribute>

Replace the static Undef-only ResultValue with a dynamic ValueElement
tree that captures namespace, name, attributes, text, and children from
any errValueType content. Update EppResult to support multiple <value>
and <extValue> elements (unbounded choice per the spec).

Fixes issues where `<epp:undef>` is replaced with concrete object type.
See added test for an example.
The previous commits should cover RFC 9038
@valkum
Copy link
Contributor Author

valkum commented Feb 25, 2026

Cargo.toml is already at 0.5 but that was never pushed to crates.io and there is no git tag.

@djc djc merged commit 12fcf19 into djc:main Feb 25, 2026
7 checks passed
@djc
Copy link
Owner

djc commented Feb 25, 2026

Cool, thanks! Let me know if/when you want a release with this.

@valkum
Copy link
Contributor Author

valkum commented Feb 25, 2026

Currently driving with a fork. I guess it makes sense to wait with a release until I have everything upstreamed (breaking and non breaking).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants