#FIXED DTD attribute

Discussion in 'XML' started by Joe Kesselman, Jun 22, 2006.

  1. Soren Kuula wrote:
    > If I declare an attribute #FIXED as in
    > <!ATTLIST gedefims a1 CDATA #FIXED "fis">
    > Does the attribute HAVE to be present in instance docuements


    Essentially, #FIXED implies #DEFAULT. If you don't specify it this value
    will be provided automatically; if you do, you must specify the same value.

    (From the spec: "If the declaration is neither #REQUIRED nor #IMPLIED,
    then the AttValue value contains the declared default value; the #FIXED
    keyword states that the attribute must always have the default value.")
     
    Joe Kesselman, Jun 22, 2006
    #1
    1. Advertising

  2. Joe Kesselman

    Peter Flynn Guest

    Soren Kuula wrote:
    > Hi,
    >
    > If I declare an attribute #FIXED as in
    >
    > <!ATTLIST gedefims a1 CDATA #FIXED "fis">
    >
    > Does the attribute HAVE to be present in instance docuements, as with
    > #REQUIRED? As I read the XML spec, I can't find where that is said; only
    > that the value of the "a1" attribute must be "fis" if present.
    >
    > On the other hand, some people use #FIXED to "enforce" presence of
    > namespace bindings. Without the required semantics, what is enforced?


    FIXED means that after validation, the attribute value will be present
    in the tree, whether or not it was explicitly given in the document.
    So, for example, you can refer in XSLT to "@a1" and it will always be
    "fis". It can indeed be treated as a way of passing fixed information
    through from the DTD to the parsed instance.

    ///Peter
    --
    XML FAQ: http://xml.silmaril.ie/
     
    Peter Flynn, Jun 22, 2006
    #2
    1. Advertising

  3. In article <449b0e41$>,
    Soren Kuula <> wrote:

    ><!ATTLIST gedefims a1 CDATA #FIXED "fis">
    >
    >Does the attribute HAVE to be present in instance docuements, as with
    >#REQUIRED? As I read the XML spec, I can't find where that is said; only
    >that the value of the "a1" attribute must be "fis" if present.


    If the attribute is present in the instance, it must be "fis".
    If it isn't, then it defaults to "fis" anyway.

    If (perversely) you want to allow only one value, but require it
    to be present, you can do this provided the value is a name token:

    <!ATTLIST gedefims a1 (fis) #REQUIRED>

    -- Richard
     
    Richard Tobin, Jun 23, 2006
    #3
  4. Joe Kesselman

    Soren Kuula Guest

    Hi,

    If I declare an attribute #FIXED as in

    <!ATTLIST gedefims a1 CDATA #FIXED "fis">

    Does the attribute HAVE to be present in instance docuements, as with
    #REQUIRED? As I read the XML spec, I can't find where that is said; only
    that the value of the "a1" attribute must be "fis" if present.

    On the other hand, some people use #FIXED to "enforce" presence of
    namespace bindings. Without the required semantics, what is enforced?

    Soren
     
    Soren Kuula, Jun 23, 2006
    #4
  5. In message <>, Peter Flynn
    <> writes
    >Soren Kuula wrote:
    >> Hi,
    >> If I declare an attribute #FIXED as in
    >> <!ATTLIST gedefims a1 CDATA #FIXED "fis">
    >> Does the attribute HAVE to be present in instance docuements, as
    >>with #REQUIRED? As I read the XML spec, I can't find where that is
    >>said; only that the value of the "a1" attribute must be "fis" if present.
    >> On the other hand, some people use #FIXED to "enforce" presence of
    >>namespace bindings. Without the required semantics, what is enforced?

    >
    >FIXED means that after validation, the attribute value will be present
    >in the tree, whether or not it was explicitly given in the document.
    >So, for example, you can refer in XSLT to "@a1" and it will always be
    >"fis". It can indeed be treated as a way of passing fixed information
    >through from the DTD to the parsed instance.


    However, if you're talking about enforcing namespace bindings, and
    you're using MSXML as your parser, this doesn't appear to be the case.
    I have just been battling with this issue myself, while trying to
    produce an XTM 2.0 document which conforms to the DTD.

    Without an explicit instance of the xmlns attribute in the document
    (matching the #FIXED value), you get the error message:

    Use of default namespace declaration attribute in DTD not supported.

    This doesn't appear to be a new or unknown problem. A Google search
    brought up this posting from Aung Aung (a Microsoft employee, I think),
    dated 3 Jan 2001:

    "Well, clearly it is a bug on msxml according to the spec. I am pushing
    a fix for this.

    Workaround : msxml will need the namespace explicitly specified in the
    document.
    e.g according to the spec if you defined the default namespace in the
    DTD, one should not need to put it on the <doc> node."

    The "fix" has clearly not been forthcoming ...

    Richard Light
    --
    Richard Light
    SGML/XML and Museum Information Consultancy
     
    Richard Light, Jun 23, 2006
    #5
  6. Richard Light wrote:
    > However, if you're talking about enforcing namespace bindings, and
    > you're using MSXML as your parser, this doesn't appear to be the case. I
    > have just been battling with this issue myself, while trying to produce
    > an XTM 2.0 document which conforms to the DTD.


    If you're working with namespaces, you probably should move from DTDs to
    schemas at you soonest possible opportunity. Namespaces and DTDs really
    don't play very nicely with each other, since they have conflicting
    ideas of what's meaningful in an XML document.

    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
     
    Joe Kesselman, Jun 23, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Joseph Tilian
    Replies:
    0
    Views:
    379
    Joseph Tilian
    Dec 21, 2004
  2. Ronald Fischer
    Replies:
    4
    Views:
    1,806
    Ronald Fischer
    Mar 17, 2005
  3. johnp
    Replies:
    4
    Views:
    3,719
    Toby Inkster
    May 23, 2005
  4. Alastair Cameron
    Replies:
    1
    Views:
    1,617
    Colin Mackenzie
    Jul 4, 2003
  5. test
    Replies:
    2
    Views:
    2,177
    Oliver Wong
    Jul 28, 2006
Loading...

Share This Page