[
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.
>
>
If you want to write a schema for the above using ASN.1 and X.694, you
can simply write an XML schema for the element foo and use it with an
implementation of X.694.
<xs:schema xml:ns="http://www.w3.org/2001/XMLSchema">
<xs:element name="foo">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element name="item" type="xsd:string" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
X.694 implementations will produce an ASN.1 Schema "equivalent" to the
W3C XML Schema:
Foo ::= [EMBED-VALUES] SEQUENCE {
embed-values SEQUENCE OF UTF8String,
item-list [UNTAGGED] SEQUENCE OF elem UTF8String
}
EXTENDED-XER encodings of this type will look like the one of the example:
<foo> text <item> 1234 </item> more
text
</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. 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 write an ASN.1 type for this kind of document:
Inline ::= [EMBED-VALUES] SEQUENCE {
embed-values SEQUENCE OF UTF8String,
tag-list [UNTAGGED] SEQUENCE OF CHOICE {
p Inline,
b Inline,
i Inline } }
Foo ::= Inline
The following XML document is an EXTENDED-XER encoding of Foo:
<Foo>
text
<p>text<i>text<b>text</b>text</p>
text
</Foo>
>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.
>
>
>
As shown above, you can have EXTENDED-XER encodings with mixed contents.
Michael Marchegay
>ASN.1 as a non-mixed-content schema language for XML that has the
>ability to generate [unparsable, disastrously fragile*] 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?
>
>
|