XMetal and Default Element Content

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Marlin

    XMetal and Default Element Content

    I am inquiring for a customer of mine who is using XMetal 3.0 as an
    XML editor. I am trying to add default content to an element so that
    this content is inserted when the element is inserted.

    In more detail: When using XMetal to view an XML file in 'tags on'
    view, you are able to view the attributes and the elements that are
    allowed within each tag depending on where you are in the document.
    From here you can select the tag you are wanting to add and it
    automatically inserts the start and end tag into the document.

    In regards to Cross References (XPointers), our DTD using the tag
    <xref>, with the fixed attribute
    "xmlns:xlink=ht tp://www.w3.org/1999/xlink" When an xref tag is
    inserted into an XML document, the markup <xref> </xref> is added.

    At present, when you switch to plain text view only the <xref> </xref>
    markup is inserted. Is possible to include the xlink text
    (xmlns:xlink=ht tp://www.w3.org/1999/xlink) to this element so that
    when it is inserted, this xlink text is also inserted into the
    document saving typing it each time? That is: in plain text view, the
    document will display "<xref
    xmlns:xlink="ht tp://www.w3.org/1999/xlink" </xref>.

    For your information , the DTD defines this element as follows:
    <!ELEMENT xref (#PCDATA)>
    <!ATTLIST xref
    xmlns:xlink CDATA #FIXED "http://www.w3.org/1999/xlink"
    xlink:type (simple) #FIXED "simple"
    xlink:href CDATA #REQUIRED >

    Also, I attempted to do this via the Tools/Customizations/On
    Insert/Content menu but it does not appear to add the specified text
    to the element when inserted.

    Can anyone help?
  • nobody

    #2
    Re: XMetal and Default Element Content

    Marlin wrote:

    (late answer as I've been away for a while)
    [color=blue]
    > I am trying to add default content to an element so that
    > this content is inserted when the element is inserted.[/color]

    this can be done with a template in the CTM file:

    <Template>
    <Name>elem</Name>
    <MiniTemplate>< ![CDATA[<elem
    attr="val"/>]]></MiniTemplate>
    </Template>

    HTH, andreas

    Comment

    Working...