Any way to get get the incomplete or malformed XML ?

Is there any way to get the incomplete or malformed XML in our service ?.

Currently if someone is posting(using text/xml) an incomplete or malformed XML, the node becomes invalid and we do not get to see the full XML. We have a requirement where we need to save the incomplete or malformed XML for auditing purposes. How do we do that ?

Any inputs would be appreciated. THANKS


I believe this would require creating a custom content handler for the text/xml MIME type. This is possible but non-trivial.

You can’t do anything useful with malformed XML so immediately rejecting it in the content-handler layer is valid in my opinion.


Ditto on the custom content handler.

I wonder if an XQL query to get the src from the root node might work. I dunno if the nodes record the raw string or not, but it might worth a try to see if the original string is intact at the root node and thus recoverable for logging purposes.

If the xml is posted as a contentStream (text/unknown) instead of xml node (text/xml) then we can get the XML string and save for auditing.


How does that suggestion help with this issue? The problem is that a partner is sending malformed XML with a content-type of text/xml. On an ongoing basis, their company wants to log the malformed XML in addition to rejecting it. Asking the partner to change the content type would not seem to help.