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

How to transfer the name of imported file from FrameMaker to XML file?

Explorer ,
Feb 02, 2020 Feb 02, 2020

Copy link to clipboard

Copied

Hi,

I have a problem while conversion from Framemaker 2019's  unstructured document to XML according to DTD. I'm working with FM for a short time (after InDesign) and I need to study in process.

I've built EDD, imported element definitions and  made the structured document with conversion table. In structured document I see the image (and its Object properties) in the document, but in Structured view it's element attributes have no values. Should I do smth to transfer these attributes? There is the only one rule for graphics in the conversion table.

 

Then after Save as XML, I've got

 

<ImageObject impby="ref" entity="ImageObject1" dpi="600" xoffset="0.000in" yoffset="0.000in"

    position="below" align="acenter" cropped="1" float="0"

    width="3.193in" height="2.185in" angle="0.000"

    nsoffset="0.000in"/>

 

where the attributes of the source Fig element are presented, some of their values match with the values from the Object Properties window, but there is no information about the name of imported file. And it should be the value of one of the attributes! 

 

Appreciate any input to go out from this circle...

TOPICS
Content migration , Structured

Views

1.3K

Translate

Translate

Report

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 , Feb 05, 2020 Feb 05, 2020

Jul,

 

Since ImageObject is a graphic, the EDD must define it to be a graphic, not a container.

 

The sample XML you've shown does not include a document type declaration (<!DOCTYPE...). Make sure the XMLApplication in the application definition file you are using (probably structapps.fm) specifies the DTD. Once that is done, if the DTD does not define an attribute named entity for ImageObject, the r/w rule you have for that element should be OK.

 

--Lynne

Votes

Translate

Translate
Advisor ,
Feb 03, 2020 Feb 03, 2020

Copy link to clipboard

Copied

Jul,

   Most XML attributes by default correspond to FrameMaker attributes. For special formatting objects such as graphics, tables, and cross-references, some XML attributes instead correspond to inherent properties of the object instead of to FrameMaker attributes. For example, there is no need in FrameMaker to have an attribute for the number of columns in a table; a FrameMaker table has columns and the number of columns is part of FrameMaker's table structure. When you save a document as XML, though, FrameMaker can generate an attribute that specifies the number of columns. When you read an XML document, FrameMaker can use an attribute to determine how many columns are needed in a table.

   Similarly, many of the properties of a FrameMaker graphic are represented in XML as attributes even though there is no need for the attributes in FrameMaker. That's why your XML has values for dpi, position, align, and so forth even though those attributes are not populated in FrameMaker.

   For an imported graphic, there are two ways that FrameMaker can identify the graphic file. One is with a file attribute and the other is with an entity attribute. If both are declared in the DTD, FrameMaker uses the entity attribute. The value of a file attribute is the name of the imported graphic file, and it sounds like that's what you want. The value of an entity attribute, which is what you are getting, is the name of an entity that is declared at the beginning of the generated XML document. If you look at the start of the XML document that FrameMaker creates, you will probably see something like:

   <!ENTITY ImageObject1 SYSTEM "filename" NDATA "notation">

where filename is the filename you want and notation is the name of a notation that is declared in the DTD. 

 

Are you using a standard DTD or are you maintaining the DTD itself? If you have full control of the DTD, simply remove the entity attribute from the attribute list for the ImageObject element. If you are using a DTD that has been given to you, use a read/write rule such as

 

   element "ImageObject" {

       is fm graphic element;

       attribute "entity" is fm attribute;

       }

 

This read/write rule tell FrameMaker that the entity attribute does not correspond to a graphic property and hence FrameMaker will use the file attribute to identify the graphic file in XML.

 

    --Lynne

Votes

Translate

Translate

Report

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
Explorer ,
Feb 03, 2020 Feb 03, 2020

Copy link to clipboard

Copied

Thank you very much, Lynne, for your detailed answer.

I have a complex target DTD, and drilling in its structure I've got that there is no equivalent for graphic element in the generated EDD. And when I build the structured doc, I see GRAPHIC in red color in structure view. Then I inserted graphic element into EDD according to the sample from documentation. Now I see graphic element in the structure (in black) but I can't find a way to transform this element into desired element ImageObject. It has its own attributes and doesn't want to become a required element.

According to your recomendation I checked the XML I've got, but there is no string with the name of file which I need. I deleted attribute 'entity' in EDD and wrote the rule you have suggested, but result was the same and 'entity' appeared again in the resulting XML. Documentation says about differences between properties available for XML and SGML, as for the 'file' attribute for example...

I have no need to change the source graphic file, I only have to put its name into descriptive target element! 

 

 

Votes

Translate

Translate

Report

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 ,
Feb 04, 2020 Feb 04, 2020

Copy link to clipboard

Copied

