我需要将我的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 *。
似乎您在“ \”后可能有多余的空白字符。只需将鼠标光标放在该行之后,然后按一下擦除按钮即可。
如果您选择“查看”->“显示符号”->“显示空白和TAB”,则实际上可以在Notepad ++中看到它
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句