Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Spurious newline characters in xml form data

Avatar

Level 1

I have been given a pdf form(XFA).  I have a button that the end user can click and when they do so, it posts the form data as XML to a url.  The problem I am having is that it seems to be adding in newline characters like so:
<?xml version="1.0" encoding="UTF-8"?>
<topmostSubform><b12c96nfCert_Nbr>1234
</b12c96nfCert_Nbr>
<b12c96nfOwnship_ID
/>
</topmostSubform>

(this isn't complete stream, just a small sample.  The newlines are screwing up my xml parser.  Is there any way I can prevent this, or post lean xml with no whitespace?

I have been stripping newline characters inside my service, but obviously this is less than ideal.

When I save the xml directly out of the pdf, it contains these newline characters as well.  How can I remove them?


With Respect,

mattie

0 Replies

Avatar

Level 10

You could use a regular expression. For example,

var str = this.rawValue;
this.rawValue = str.replace(/\r|\n/g,"");

will globally replace carriage returns (\r) or line feeds (\n) with "".

Steve