Page 1 of 1

Coverting XML to a string

Posted: Thu Jul 07, 2016 12:25 pm
by tom77
Hi,

We need to insert xml data into our stub test database as a string.

I'm using oxygen v15. Does this function exist? I've had a look but can't see any obvious way to do this.

Many thanks,

Tom

Re: Coverting XML to a string

Posted: Thu Jul 07, 2016 12:29 pm
by Radu
Hi Tom,

I'm not sure what you mean by "string". The entire XML content is a string of characters. Maybe you can save it directly as it is.
Do you want to escape characters like "<" and ">"? If you open the XML in the text editing mode, select all, right click and use the action Source->Escape Selection you have various options to escape the XML content there.

Regards,
Radu

Re: Coverting XML to a string

Posted: Thu Jul 07, 2016 12:35 pm
by tom77
Thanks Radu,

To clarify, to want to remove the indent/formatting so that the xml is a single row of text.

Previously, I have used firefox, i.e. copy the formatted xml into the firefox url, then copy from there into notepad or directly into the sql insert statement.

However, for some reason this method has become inconsistent - i.e. whitespace can get removed which makes the xml invalid.

I am not looking for any characters to get removed.

Thanks again,

Tom

Re: Coverting XML to a string

Posted: Thu Jul 07, 2016 1:23 pm
by Radu
Hi Tom,

If you select the entire content, you can right click and choose Source->Join and Normalize lines.
But I still do not understand why the database would not allow line breaks in the cell data content.

Regards,
Radu

Re: Coverting XML to a string

Posted: Thu Jul 07, 2016 1:45 pm
by tom77
Radu,

Thanks a lot - this has resolved my issue!

The development resource who is helping me with this has asked for the xml in this format purely to keep the rows tidy and easy to view.

Thanks,

Tom