Highlighted

where should i place the 'xml:space = preserve'

New Here ,
Sep 11, 2015

Copy link to clipboard

Copied

Hi,

I use FM12. I want to preserve empty lines ( and more linebreaks [shift + return] between code text ).

If FM12 import my XML file, additional line breaks will be deleted.

In the Read/Write rules I've placed a statement

element "Code" {

      reader line break is forced return

}

didn't work for me.

In the FM Help Files I've found the following hint : "place a attribute xml:space="preserve" at the element ..."

My Question: Where should I place this attribute?

1.) in the DTD file?

2.) in the EDD file?

3.) in the Read/Write Rules?

4.) in an additional configuration file?

Thanks for any help!

M.

Hi Mathias...

I use this ..

element "codeblock" {

  writer line break is 99999 characters;

  reader line break is forced return;

}

but I think you can use this as well ..

element "codeblock" {

  preserve line breaks;

}

To include the xml:space attribute you'd add that to both the EDD and the DTD.

Cheers,

...scott

TOPICS
Structured

Views

1.0K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

where should i place the 'xml:space = preserve'

New Here ,
Sep 11, 2015

Copy link to clipboard

Copied

Hi,

I use FM12. I want to preserve empty lines ( and more linebreaks [shift + return] between code text ).

If FM12 import my XML file, additional line breaks will be deleted.

In the Read/Write rules I've placed a statement

element "Code" {

      reader line break is forced return

}

didn't work for me.

In the FM Help Files I've found the following hint : "place a attribute xml:space="preserve" at the element ..."

My Question: Where should I place this attribute?

1.) in the DTD file?

2.) in the EDD file?

3.) in the Read/Write Rules?

4.) in an additional configuration file?

Thanks for any help!

M.

Hi Mathias...

I use this ..

element "codeblock" {

  writer line break is 99999 characters;

  reader line break is forced return;

}

but I think you can use this as well ..

element "codeblock" {

  preserve line breaks;

}

To include the xml:space attribute you'd add that to both the EDD and the DTD.

Cheers,

...scott

TOPICS
Structured

Views

1.0K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sep 11, 2015 0
Advisor ,
Sep 11, 2015

Copy link to clipboard

Copied

Hi Mathias...

I use this ..

element "codeblock" {

  writer line break is 99999 characters;

  reader line break is forced return;

}

but I think you can use this as well ..

element "codeblock" {

  preserve line breaks;

}

To include the xml:space attribute you'd add that to both the EDD and the DTD.

Cheers,

...scott

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 11, 2015 0
Adobe Community Professional ,
Sep 11, 2015

Copy link to clipboard

Copied

Mathias,

     The W3C recommendation that defines XML, defines the xml:spacexml:space attribute, with possible values "preserve" and "default", that can be used in an XML document instance. While an application is not required to use the attribute value to control the way it processes content, "preserve" signals the intent that white space is significant and "default" leaves processing of white space entirely to the application. Any DTD or schema must declare the attribute if it is used.

     FM 12 and FM 2015 do use this attribute. As a test case, I created the following document:

<?xml version="1.0" encoding="UTF-8"?>
<document>
     <paragraph>how now     brown cow</paragraph>
     <paragraph xml:space="preserve">how now    brown cow</paragraph>
     <paragraph/>
     <paragraph>    how now brown cow    </paragraph>
     <paragraph xml:space="preserve">    how now brown cow    </paragraph>
     <paragraph/>
     <paragraph>how now
brown cow</paragraph>
     <paragraph xml:space="preserve">how now
brown cow</paragraph>
</document>

As you can see, it has three pairs of paragraphs. The content of both paragraphs in each pair is identical, but the first member of the pair does not set the attribute and the second one does. The three pairs use white space in different places. The results were:

1. In all three cases, the first paragraph in each pair had the content "how now brown cow" with no leading or trailing spaces and no sequence of multiple spaces.

2. The attribute was preserved in FM and visible in the Structure View.

3.  The second paragraph in each pair included the extra white space:

       a. In the first pair, the second paragraph had multiple spaces in the middle.

       b. In the second pair, the second paragraph had leading and trailing spaces.

       c. In the third pair, there was a forced return in the middle.

Furthermore, when I saved the FM document back as XML, this white space was written back to XML for the second paragraph in each pair. For the first paragraphs, the extra white space was not written back to XML since it was discarded when the original file was opened.

     --Lynne

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 11, 2015 0