Represent space and tab in XML tag

前端 未结 8 1441

How to represent space and tab in XML tag. Is there any special characters for them to represent.

8条回答
  •  失恋的感觉
    2020-11-29 05:48

    Illegal XML Tag Name Characters can be encoded using Unicode UCS-2. This works very nicely. I am using it to create XML that gets turned into json (JPath is weak compared to XPath). Notice the handling of spaces, (, ) characters. Unicode UCS-2 Code Chart: http://www.columbia.edu/kermit/ucs2.html

            tag.Name = tag.Name.Replace(" ", "_x0020_");
            tag.Name = tag.Name.Replace("(", "_x0028_");
            tag.Name = tag.Name.Replace(")", "_x0029_");
    

    XML:

      {CHARGEBACKCODE}
      {CHARGEBACKCODE}
      zzz@yyy.gov
    

    transformed to json via json.net:

        "Internal Chargeback ID": "{CHARGEBACKCODE}",
        "Bill To": "{CHARGEBACKCODE}",
        "Operator or Directly Responsible Individual (DRI)": "xxx@yyy.gov",
    

提交回复
热议问题