diff options
-rw-r--r-- | src/plugins/xml/XmlParser.cpp | 16 | ||||
-rw-r--r-- | testdata/xmlparser/book_domain.oxm | 16 | ||||
-rw-r--r-- | testdata/xmlparser/comments_domain.oxm | 18 | ||||
-rw-r--r-- | testdata/xmlparser/headings_domain.oxm | 22 |
4 files changed, 36 insertions, 36 deletions
diff --git a/src/plugins/xml/XmlParser.cpp b/src/plugins/xml/XmlParser.cpp index c46d9de..e8e97e2 100644 --- a/src/plugins/xml/XmlParser.cpp +++ b/src/plugins/xml/XmlParser.cpp @@ -597,7 +597,7 @@ public: { Rooted<Descriptor> parent = scope().selectOrThrow<Descriptor>(); - const std::string &name = args["name"].asString(); + const std::string &name = args["ref"].asString(); scope().resolve<FieldDescriptor>( name, parent, logger(), [](Handle<Node> field, Handle<Node> parent, Logger &logger) { @@ -700,7 +700,7 @@ public: scope().selectOrThrow<StructuredClass>(); Rooted<DomainParent> parent{new DomainParent( - strct->getManager(), args["name"].asString(), strct)}; + strct->getManager(), args["ref"].asString(), strct)}; parent->setLocation(location()); scope().push(parent); } @@ -765,7 +765,7 @@ public: Rooted<DomainParent> parentNameNode = scope().selectOrThrow<DomainParent>(); - const std::string &name = args["name"].asString(); + const std::string &name = args["ref"].asString(); Rooted<StructuredClass> strct = parentNameNode->getParent().cast<StructuredClass>(); auto loc = location(); @@ -970,7 +970,7 @@ static const ParserState DomainFieldRef = .parents({&DomainStruct, &DomainAnnotation}) .createdNodeType(&RttiTypes::FieldDescriptor) .elementHandler(DomainFieldRefHandler::create) - .arguments({Argument::String("name", DEFAULT_FIELD_NAME)}); + .arguments({Argument::String("ref", DEFAULT_FIELD_NAME)}); static const ParserState DomainStructPrimitive = ParserStateBuilder() @@ -992,7 +992,7 @@ static const ParserState DomainStructParent = .parent(&DomainStruct) .createdNodeType(&RttiTypes::DomainParent) .elementHandler(DomainParentHandler::create) - .arguments({Argument::String("name")}); + .arguments({Argument::String("ref")}); static const ParserState DomainStructParentField = ParserStateBuilder() @@ -1008,7 +1008,7 @@ static const ParserState DomainStructParentFieldRef = .parent(&DomainStructParent) .createdNodeType(&RttiTypes::FieldDescriptor) .elementHandler(DomainParentFieldRefHandler::create) - .arguments({Argument::String("name", DEFAULT_FIELD_NAME)}); + .arguments({Argument::String("ref", DEFAULT_FIELD_NAME)}); /* Typesystem states */ static const ParserState Typesystem = @@ -1079,8 +1079,8 @@ static const std::multimap<std::string, const ParserState *> XmlStates{ {"field", &DomainField}, {"fieldRef", &DomainFieldRef}, {"primitive", &DomainStructPrimitive}, - {"child", &DomainStructChild}, - {"parent", &DomainStructParent}, + {"childRef", &DomainStructChild}, + {"parentRef", &DomainStructParent}, {"field", &DomainStructParentField}, {"fieldRef", &DomainStructParentFieldRef}, {"typesystem", &Typesystem}, 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..2a3ad59 100644 --- a/testdata/xmlparser/comments_domain.oxm +++ b/testdata/xmlparser/comments_domain.oxm @@ -5,10 +5,10 @@ <!-- an annotation comment --> <annotation name="comment"> <field name="content" isSubtree="true"> - <child ref="book.paragraph"/> + <childRef ref="book.paragraph"/> </field> <field name="replies" isSubtree="true"> - <child ref="reply"/> + <childRef ref="reply"/> </field> </annotation> @@ -18,23 +18,23 @@ 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"/> + <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"/> + <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> |