Skip to main content
Participating Frequently
January 19, 2009
Question

Hard Carriage Returns on Paragraph and XML

  • January 19, 2009
  • 3 replies
  • 1421 views
Hi,

I'm still running FM 7.2, I have 8.0, but we are not ready as a company to move yet.

I am capturing legacy FM information and need to save as XML.
This information will at times have paragraphs that used hard carriage returns to build in separation and make things easier to read.

When we export this XML, these hard CRs are removed and all extra white space is compressed out of the element.

This is causing much grief for the people reading the documents and they have asked if I can retain the hard breaks.

I've looked into the Structured Application and found nothing. I've looked at the ReadWrite Rules files in hopes I could map the hard break to a element of some kind, or something like that. I'm not finding any solutions.

Is there a way to keep this information in the resulting XML file?

Thanks,

- mike
This topic has been closed for replies.

3 replies

Participating Frequently
February 2, 2009
Hello Mr. Hare,

you might try the following:

1. Adjust the template of your structapp to contain a variable named "hardreturn" whose definition is "\n" (without the quotiation marks).

2. In your R/W-Rules, write: entity "hardreturn"is fm char 0x09;

3. In every FM-Document you want to save as XML
a. also add the variable
b. assign the structapp

4. ..and do the following
a. insert the variable "hardreturn" somewhere and copy it into the clipboard, and delete the variable from your insertion point
b. Search for "\p\p" (=two consecutive hard returns, i.e. an "empty line" or for "\x09" (= a soft return) and "change" "by pasting".
The result should be a variable "hardreturn, wherever \p\p or \x09 was.

If you save this as XML, the \x09 from the variable should survive as an entity.

Hope this helps.
With kind regards,
Franz.
[ excess signature removed by host ]
Participating Frequently
January 20, 2009
Thanks Michael.. I'll give that a try..
Inspiring
January 20, 2009
Mike,

there is a read/write rule instruction "preserve line breaks" to keep line breaks (Shift+Return) as line breaks in the XML. It is a little bit hard to parse this if you want to further process the documents and not very XML-stylish, because in most other places whitespace is not important.

I recommend including an empty element
with a formatting rule that creates a prefix or suffix of "\n".

- Michael Müller-Hillebrand