How to represent xml as string in other xml (SGRS-grammar)



Good day!


I try to create xml with some rules of service and one of this- insert into tag sgrs-grammar (like a string).


like this, i think:



<body>sgrs-grammar as string</body>


So, i need to escape symbols at sgrs-xml grammar: (wiki example)



<?xml version="1.0" encoding="utf-8"?>
<grammar xml:lang="en-US" root="MainRule" mode="voice" tag-format="semantics/1.0" version="1.0" xmlns="http://ift.tt/1eO8WCa">
<rule id="MainRule">
<item>
<ruleref uri="#FirstName" />
</item>
<tag>out = rules.FirstName.Firstnameslot</tag>
</rule>
<rule id="FirstName">
<one-of>
<item>tom<tag>out.Firstnameslot = "tom";</tag></item>
<item>sam<tag>out.Firstnameslot = "sam";</tag></item>
</one-of>
</rule>
</grammar>


So, i try to get it simplest way: use XDocument.Load("sgrs.xml");


At Visual Studio i get this string:



"<grammar xml:lang=\"en-US\" root=\"MainRule\" mode=\"voice\" tag-format=\"semantics/1.0\" version=\"1.0\" xmlns=\"http://ift.tt/1eO8WCa\">\r\n <rule id=\"MainRule\">\r\n <item>\r\n <ruleref uri=\"#FirstName\" />\r\n </item>\r\n <tag>out = rules.FirstName.Firstnameslot</tag>\r\n </rule>\r\n <rule id=\"FirstName\">\r\n <one-of>\r\n <item>tom<tag>out.Firstnameslot = \"tom\";</tag></item>\r\n <item>sam<tag>out.Firstnameslot = \"sam\";</tag></item>\r\n </one-of>\r\n </rule>\r\n</grammar>"


So , am i right?


If i insert it into output xml- will it be a valid output xml with tag: "sgrs-grammar xml as string"


Thank you!


No comments:

Post a Comment