Skip to main content
frameexpert
Community Expert
Community Expert
October 17, 2022
Answered

Import graphics to XML

  • October 17, 2022
  • 2 replies
  • 519 views

Hi All,

I have this basic markup in XML, although I can modify it if necessary:

<figure>
    <image src="graphics/FEA77D1FF412F5D071259E7DF30D9C0F.cgm.gif" dpi="600"/>
</figure>

When I open the XML with FrameMaker, I want the graphic to import at the correct DPI. This is what I have in my read/write rules:

element "image" {
  is fm graphic element "image";
  attribute "src" {
    is fm property file;
    is fm attribute;
  }
  attribute "dpi" {
    is fm property dpi;
    is fm attribute;
  }
}

This is what I get in FrameMaker. The graphic doesn't import and the src attribute value doesn't get passed in. I think I may need to have something in my DTD to make it all work. Any pointers would be appreciated. Thank you.

    This topic has been closed for replies.
    Correct answer Lynne A. Price

    Rick,

        Remove the Is Fm Attribute rules. The filename and DPI are stored with the graphic in a structured document just as they are in an unstructured one. When you save the structured document as XML, FM will populate the XML attributes. 

        While most XML attributes correspond to attributes in FM, some define properties of special objects such as graphics and tables. The example I usually give is the number of columns in a table. There is no reason to store such information in attributes in FrameMaker  because it is already stored in the associated objects. This design allows the user to change properties of such objects with the usual FrameMaker commands (e.g., changing the resolution of a graphic or adding or removing columns from a table) without bothering with attribute settings. Furthermore, FrameMaker doesn't have to update such objects when the user changes an attribute value or change an attribute value when the user changes the object.

        --Lynne

    2 replies

    Lynne A. PriceCorrect answer
    Inspiring
    October 18, 2022

    Rick,

        Remove the Is Fm Attribute rules. The filename and DPI are stored with the graphic in a structured document just as they are in an unstructured one. When you save the structured document as XML, FM will populate the XML attributes. 

        While most XML attributes correspond to attributes in FM, some define properties of special objects such as graphics and tables. The example I usually give is the number of columns in a table. There is no reason to store such information in attributes in FrameMaker  because it is already stored in the associated objects. This design allows the user to change properties of such objects with the usual FrameMaker commands (e.g., changing the resolution of a graphic or adding or removing columns from a table) without bothering with attribute settings. Furthermore, FrameMaker doesn't have to update such objects when the user changes an attribute value or change an attribute value when the user changes the object.

        --Lynne

    Inspiring
    October 18, 2022

    I neglected to mention that you don't need the src and dpi attributes in your EDD either.

                --Lynne

    frameexpert
    Community Expert
    Community Expert
    October 18, 2022

    Thank you Lynne!

    frameexpert
    Community Expert
    Community Expert
    October 17, 2022

    I had to update my DTD and it is working now. I need to eliminate the attributes I don't need, but it works right now. Thanks for those that viewed the post.

    <!ELEMENT image      EMPTY >
    <!ATTLIST image      src       CDATA     #IMPLIED
                         dpi       NMTOKEN   #IMPLIED
                         entity    ENTITY    #IMPLIED
                         rasterdpi  NMTOKEN   #IMPLIED
                         alt       CDATA     #IMPLIED
                         impsize   CDATA     #IMPLIED
                         impby     (ref|copy)  #IMPLIED
                         sideways  NMTOKEN   #IMPLIED
                         impang    CDATA     #IMPLIED
                         xoffset   CDATA     #IMPLIED
                         yoffset   CDATA     #IMPLIED
                         position  NMTOKEN   #IMPLIED
                         align     NMTOKEN   #IMPLIED
                         cropped   NMTOKEN   #IMPLIED
                         float     NMTOKEN   #IMPLIED
                         width     CDATA     #IMPLIED
                         height    CDATA     #IMPLIED
                         angle     CDATA     #IMPLIED
                         bloffset  CDATA     #IMPLIED
                         nsoffset  CDATA     #IMPLIED
                         insetdata  CDATA     #IMPLIED
                         posterfile  CDATA     #IMPLIED
                         graphicname  CDATA     #IMPLIED
                         javascriptfile  CDATA     #IMPLIED
                         activateinpdf  NMTOKEN   #IMPLIED
                         openpopupwin  NMTOKEN   #IMPLIED
                         insetview  CDATA     #IMPLIED
                         bgcolor   NMTOKEN   #IMPLIED
                         rendermode  NMTOKEN   #IMPLIED
                         lighting  NMTOKEN   #IMPLIED
                         linktotext  CDATA     #IMPLIED >