Passing values containing < > in XML generator with "Escape special characters" turned ON

Hi,

I’ve some fields containing < > (html tags) that needs to go into XML generator and provide desired output however the fields come in as a raw string and doesn’t do it’s work as “Escape special characters” in XML generator has been turned ON. If this option is turned off, the pipeline doesn’t even run.

Any workaround on how to ingest <> in XML generator with the pipeline running as well?
Thanks!

Best Regards,
DT

1 Like

@alchemiz: This should work for generating html files as well, right?

While I appended some tags as seen in the snap below, I wanted them to function like native html tags however it is just printing them:

As per my understanding, a href =" "> should have been hyperlinked to ClickMe and
should have brought the remaining text to the next line. Any suggestions would be really appreciated.

Regards,
DT

Hey @darshthakkar,

The logic for dynamically creating URLs can be done in a mapper just before the XML Generator, and in the generator you can simply access that incoming field within the “a” tag, like this:

<a href="$URL">Click me</a>

Try this and let me know if it works for you.

1 Like

That’s exactly what I’ve done but when this URL goes into XML generator, it prints the same ‘<a href’ instead of displaying it as a link [snap below for reference]

Can you send one chunk of the HTML? Link included

1 Like

Thank you @bojanvelevski for offering your help.
Attaching a normal .txt file whose contents goes into “Edit XML” under XML generator.

editXMLContent.txt (182 Bytes)

The file fetches some values, which are the columns from previous mapper snap (e.g. htmlBody1, htmlBody2, etc. would be column values and the last htmlBody4 is the URL in the format left angular bracket(<) *a href = https://www.google.com>*Link_1</a right angular bracket(>)

Try double quoting the url like I mentioned before:

<a href="$URL">Click me</a>

As I can see, you’re referencing the incoming field without quotations, that’s why it is not treated as a proper attribute (href).

1 Like

I tried opening the final html file in notepad++ while I was testing the solution and what I found was that the tags get converted to predefined snapLogic letters like the one seen in the link below:

Link 1: https://docs-snaplogic.atlassian.net/wiki/spaces/SD/pages/1439280/XML+Generator
Link 2: The XML FAQ: What are the special characters in XML?

Moreover, putting double quotes in

<a href = >

is challenging too as the URL intakes some variables too, so you may consider the URL to be

https://www.google.Name.ID.com

How do you type this in a reply? I couldn’t post anything with <a href="> as you can see I’m missing opening quotes.

With the help of the “Preformatted text” option.
Wrap the text in backticks

1 Like
<a href = "Does this work">Yes,it works!></a> THANK YOU!

That’s why I suggested to do the transformations before the XML Generator. Create the URL link , and just pass it like a variable into the XML Generator.

1 Like

URL generation and transformation is actually happening in the parent pipeline and its way before the XML generator (which is in child pipeline)

Values inside tags like < >, etc can not be ingested into XML Generator without any customization. By default, those values will be converted to snapLogic’s predefined symbols which can be found in the below 2 links:
Link 1
Link 2

I went with a different route for my development so the concern I was having has been resolved. Instead of passing those values inside < > (native html tags) inside an XML generator, I defined the html format in mapper/file writer itself so the format took care of the required output. Remember, the file name should be .html (if the use case is to generate html files; the format could be different as per the use case) to see these changes happening.

The suggestions/solution given above on this thread may work, I haven’t tried it and there is another thread discussing the same: Similar Thread_1

Signing off from this thread!