[
Lists Home |
Date Index |
Thread Index
]
Amelia A. Lewis wrote:
>
> On Sat, 1 Nov 2003 23:16:03 -0500
> "Alessandro Triglia" <sandro@mclink.it> wrote:
> > Rich Salz ha scritto:
> > >
> > > I think you misunderstand Simon. Does ASN.1/X.694 have the
> > > equivalent of a "text node"? For example:
> > > <foo>this is <item>1<item> line of text with
> > > <item>2</item> numbers in it.</foo>
> > >
> > > What about
> > > <foo>A second line with <item>1<item>, <item>2</item>, no,
> > > <item>3</item> numbers.</foo>
> > >
> > > In XML Schema, those match the same definition of foo. How
> > > do you write the equivalent in ASN.1/X.694?
>
> Please note the question. The answer doesn't address it.
Really? Let me try again.
If I "infer" correctly the intended schema from Rich's example, in ASN.1 it
would look like:
-------------------------
Foo ::= [NAME AS "foo"] [EMBED-VALUES] SEQUENCE {
embed-values SEQUENCE OF UTF8String,
item-list [UNTAGGED] SEQUENCE OF item INTEGER
}
-------------------------
that is, type Foo (a type for an element "foo") contains zero or more child
elements "item" (of type INTEGER), and has mixed content. The "text nodes"
of the mixed content are described by the "embed-values" component of type
Foo.
>
> > ASN.1 supports mixed content in the "Extended XML encoding rules"
> > (EXTENDED-XER).
> >
> > You can write a type definition such as the following:
> >
> > ----------------------
> > MyElementTypeWithMixedContent ::= [EMBED-VALUES] SEQUENCE {
> > embed-values SEQUENCE OF UTF8String,
> > an-attribute [ATTRIBUTE] INTEGER,
> > another-attribute [ATTRIBUTE] UTF8String,
> > a-child-element AnotherElementType,
> > another-child-element INTEGER
> > }
> > ----------------------
> >
> > [EMBED-VALUES] and [ATTRIBUTE] are examples of "XER encoding
> > instructions".
> >
> > The [EMBED-VALUES] encoding instruction assigned to the
> SEQUENCE type
> > causes the multiple strings of the "embed-values" component
> (the first
> > component of the SEQUENCE) to provide the text that is interleaved
> > with the child elements (before the first one, between each
> pair, and
> > after the last one). In this example, there are two
> (mandatory) child
> > elements ("a-child-element" and "another-child-element"), so there
> > must be exactly three strings(possibly empty) in the SEQUENCE OF
> > UTF8String.
>
> But that isn't mixed content. Not in the XML sense.
Why? In XML Schema you define a complex type definition with mixed=true and
the content model that you like. In ASN.1, you use the [EMBED-VALUES]
encoding instruction and place a SEQUENCE OF UTF8String component at the
beginning of the SEQUENCE. These are two ways to accomplish the same goal.
> If I
> *must* write <p>String <b>emphasized</b> the end.</p> But I
> *want* to write <p>String <b>some <i>real nonsense</i>,
> no?</b> Or perhaps <b>not</b>.</p>
You can certainly define a content model with <i>'s and <p>'s and <b>'s in
ASN.1 as you can do in XML Schema. If you want this to be mixed content,
you say so, both in XML Schema and in ASN.1. It should be easy for you to
do this, by looking at the example above and generalizing it.
>
> Classic document-style mixed content. Very useful stuff if,
> for instance, you're embedding documentation into a product
> description.
> The example provided, if I understand it correctly, cannot
> support that.
That was only an example.
>
> ASN.1 as a non-mixed-content schema language
That is clearly not true.
> for XML that has
> the ability to generate [unparsable, disastrously fragile*
ASN.1 has been successfully used in many critical and less critical systems
for the last 20 years or so, and still is. All of us depend on ASN.1 more
than any of us is aware. Spare me the effort of providing you with a list
of those uses (but you can give a look at
http://asn1.elibel.tm.fr/en/uses/index.htm).
Alessandro Triglia
> ]
> compact binary structures has interesting use cases. An
> inability to support mixed content means it isn't a
> replacement for DTDs, WXS, or RNG, all of which do have that
> capability.
>
> Amy!
> * she didn't really say that, did she?
|