Re: Microsoft & Ada (and also a remark on DTDs prohibiting

From: Georg Bauhaus (sb463ba_at_l1-hrz.uni-duisburg.de)
Date: 09/13/04


Date: Mon, 13 Sep 2004 19:16:23 +0000 (UTC)

Robert C. Leif <rleif@rleif.com> wrote:
: DTDs have a horrible syntax.

Care to elaborate?

: XML schema can be constructed to have
: essentially a one-to-one correspondence to Ada.

In essence, Schema definitions can be more specific about a mapping of XML
text to a subset of record types, enums, and some string types, if you
neglect Unicode (how many Characters do you need for a 64 character Unicode
String in Ada?). More advanced XML element types (for example recursive
XML element types) are not that easily mapped to Ada records.

: Readability and strong
: typing are very useful characteristics for software engineering.

Right. Which is why I prefer a clear Content Model notation, which
in case of DTDs is based on well established ways of writing regular
grammars. (Using: () for grouping, | for alternatives, * for any,
+ for at least one. Is there any Schema author who doesn't know these?)

Paraphrasing definitions from you Schema files, consider

<!ELEMENT
         Reactive_Functionality_Name (#PCDATA) >

<!ATTLIST
         Reactive_Functionality_Name

   Reactive_Functionality_Num
        (Unfuctionalized | mono | di | tri) #REQUIRED
>

This DTD definition looses the information given in the Schema that the
element content must be a normalized string (IOW, a normalized attribute
value...) of at least 64 Unicode characters, as per your definition
of Bd_64_Type. (Is "Unfuctionalized" a typo?)

But are these declarations written in a horrible syntax?
I can see no significant difference of the above enumeration from

  type Reactive_Functionality_Num is
        (Unfuctionalized , mono , di , tri);

On the whole I think what you have tried is to map some internal
data representation 1:1 onto an external XML Schema. Good idea?

: Most of the data types are NOT numeric.

(OK, let me call them punch card data, as in fact there are also names
and hex numbers separated by ',', and more. Nothing wrong with punch
cards, if they matter.)

: My Ada code employs the same data-types and names as
: the XML schema.

Can this be a mistake? I think there are situations where this is
a mistake. It misses an opportunity to abstract from the bounds
of the machines. Make a "logical" format. For example, one of your
Schema types specifies

  hex-num-of-four-digits COMMA hex-num-of-four-digits .

via

  [0-9a-fA-F]{4},[0-9a-fA-F]{4}.

Doesn't this lend itself well to a definition that names the two
hex numbers? Like in

  <Complex re="0.0" im="-1.0"/>

These are still Ada names, but it should be obvious what is meant
even if you do not know Ada.

"Pattern matching is not parsing." (SNOBOL4 saying.)

regards,
-- Georg



Relevant Pages

  • Re: Who supports Schema validation of unique
    ... 'xpath' attribute on 'selector' element ... So can be the rest of your schema. ... XML document complies with an XML Schema you provide. ... identity constraint is useful because it refers to something. ...
    (comp.text.xml)
  • Re: Implementing IODEF XML Schema in SQL 2005
    ... The XML Schema has a DTD at the top. ... Note that if the DTD performs the function of constraining the XML data, ... "Pro SQL Server 2008 XML" ...
    (microsoft.public.sqlserver.xml)
  • Re: Yet another XML and Ada issue
    ... What would happen if I suggested to this news group that Ada be ... replaced by "a more compact notation" "useful for writing programs ... I admit that schema import statements are overly verbose. ... > A note on XML Schema types, they are far away from abstraction. ...
    (comp.lang.ada)
  • Re: Target namespace - Schema - Instances
    ... I tried find public-ready version of the best practice document, ... And one other thing is that Microsoft and IBM ... discussing best practice for XML schema design. ...
    (microsoft.public.biztalk.general)
  • Re: Inheritance in XSD?
    ... There are probably errors in your schema. ... What you want to do is generally not possible with W3C XML Schema. ... > approach is to define an abstract tableType, then define derived types ... > derivation by restriction to express this sort of thing. ...
    (microsoft.public.dotnet.xml)