Skip to main content
Participating Frequently
June 23, 2008
Question

How to Convert as XML from SGML using FrameMaker

  • June 23, 2008
  • 7 replies
  • 2314 views
I have SGML files created by FM Structured App. I wanted to convert all these SGML files to XML files and save into Oracle XMLDB database.Any idea,like using FDK or any other way.
Please let me know.
Thanks in advance!!!
Saket
This topic has been closed for replies.

7 replies

Legend
October 19, 2008
Saket,

I'm not clear on what the problem is... is it the missing attributes or the improper element tag (Graphic vs. graphic)? In either case, I'd think this is a simple read/write rules issue. Do you have read/write rules set up for the graphic element?

Russ
Participating Frequently
October 17, 2008
Russ,
I am able to convert XML from SGML using F_ApiSave method.
SGML file has images. When i am converting, it is converting all the other tag properly except Graphics tag. Converted Graphic tag looks like this but it should be like this . I tried to fix the EDD also but nothing is working for me.
Can you please give me some direction.
Thanks
Saket
Inspiring
June 25, 2008
Saket, Russ,

You may not need the FDK at all. You can put the SGML documents into one directory and then use File > Utilities > Convert Structured Documents (in FM 7) or File > Structure Tools > Utilities > Convert Structured Documents (in FM 8) to import them all into FM. Then use Convert Documents to Structured Format to export the FM versions to XML.

Do all the SGML documents use the same application? Is there an XML version of the DTD available? If you need to create an XML DTD, you can generate it from the EDD, but you may need to change some of the general rules. I often use exclusions in my EDDs as well as general rules with expressions that are not permitted in XML. For example, I may have the general rule:

title?, (#PCDATA | emphasizedphrase | xref)*

in the EDD but

(#PCDATA | title | emphasizedphrase | xref)*

in XML. Thus, the EDD restricts a title to the beginning of the defined element, where the DTD allows titles throughout the content. All content that is valid in FM will be valid in XML. The reverse is not true, but doesn't matter if the editing is being done in FM. I put both expressions in the EDD as general rules but use conditional text to distinguish them. I also make the exclusions conditional. Then I show or hide one set of conditions to import element definitions into FM documents and reverse the show/hide settings to create a DTD from the EDD.

--Lynne

Participating Frequently
June 24, 2008
Thanks Russ!!!
I will try and let you know, how it works.
Saket
Legend
June 24, 2008
Saket,

Provided that you have (or are willing to build) an XML structured application built to export the XML, this seems like a good approach. With the FDK, you can open the files with your existing SGML application with the FS_StructuredOpenApplication property for F_ApiOpen(), then switch to the XML application when using F_ApiSave(). It should be reasonably straightforward, though admittedly I've never tried it.

Russ
Participating Frequently
June 24, 2008
Thanks for reply, but i wanted to use FrameMaker to convert the file from SGML to XML. Because these SGML files is generated by FrameMaker and FrameMaker has feature to export the file as XML. I want use FrameMaker FDK to accomplish this task.I wanted to know that my approach is correct or not.
Inspiring
June 24, 2008
Hi Saket,

Outside of Framemaker, you could try JAmes Clark's SX Tool ( http://www.jclark.com/sp). It does not do well SDATA and NDATA entities, however.

Ken Holman from CraneSoftwrights has made a python-based tool "n2x" (http://www.CraneSoftwrights.com/resources/n2x) that works together with Clark's sw to handle the missing parts.

It should be also possible to read the original SGML to frame with the sgml application, then have a corresponding XML application to save the structured files to XML. If you have not used some tricky SGML, it should work. I've done similar things with success using Arbortext/PTC editor.

Martti