Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Can't save ]]> in document text to XML

Advocate ,
Jun 29, 2011 Jun 29, 2011

Dear colleagues,

I am currently evaluating a Save-as-XML problem with FrameMaker 9.0p255. The content of the document shows some XML examples which contains CDATA sections, like

<environment>

  <var name="service"><![CDATA[Inhalt]]></var>

</environment>

Reminder: This is in the text of the FrameMaker document.

When I save as XML, the XML parser complains: »Error at line 140, char 77, Message: The sequence ']]>' is not allowed in character data«

When I open the XML file in a XML editor I see that all < are correctly escaped as &lt; and all > are left as is. The built-in Xerxes parser also reports: »The character sequence "]]>" must not appear in content unless used to mark the end of a CDATA section.«

And the XML Recommendation says:

The right angle bracket (>) may be represented using the string " &gt; ", and must, for compatibility, be escaped using either " &gt; " or a character reference when it appears in the string "]]> " in content, when that string is not marking the end of a CDATA section.

It seems to me FrameMaker should either write all > as &gt; to avoid the possibility that it might be used after ]].

Can you reproduce this issue (I can using the UserGuide structured application, by just putting ]]> in any element)?

Have you found a way to workaround this, maybe with a special R/W rule?

Thanks,

- Michael

TOPICS
Structured
3.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advisor , Jun 30, 2011 Jun 30, 2011

Michael,

  As long as you are using a DTD, there's an easy workaround. Define an entity for the right square bracket and use a r/w rule that maps the entity to this character. In fact, if you call the entity rsqb, and your r/w rules include the default reference to isoall.rw, you don't even need to add a rule. Instead of defining the entity in your DTD, you could, of course, simply include ISOnum.

  Anyway, with the entity defined and rule, FM writes "&rsqb;&rsqb;>" instead of "]]>".

     --Lynne

Translate
Advocate ,
Jun 30, 2011 Jun 30, 2011

Follow-up: Same thing with FrameMaker 10.0.1.402. Add ]]> into any structured document, and try to save as XML.

I guess one could write a custom client processing every text segment to look for this character sequence, but it should be handled by the application, shouldn’t it?

- Michael

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Jun 30, 2011 Jun 30, 2011

Hi Michael,


I've actually bumped into this before. My solution was to stop using that string. Somehow I was able to do that without any major upset but that may not be an option for you... in any case, it certainly is a bug. I'm guessing that it is a slim likelihood of anybody bumping into this, hence its perseverance through the years.

Maybe consider posting this to the FrameSGML forum on Yahoo. Sometimes people like Lynne Price come up with obscure solutions to stuff like this that you might never guess.

Russ

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jun 30, 2011 Jun 30, 2011

Not that it'll help in your current situation, but if you're using DITA and DITA-FMx, the problem doesn't exist. The DITA-FMx import/export client provides the necessary processing to make the proper transformation.

Hmm .. I suppose that you could set up an export XSLT script to fix things up as well .. ?

Cheers,

...scott

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jun 30, 2011 Jun 30, 2011

Michael,

  As long as you are using a DTD, there's an easy workaround. Define an entity for the right square bracket and use a r/w rule that maps the entity to this character. In fact, if you call the entity rsqb, and your r/w rules include the default reference to isoall.rw, you don't even need to add a rule. Instead of defining the entity in your DTD, you could, of course, simply include ISOnum.

  Anyway, with the entity defined and rule, FM writes "&rsqb;&rsqb;>" instead of "]]>".

     --Lynne

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jun 30, 2011 Jun 30, 2011

Lynne, wow!

Someone suggested to me off-line to wait for some magic from your direction...

I tried the entity way but run into problems: I had an old version of the DTD in the target folder of the XML file and this was apparently used, so the entity rule from the R/W file never kicked in.

Here’s what I did per your suggestion:

To the R/W rules file I added: entity "rsqb" is fm char 0x005D;

To the DTD I added: <!ENTITY rsqb "&#x5D;">

Now what happens is:

  • FrameMaker creates &rsqb; for every ], effectivle writing "]]>" as "&rsqb;&rsqb;>"
  • My XSL post-processing takes this and the output from the correctly working processor is then fully XML-compliant: "]]&gt;"

Thanks a lot!

- Michael

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jul 01, 2011 Jul 01, 2011
LATEST

Michael,

  You are quite welcome and glad I could help.

  And yes, "&rsqb;&rsqb;>" and "]]&gt;" are valid in XML as are "&rsqb;&rsqb;&gt;", "]&rsb;>", and so on. You have three characters; at least one of them has to be represented by an entity reference or character reference.

           --Lynne

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