【发布时间】:2015-05-08 02:55:45
【问题描述】:
我需要使我的 xml 成为一个有效的字符串,以便我们可以将它输入到解析器中。出于某种原因,我无法获得有效的字符串。我们拥有的所有示例都更像是一个缩写版本,但这一个需要是完整版本(即 Canvas.Clip)。我的问题是,如何制作以下有效代码?
static const char* pCanvasData = "\
<Canvas>\
<Canvas.Name = \"Test\" />\
<Canvas.RenderTransform = \"1, 0, 0, 1, 0, 290\" />\
<Canvas.Opacity> = \"0.5\" />\
<Canvas.Clip = \"M 40,75 H 30 V 25 Z\" />\
<Path Fill=\"#FFFF0000\" />\
<Path.Data>\
<PathGeometry>\
<PathFigure StartPoint=\"30,70\" IsClosed=\"true\" />\
<PolyLineSegment Points=\"110,170\" />\
<PolyLineSegment Points=\"80,170\" />\ **********this is where the compiler says "error missing closing quote" and last PolyLineSegment is the wrong color (black instead of red), but it turns red again at the last quote of "80,170\" />\
</PathFigure>\
</PathGeometry>\
<\Path.Data>\
</Canvas>";
可能缺少报价,但我没有看到。此外,斜杠可能缺少一些东西,因为这是第一次为这种类型的 xps 做非缩写 xml。我会很感激任何帮助!只是为了避免任何问题,我们不能将 xml 提供给 xml 类。我需要这里的 char*。
【问题讨论】: