xproc / 3.0-steps

Repository for change requests to the standard step library and for official extension steps
10 stars 7 forks source link

Ambiguities in description of cast-content-type XML to JSON #618

Closed xatapult closed 1 month ago

xatapult commented 1 month ago

I was describing p:cast-content-type and stumbled upon a number of ambiguities in the spec for XML conversions:

  1. What should p:cast-content-type do when it gets a random XML document. My interpretation of the text is that it should convert it to some JSON, however the processor likes it to do. Morgana raises an error. What do we mean?
  2. The description mentions that it must convert a <c:param-set> document into a map. However, the whole c:param-set/c:param description/definition is missing from both the core spec and the steps. So unless you know XProc 1.0, you don't know what its talking about.
  3. It says that it should convert the <c:param> elements into map entries. But it does not say that the document must be valid or structured well or whatever. Morgana raises an error if the document is invalid against the XProc 1.0 c:param-set document structure, that's ok, but not prescribed in the spec.
  4. It talks about converting a <c:data> document but does not describe/define it. From the text you can infer that it should contain base64 text, but shouldn't that be defined somewhere?
ndw commented 1 month ago

For point 1, we explicitly say that the details are implementation defined, so you should read your processor's documentation and see what it says 😄 . It's perfectly reasonable for a processor to support the standard F&O representation and nothing else.

Points 2, 3, and 4 are a clear oversight.

I'll see about drafting some prose asap.

xatapult commented 1 month ago

I'm not sure I agree with you:

It's perfectly reasonable for a processor to support the standard F&O representation and nothing else.

The spec reads:

Casting from an XML media type to a JSON media type converts the XML into JSON. The precise nature of the conversion from XML to JSON is implementation-defined.

So it says:

Raising an error is not converting XML into JSON...

xatapult commented 1 month ago

If raising an error is what we think is a reasonable thing to do, that's fine with me, but let's then rephrase this.

ndw commented 1 month ago

I'm happy to make that clearer.

ndw commented 1 month ago

On further inspection, isn't this description of c:data sufficient?