Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Excerpt


Expand

The way that HTTP collector, exporter and header objects handle newlines in data depends on the data type.

String, XML and HTML

HTTP objects retain all newline characters in HTTP and XML data. To strip the newlines, add the following expression to the attribute expressions that use the data from the HTTP object

Code Block
.replaceAll(in.value, "[\r\n]", ""

XML

As PhixFlow cannot include newlines in an attribute value, it automatically replaces newlines in JSON with a space. If you want the data to indicate where the newlines were, in the Statement Expression, specify the escape character \n.

In the following sample of JSON, the paragraph symbol  indicates a newline character.

Code Block
{
  “line1” : “Single line of text" 
  “line2” : “Also a single 
line of text” 
 “line3” : “Multiple lines of↵
 text split over↵several lines” 
}

By default a HTTP collector retrieves...

Not sure how to deal with this for Headers and Exporters....

Code Block
{“line1” : “Single line of text" “line2” : “Also a single line of text”, “line3” : “Multiple lines of text split over several lines” }

in the Statement Expression, specify ??? to return a string with the newline indicated by /n.


Code Block
{“line1” : “Single line of text" “line2” : “Also a single line of text”, “line3” : “Multiple lines of/ntext split over/nseveral lines” }



Tip

HTTP collectors and exporters:

  • replace newlines with spaces in JSON data. To retain newlines, see Statement Expression.
  • retain all newline characters in HTTP and XML data. To strip the newlines, add the following expression to the attribute expressions that use the data from the HTTP collector or exporter.
Code Block
.replaceAll(in.value, "[\r\n]", ""

JSON data automatically replaces newlines with spaces.


Used in File ExporterFile Collector

...