Coverting XML to a string

Questions about XML that are not covered by the other forums should go here.
tom77
Posts: 3

Coverting XML to a string

Thu Jul 07, 2016 12:25 pm

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
Radu
Posts: 5571

Re: Coverting XML to a string

Thu Jul 07, 2016 12:29 pm

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
tom77
Posts: 3

Re: Coverting XML to a string

Thu Jul 07, 2016 12:35 pm

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
Radu
Posts: 5571

Re: Coverting XML to a string

Thu Jul 07, 2016 1:23 pm

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
tom77
Posts: 3

Re: Coverting XML to a string

Thu Jul 07, 2016 1:45 pm

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

Return to “General XML Questions”

Who is online

Users browsing this forum: No registered users and 1 guest