IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Stuck with line break in string, .json to .XML Options · View
Marcus.T
Posted: Sunday, October 6, 2019 1:18:33 PM
Rank: Member

Joined: 1/28/2015
Posts: 24
Location: Sweden
Hello, fellow map forces!

I'm currently struggling with a really simple thing I want to execute on a mapping.

I have a .json file that is mapped into a regular .xml
One string in the .json file have a text with a line break code "\n".
That code is translated to the .xml as a "
"

I want to separate the text where this code is present and have tried to do so with the "substring before"
The problem is that may force does not seem to find the code. I have tried: "\n", "
", and char-from-code with both in ASCII.
I have tried connecting the substring-before with a tokenize-regexp. With no avail...

the string looks like this:
.json: text text text\ntext text text
.xml: text text text
text text


Any ideas what's happening?


that
Posted: Monday, October 7, 2019 11:13:48 AM
Rank: Advanced Member

Joined: 6/16/2006
Posts: 486
Location: AT
substring-before with char-from-code(10) works fine in my quick test to extract the first line.
Marcus.T
Posted: Monday, October 7, 2019 2:31:17 PM
Rank: Member

Joined: 1/28/2015
Posts: 24
Location: Sweden
that wrote:
substring-before with char-from-code(10) works fine in my quick test to extract the first line.


Thanks for trying it out. It did not work here tho.
It will separate the string when it fins the number "4"

Example:

original string: "the time is now 22:49 sir"
string with your setup "the time is now 22:"

The code-from-char translates input "10" to value "49"

Am i missing something?
that
Posted: Monday, October 7, 2019 3:36:57 PM
Rank: Advanced Member

Joined: 6/16/2006
Posts: 486
Location: AT
Don't confuse char-from-code and code-from-char.
Marcus.T
Posted: Monday, October 7, 2019 7:52:36 PM
Rank: Member

Joined: 1/28/2015
Posts: 24
Location: Sweden
that wrote:
Don't confuse char-from-code and code-from-char.

How sloppy of me!
Thanks got it working now.
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.