Pages: 1
Print
Author Topic: XML source code formatting  (Read 4639 times)
vlambert
Member

Posts: 2


« on: July 16, 2009, 07:10:36 AM »

Hello,

Me and my team are currently developing the documentation for a product and we are using XMetal to do so. Up to now, we are quite satisfied, except for one detail: the xml source code has no formatting.
According to the documentation, the .ctm file is supposed to take care of that. We are using the ctm file that was generated automatically, its content is what we need (it seems to be generated from the css file for the tags-on view and the normal view). The only problem is that it is not applied to the xml document. Whatever we change in that file, it is not reflected in the source code. How do we make it work ?

Thank you for your help.

Vincent Lambert
XML Programmer
Matrox Imaging
« Last Edit: July 21, 2009, 05:47:56 PM by Su-Laine Yeo » Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2606



WWW
« Reply #1 on: July 16, 2009, 11:09:04 AM »

When a CTM file is auto-generated the global pretty printing options in the CTM file are set to disable pretty printing with the presence of an element named <NoPrettyPrinting/>

If you are using XMetaL Developer to create your customization then the settings to turn this on are located in a section of the CTM file listed as "Global" near the top of the CTM editor. Use the properties window to enable / disable pretty printing (which removes / adds the "NoPrettyPrinting" setting).

If you are editing this file with another tool (not recommended, but possible to do obviously, as it is plain text) your CTM file should have something like the following in order to have documents pretty printed:

<GlobalPrettyPrintOptions>
  <IndentAmount>2</IndentAmount>
  <MaxLineLength>80</MaxLineLength>
</GlobalPrettyPrintOptions>


And specifically, you need to remove this as it disables everything else: <NoPrettyPrinting/>

Note: When not present (due to a missing customization) both the CTM file and CSS file are auto-generated based on the schema (DTD or XSD). The schema is examined for known element and attribute names (such as <p>, <para>, <title>, <image>, <graphic>, etc) and a best guess is made based on rudimentary logic that also examines the relationship between elements (which children are allowed where).

When common names are found that match well-known schema (XHTML and DocBook among others) then the CTM and CSS files may be pretty good, but we really recommend properly designing these files even in this case if you want to give your authors a nice authoring experience. You may use the auto-generated CTM and CSS files as a starting point but they are really not meant to be used directly and in some cases it might even be best to throw them away and design them properly from scratch using XMetaL Developer (in the case where few elements are recognized, as with many US MIL spec DTDs that have virtually no human-readable element names and schema that are not written in English).
Logged
vlambert
Member

Posts: 2


« Reply #2 on: July 17, 2009, 05:41:31 AM »

Thank you for your reply, our problem is fixed now.
Logged
Pages: 1
Print
Jump to:  

email us