web api mvc中的Xml响应

时间:2017-11-10 12:14:19

标签: xml asp.net-web-api

在具有字符串格式的单个对象中的XML响应中获取Web API。但我在XML中遇到postman时遇到问题,它有像

这样的值
<?xml version=\"1.0\"?><?xml-stylesheet type=\"text/xsl\" href=\"cda.xsl\"?>\r\n<ClinicalDocument xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:sdtc=\"urn:hl7-org:sdtc\" moodCode=\"EVN\" xmlns=\"urn:hl7-org:v3\">\r\n  <realmCode code=\"US\" />\r\n  <typeId root=\"2.16.840.1.113883.1.3\" extension=\"POCD_HD000040\" />\r\n  <templateId root=\"2.16.840.1.113883.10.20.22.1.1\" extension=\"2015-08-01\" />\r\n  <templateId root=\"2.16.840.1.113883.10.20.22.1.2\" extension=\"2015-08-01\" />\r\n  <id root=\"2.16.840.1.113883.3.9999999989\" extension=\"EP_CCD_2017-November\" />\r\n  <code code=\"3

它应该像

<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="cda.xsl"?><ClinicalDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sdtc="urn:hl7-org:sdtc" moodCode="EVN" xmlns="urn:hl7-org:v3">  <realmCode code="US" />  <typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040" />  <templateId root="2.16.840.1.113883.10.20.22.1.1" extension="2015-08-01" />  <templateId root="2.16.840.1.113883.10.20.22.1.2" extension="2015-08-01" />  <id root="2.16.840.1.113883.3.9999999989" extension="EP_CCD_2017-November" />  <code code="3

1 个答案:

答案 0 :(得分:0)

邮差是escaping个字符

Postman通过在"前放置\来逃避library(grid) library(ggplot2) class <- (c(rep(1,4),rep(2,4), rep(3,4), rep(4,4), rep(5,4), rep(6,4), rep(7,4), rep(8,4))) rating <- rep(c(1,2,3,4),8) proportion <- c(0.3304, 0.4241, 0.1305, 0.1150, 0.4119, 0.4016, 0.1026, 0.0839, 0.2831, 0.4279, 0.1493, 0.1397, 0.1150, 0.1305, 0.4241, 0.3304, 0.1305, 0.1150, 0.4241, 0.3304, 0.3304, 0.4241, 0.1150, 0.1305, 0.1150, 0.3304, 0.4241, 0.1305, 0.1150, 0.1305, 0.4241, 0.3304) df <- data.frame(class,proportion,rating) df$class <- as.factor(df$class) df$rating <- as.factor(df$rating) lev <- levels(df$class) nlev <- length(lev) angs <- seq(pi/2,-pi-2*pi/nlev,-2*pi/nlev) xpos <- cos(angs)*.4+0.5 ypos <- sin(angs)*.4+0.5 grid.newpage() for (k in 1:nlev) { pushViewport( viewport(x=xpos[k], y=ypos[k], w=.1, h=.2) ) p <- ggplot(aes(x=1, y=proportion, fill=rating), data=subset(df,class==lev[k])) + geom_col(show.legend=F) + theme_void() + ggtitle(lev[k]) g <- ggplotGrob(p) grid.draw(g) popViewport() } 字符。

这不应该在ASP.Net Web Api中解析时出现问题。