diff options
Diffstat (limited to 'testdata')
-rw-r--r-- | testdata/xmlparser/book_domain.oxm | 16 | ||||
-rw-r--r-- | testdata/xmlparser/comments_domain.oxm | 24 | ||||
-rw-r--r-- | testdata/xmlparser/headings_domain.oxm | 22 | ||||
-rw-r--r-- | testdata/xmlparser/simple_book.oxd | 28 | ||||
-rw-r--r-- | testdata/xmlparser/test.oxm | 15 |
5 files changed, 46 insertions, 59 deletions
diff --git a/testdata/xmlparser/book_domain.oxm b/testdata/xmlparser/book_domain.oxm index 8b46460..c86d4e3 100644 --- a/testdata/xmlparser/book_domain.oxm +++ b/testdata/xmlparser/book_domain.oxm @@ -33,11 +33,11 @@ effectively use forward declarations here. So the resolve() process may only be started _after_ all delcarations are read. --> - <child ref="book.chapter"/> + <childRef ref="book.chapter"/> <!-- The dot notation as path separator might be changed but I think it to be intuitive. If we want a more CSS like style we can use whitespaces here. --> - <child ref="book.paragraph"/> + <childRef ref="book.paragraph"/> </field> </struct> <struct name="chapter"> @@ -49,8 +49,8 @@ <!-- implicitly: <field name="" isSubtree="false" optional="false"> --> - <child ref="book.section"/> - <child ref="book.paragraph"/> + <childRef ref="book.section"/> + <childRef ref="book.paragraph"/> </field> </struct> <struct name="section"> @@ -62,8 +62,8 @@ <!-- implicitly: <field name="" isSubtree="false" optional="false"> --> - <child ref="book.subsection"/> - <child ref="book.paragraph"/> + <childRef ref="book.subsection"/> + <childRef ref="book.paragraph"/> </field> </struct> <struct name="subsection"> @@ -75,7 +75,7 @@ <!-- implicitly: <field name="" isSubtree="false" optional="false"> --> - <child ref="book.paragraph"/> + <childRef ref="book.paragraph"/> </field> </struct> <struct name="paragraph" transparent="true" role="paragraph"> @@ -87,7 +87,7 @@ <!-- implicitly: <field name="" type="TREE" optional="false"> --> - <child ref="book.text"/> + <childRef ref="book.text"/> </field> </struct> <struct name="text" transparent="true" role="text"> diff --git a/testdata/xmlparser/comments_domain.oxm b/testdata/xmlparser/comments_domain.oxm index 1336b47..4d8c531 100644 --- a/testdata/xmlparser/comments_domain.oxm +++ b/testdata/xmlparser/comments_domain.oxm @@ -4,11 +4,11 @@ <!-- an annotation comment --> <annotation name="comment"> - <field name="content" isSubtree="true"> - <child ref="book.paragraph"/> + <field name="content"> + <childRef ref="book.paragraph"/> </field> <field name="replies" isSubtree="true"> - <child ref="reply"/> + <childRef ref="reply"/> </field> </annotation> @@ -17,24 +17,24 @@ <!-- Is there a chance to prevent users from having to redefine these two fields in comment and reply? Could we use a fieldRef here? Or would that be circular? --> - <field name="content" isSubtree="true"> - <child ref="book.paragraph"/> + <field name="content"> + <childRef ref="book.paragraph"/> </field> <field name="replies" isSubtree="true"> - <child ref="reply"/> + <childRef ref="reply"/> </field> - <parent name="book.paragraph"> - <fieldRef name="$default"/> - </parent> + <parentRef ref="book.paragraph"> + <fieldRef ref="$default"/> + </parentRef> </struct> <!-- note that replies are organized in a tree fashion: One can also reply to a reply --> <struct name="reply"> - <field name="content" isSubtree="true"> - <child ref="book.paragraph"/> + <field name="content"> + <childRef ref="book.paragraph"/> </field> <field name="replies" isSubtree="true"> - <child ref="reply"/> + <childRef ref="reply"/> </field> </struct> </domain> diff --git a/testdata/xmlparser/headings_domain.oxm b/testdata/xmlparser/headings_domain.oxm index 2238792..d421747 100644 --- a/testdata/xmlparser/headings_domain.oxm +++ b/testdata/xmlparser/headings_domain.oxm @@ -8,26 +8,26 @@ that parent-child-relationship in this sense are mediated by fields. So we must either reference a field that is already there or declare a new one on the fly. --> - <parent name="book.book"> + <parentRef ref="book.book"> <field name="heading" isSubtree="true" optional="true"/> - </parent> - <parent name="book.chapter"> + </parentRef> + <parentRef ref="book.chapter"> <field name="heading" isSubtree="true" optional="true"/> - </parent> - <parent name="book.section"> + </parentRef> + <parentRef ref="book.section"> <field name="heading" isSubtree="true" optional="true"/> - </parent> - <parent name="book.subsection"> + </parentRef> + <parentRef ref="book.subsection"> <field name="heading" isSubtree="true" optional="true"/> - </parent> - <parent name="book.paragraph"> + </parentRef> + <parentRef ref="book.paragraph"> <field name="heading" isSubtree="true" optional="true"/> - </parent> + </parentRef> <!-- regarding its fields we have a problem here. We do not want to declare a new field, because in fact we want to allow every bit of content that a paragraph would allow - also considering possible extensions of paragraph by other domains. So we need to reference the default field of paragraph. --> - <fieldRef name="book.paragraph.$default"/> + <fieldRef ref="book.paragraph.$default"/> </struct> </domain> diff --git a/testdata/xmlparser/simple_book.oxd b/testdata/xmlparser/simple_book.oxd index de33536..abf575f 100644 --- a/testdata/xmlparser/simple_book.oxd +++ b/testdata/xmlparser/simple_book.oxd @@ -1,45 +1,17 @@ <?xml version="1.0"?> <document> <import rel="domain" src="book_domain.oxm"/> - <!-- Currently we have only one root. Thus we need no wrapper. --> - <!-- Note that we only reference "book" here, which resolves to the book - domain as well as the book StructuredClass. This is unambigous however, - because we are looking for a StructuredClass. The resolving mechanism - should be able to handle this. --> <book> - <!-- implicitly: - <book name=""> - --> - <!-- note that we do not refer to the attributes explicitly. Attributes are - referenced by their key-value pairs as defined in the according - StructType. For an example please refer to the more complex book - domain. --> - <!--<paragraph>--> - <text> This might be some introductory text or a dedication. - </text> - <!--</paragraph>--> <!-- Note that a better version of the book domain might specify headings here. --> <chapter name="myFirstChapter"> - <paragraph> - <text> Here we might have an introduction to the chapter. - </text> - </paragraph> <section name="myFirstSection"> - <paragraph> - <text> Here we might find the actual section content. - </text> - </paragraph> </section> <section name="mySndSection"> - <paragraph> - <text> Here we might find the actual section content. - </text> - </paragraph> </section> </chapter> </book> diff --git a/testdata/xmlparser/test.oxm b/testdata/xmlparser/test.oxm new file mode 100644 index 0000000..911bbed --- /dev/null +++ b/testdata/xmlparser/test.oxm @@ -0,0 +1,15 @@ +<?xml version="1.0" standalone="yes"?> +<domain name="test"> + + <import rel="domain" src="./book_domain.oxm"/> + <import rel="typesystem" src="./color.oxm"/> + + <struct name="fancycolor"> + + <primitive type="color"/> + + <parentRef ref="book.book"> + <fieldRef ref="$default"/> + </parentRef> + </struct> +</domain> |