Jul,

    In your original message, you included an <ImageObject> element, with all its attributes, that appeared when you saved your FrameMaker document as XML. Does your EDD define ImageObject? Do you want all graphics to use the ImageObject element? 

    An element tag shown in red in the Structure View indicates an element that occurs in the document but is not defined in the EDD.  FrameMaker uses the tag GRAPHIC as a default for graphics that occur in a structured document but were created in a way that is not associated with a graphic element defined in the EDD. In particular, if you copy an image from another application or an unstructured FrameMaker document and paste it into a structured document, FrameMaker will use the name GRAPHIC for the gaphics element that it needs. You can then use Element > Change Element to change that elment to ImageObject if ImageObject is defined in the EDD. If you have multiple GRAPHIC elements you want to change, in the Find/Change pod:

 

1.   From the Find pull-down menu at the top, choose Element.

2.   In the resulting Find Element dialog box, type GRAPHIC in the Element Tag box and leave the other two boxes empty. Click Set.

3.  Back in Find/Change, from the Change pull-down menu, select Element Tag To.

4.  Click Change All.

 

Deleting the entity attribute from the EDD does not affect the attributes FrameMaker generates when writing XML. Does your DTD define an attribute for ImageObject to be used for the filename? Does it define an attribute named entity?

 

The read/write rule I suggested in my previous message tells FrameMaker not to use an XML attribute named entity for naming an entity associated with an imported graphic.  You might  need a variation of the following instead:

 

element "ImageObject" {

   is fm graphic element;

   attribute "entity" is fm attribute;

   attribute "filename" is fm property file;

   }

 

In this example, the rule for entity is only needed if the DTD defines an attribute of that name but you don't want to use it for identifying graphic files. The rule for filename tell FrameMaker to use that XML attribute to hold the filename.

 

I don't know if you will be running your conversion table again, but if so and you haven't already done so, include a row that has G: in the first column and ImageObject in the second column so that graphics in the unstructured document will be elements named ImageObject in the structured version.

 

  --Lynne

 

Votes

Translate

Translate

Report

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
Explorer ,
Feb 04, 2020 Feb 04, 2020

Copy link to clipboard

Copied

Hi, Lynne, thanks a lot!

After I have seen that red GRAPHIC element in structure, I added in Conversion table string G: -> ImageObject and changed the description of ImageObject in EDD to make it a graphic element rather than a container.

 

<can't place the printscreens... it disappear!>

Then I changed the rules file trying to get the filename:

 

element "MediaObject" {
attribute "entity" is fm property entity;
}

element "ImageObject" {
is fm graphic element;
attribute "FileRef" is fm property file;

}
/* attribute "entity" is fm attribute "entity";
*/

There are some traces of other different attempts)).

But the result stays the same:

 

<?xml version="1.0" encoding="UTF-8"?>

<?Fm Condition Comment Red SINGLE_UNDERLINE show AsIs?>
<?Fm Condition FM8_SYSTEM_HIDEELEMENT Dark%20Grey NO_OVERRIDE hide AsIs?>
<?Fm Condition FM8_TRACK_CHANGES_ADDED Forest%20Green SINGLE_UNDERLINE show AsIs?>
<?Fm Condition FM8_TRACK_CHANGES_DELETED Red STRIKETHROUGH show AsIs?>
<?Fm BoolCondExpr "Comment" State 0?>
<?Fm TagBoolCondExpr Default%20Expression?>
<?Fm ShowAll True?>
<?Fm TrackChange Off PreviewState PREVIEW_OFF_TRACK_CHANGE ?>
<Figure><MediaObject>
<ImageObject dpi="600" impby="ref" entity="ImageObject1"
sideways="0" impang="0.000" xoffset="0.223in"
yoffset="0.083in" position="top" align="acenter" cropped="1"
float="1" width="3.861in" height="2.625in" angle="0.000"
nsoffset="0.000in"/></MediaObject></Figure>

 

If I make the ImageObject element to be a container in EDD, then it becomes an invalid element in the structured view.

What is wrong? What should I change?

Votes

Translate

Translate

Report

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 ,
Feb 05, 2020 Feb 05, 2020

Copy link to clipboard

Copied

Jul,

 

Since ImageObject is a graphic, the EDD must define it to be a graphic, not a container.

 

The sample XML you've shown does not include a document type declaration (<!DOCTYPE...). Make sure the XMLApplication in the application definition file you are using (probably structapps.fm) specifies the DTD. Once that is done, if the DTD does not define an attribute named entity for ImageObject, the r/w rule you have for that element should be OK.

 

--Lynne

Votes

Translate

Translate

Report

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
Explorer ,
Feb 08, 2020 Feb 08, 2020

Copy link to clipboard

Copied

LATEST

Thank you, Lynne!

After I've got more understanding of which dtd refers to which step of the transformation from an unstructured FM file to XML file, I've got the required attribute value! 

This branch of the tree I need to construct is passed thanks to your help.

Votes

Translate

Translate

Report

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