Hi all,
Our goal here is to copy or import snippets of real, tested code into our Frame documents where whitespace and paragraph breaks are recognized, and we can roundtrip to and from xml.
First, we tried just copying the content of the text directly into a codeblock element in our Frame docs. This saves find to XML but when we open it back up in Frame, the whitespace is retained but the para returns are gone. Then we tried copying it directly into the codeblock elements inside the XML document, but when we opened it in Frame, the parser complained about various characters, particularly that used for a reference pointer in C++ (MyClass&, for instance) with the message "Expected entity name for reference" -- it expected an entity to have been declared when it saw the "&" character.
Then we tried importing the code as text insets. Of course, there are many ways to import text insets, and one is as XML fragments. When we try to import an xml fragment containing the code, something like this:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/C:/Program Files/Adobe/FrameMaker8/structure/xml/xdocbook/app/xdocbook.css" type="text/css"?>
<codeblock>
void HelloWorldService::invoke(const MyClass& param)
{
...more code here
}
</codeblock>
The parser then errors with the same as before -- "Expected entity name for reference", at the reference pointer, and if we try to import our own XML files, it of course complains that it our DTD doesn't know anything about the elements, which of course it doesn't.
So then we tried importing just plain text, i.e. just a text file containing the code, within a codeblock element in Frame. This worked great and whitespace and para returns were retained in the Frame -- at first. But when we saved to XML, the text inset was not saved as an entity; rather just text. So when we opened the file back up in Frame, the text was no longer an set, i.e. was editable, and the para returns were gone.
So I have two, related questions:
1. Is there a recommended way to either copy or import text (in our case, code) into Frame and have paragraph returns retained?
2. If a text inset is the way to go, is there a read/write rule that will cause Frame to generate an entity for the imported text rather than simply generating the text itself?
Thanks very much in advance for any help.
-- Shelley
Rogue Wave Software