Function sanitise_xml

Source
pub fn sanitise_xml(xml: String) -> String
Expand description

§CORRECT FORMATTING ERRORS IN RAW XML

When reading certain entity sets from SAP’s demo OData service GWSAMPLE_BASIC, various formatting errors have been noticed that will cause an XML parser to throw its toys out of the pram.

Whether these errors also occur in other SAP-delivered OData services has not been determined; however, coding is included here to correct those errors detected so far in GWSAMPLE_BASIC

  1. Correct potentially invalid m:etag attribute values on an <entry> tag:

    <entry m:etag="W/"datetime'2023-08-31T01%3A00%3A06.0000000'"">

    Is corrected to:

    <entry m:etag="datetime'2023-08-31T01%3A00%3A06.0000000'">
  2. Entity set content properties containing text descriptions are not enclosed in double quotes, neither is it the convention to escape or character encode special characters. E.G.:

    <d:Category>PDAs & Organizers</d:Category>

    Is corrected to:

    <d:Category>PDAs &amp; Organizers</d:Category>