Skip to main content
Van Kurtz
Inspiring
December 9, 2009
Question

How should the DOCTYPE statement appear when saving as XML?

  • December 9, 2009
  • 1 reply
  • 1824 views

This seems so trivial, but I cannot figure it out.

When I save a Frame file as XML, the DOCTYPE statement is written as

<?DOCTYPE ..... ?>

instead of

<!DOCTYPE ..... >

I noticed this because Frame exports the content of empty table cells as the nobreaking space entity. When I try to open the XML file in a browser, the browser cannot parse the nobreaking space entity, even if I include its definition in the ?DOCTYPE statement. Changing the DOCTYPE statement to <!DOCTYPE ... > makes the ENTITY definition visible to the browser.

What am I missing?

Thanks,

Van

This topic has been closed for replies.

1 reply

Inspiring
December 10, 2009

Van,

Could it be your structured application uses XSL post-processing that creates this processing instruction with the name DOCTYPE? AFAIK a doctype statement always starts with <!DOCTYPE

- Michael

Van Kurtz
Van KurtzAuthor
Inspiring
December 10, 2009

Michael,

There is no post-processing by an XSLT.

If I save the fm file as xml and then open the xml file in FrameMaker, it opens correctly, even though the DOCTYPE statement begins with a question mark and not an exclamation mark. It is as if FrameMaker at least knows how to read its own XML output.

I am assuming that the DOCTYPE name can be the same as the name of the root element. Is this correct?

Is there anything I need to do in the read/write rules that would output the correct form of the DOCTYPE statement?

The problem that cause me to notice this is that FrameMaker exports an empty table cell by inserting the entity   (nonbreaking space). To open the XML with a browser, I apply an XSLT that converts the XML into HTML. The browser complains that it cannot parse the nonbreaking space entity, even though it is listed in the XSLT file as

<!DOCTYPE xsl:stylesheet  [
    <!ENTITY nbsp   "&#160;">
]>

If I add the ENTITY statement to the DOCTYPE statement in the XML file, the browser still complains that it cannot parse it. When I further change the ?DOCTYPE statement to !DOCTYPE, then the browser can parse the nonbreaking space entity. That is what caused me to notice the incorrect form of the DOCTYPE statement.

SO, I am trying to resolve the DOCTYPE issue first, before trying to fix the ENTITY problem.

Hope this helps,

Van

Ian Proudfoot
Legend
December 10, 2009

Van,

The DOCTYPE statement is optional, FrameMaker's parser just sees the <?DOCTYPE... ?> as an XML processing instruction which is ignored as it means nothing to FrameMaker. It certainly will not allow the the correct definition of the entities.

The DOCTYPE must be the same as the root element.

Which FM version are you running? Are you using one of FrameMaker's built-in XML applications or your own? Is there an import/export client referenced by the application?

Regards

Ian