Oct 08, 2010

Online tool to convert a long query/xml/content to string and assign to a variable

Generally, it is required for a developer to convert a long query/xml/content to string and assign to a variable in the code. There is online utility to do this. Suppose you have to convert following to string and assign to a variable str in c#.

<book id="bk101">

<author>Gambardella, Matthew</author>

<title>XML Developer's Guide</title>

<genre>Computer</genre>

<price>44.95</price>

<publish_date>2000-10-01</publish_date>

<description>An in-depth look at creating applications

with XML.</description>

</book>

Then you need to select Split criteria, Method type, quote type and click on Convert button.

long string to variable techbrij tools

Split Criteria:

1. Use existing line breaks: It will perform operation on existing line.

2. Merge all lines and split fixed length: It will merge all lines and split with user given fixed length and performed operation on this.

Join Method:

1. Append Method: It will use append method to join lines.

2. += Method : It will join lines in += format.

3. Use + at End of line

Quote Type:

Single Quote String and Double Quote String

You need to select proper options and click on convert button to get output. The main thing, I like the most is If I select Single Quote then it will replace all existing single quote with escaped quote(\') and same for double quote.

Update: Visit New Tool: BrijPad. It has many advanced features.

Hope, It helps.