summaryrefslogtreecommitdiff
path: root/testdata
diff options
context:
space:
mode:
authorBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2015-02-04 00:20:57 +0100
committerBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2015-02-04 00:20:57 +0100
commit9a5ca5397cc7903728e808c861f0a7fe1198bb43 (patch)
tree86371fd19a772e5590b9ddef621fadd717440101 /testdata
parent7a8a8a31416cfebf785135754035608f4d919bf5 (diff)
further work on domain parsing. This is not a working state yet.
Diffstat (limited to 'testdata')
-rw-r--r--testdata/xmlparser/book_domain.oxm98
1 files changed, 98 insertions, 0 deletions
diff --git a/testdata/xmlparser/book_domain.oxm b/testdata/xmlparser/book_domain.oxm
new file mode 100644
index 0000000..625e3c0
--- /dev/null
+++ b/testdata/xmlparser/book_domain.oxm
@@ -0,0 +1,98 @@
+<?xml version="1.0"?>
+<!-- The domain node is the root node of a single domain definition -->
+<domain name="book">
+ <!-- We start by declaring the structured classes. This implicitly defines
+ a context free grammar, which specifies the language of documents that
+ may be constructed using this domain. Note that this grammar may be
+ influenced by other domains depending on this one. -->
+ <!-- Note that we specify neither attributes,
+ nor parent, nor transparency, meaning that we refer to the default
+ values. Also note that we need to specify explicitly, which classes
+ are allowed as root nodes. -->
+ <struct name="book" cardinality="1" isRoot="true">
+ <!-- implicitly:
+ <struct name="book" cardinality="1" isRoot="true"
+ transparent="false" isa="" attributesDescriptor="">
+ -->
+ <!-- Note that we assume that, if not specified, a
+ field is assumed to have no name, be of type TREE
+ and not optional. -->
+ <field>
+ <!-- implicitly:
+ <field name="" isSubtree="false" optional="false">
+ -->
+ <!-- Using such child references might be problematic if
+ multiple nodes are matched. This should probably
+ result in an exception.
+ Also note that we only reference the child classes.
+ We do _not_ declare them here. This might lead to
+ some difficulties in the parsing process as I
+ effectively use forward declarations here. So the
+ resolve() process may only be started _after_ all
+ delcarations are read. -->
+ <child 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"/>
+ </field>
+ </struct>
+ <struct name="chapter">
+ <!-- implicitly:
+ <struct name="chapter" isRoot="false" cardinality="*"
+ transparent="false" isa="" attributesDescriptor="">
+ -->
+ <field>
+ <!-- implicitly:
+ <field name="" isSubtree="false" optional="false">
+ -->
+ <child ref="book.section"/>
+ <child ref="book.paragraph"/>
+ </field>
+ </struct>
+ <struct name="section">
+ <!-- implicitly:
+ <struct name="section" isRoot="false" cardinality="*"
+ transparent="false" isa="" attributesDescriptor="">
+ -->
+ <field>
+ <!-- implicitly:
+ <field name="" isSubtree="false" optional="false">
+ -->
+ <child ref="book.subsection"/>
+ <child ref="book.paragraph"/>
+ </field>
+ </struct>
+ <struct name="subsection">
+ <!-- implicitly:
+ <struct name="subsection" isRoot="false" cardinality="*"
+ transparent="false" isa="" attributesDescriptor="">
+ -->
+ <field>
+ <!-- implicitly:
+ <field name="" isSubtree="false" optional="false">
+ -->
+ <child ref="book.paragraph"/>
+ </field>
+ </struct>
+ <struct name="paragraph" transparent="true" role="paragraph">
+ <!-- implicitly:
+ <struct name="subsection" isRoot="false" cardinality="*"
+ transparent="true" isa="" attributesDescriptor="">
+ -->
+ <field>
+ <!-- implicitly:
+ <field name="" type="TREE" optional="false">
+ -->
+ <child ref="book.text"/>
+ </field>
+ </struct>
+ <struct name="text" transparent="true" role="text">
+ <!-- implicitly:
+ <struct name="text" isRoot="false" cardinality="*"
+ transparent="true" isa="" attributesDescriptor="">
+ -->
+ <!-- we might want to specify std.string here -->
+ <primitive name="content" type="string"/>
+ </struct>
+</domain>