JSON to XML: Invalid ObjectRootElementName with Colon

Not applicable

I have a request body that is being converted from JSON to XML.

The ObjectRootElementName I am trying to use has a colon in it (something:another).

It's throwing an invalid XML structural format. Is there any way around this? What I am trying to create is an XML format of:

<something:another>

<data>

</data>

</something:another>

Thanks.

0 1 255
1 REPLY 1

That's not well-formed XML. You cannot have a colon. In XML, the thing before the colon is called a namespace prefix. But to use a namespace prefix, you must define it.

This is well-formed

<something:another xmlns:something="urn:abcdefg">
  <data>
  </data>
</something:another>

This is not well-formed:

<something:another>
  <data>
  </data>
</something:another>