zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #24209
[Merge] lp:~zorba-coders/zorba/fix_bug_1124374 into lp:zorba
Sorin Marian Nasoi has proposed merging lp:~zorba-coders/zorba/fix_bug_1124374 into lp:zorba.
Commit message:
- fix for lp:1124374; Updated XQDoc schema.
Requested reviews:
Sorin Marian Nasoi (sorin.marian.nasoi)
Related bugs:
Bug #1124374 in Zorba: "impossible to extract annotation literals with xqdoc"
https://bugs.launchpad.net/zorba/+bug/1124374
For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/fix_bug_1124374/+merge/174398
--
https://code.launchpad.net/~zorba-coders/zorba/fix_bug_1124374/+merge/174398
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'modules/com/zorba-xquery/www/modules/xqdoc.xsd'
--- modules/com/zorba-xquery/www/modules/xqdoc.xsd 2013-02-07 17:24:36 +0000
+++ modules/com/zorba-xquery/www/modules/xqdoc.xsd 2013-07-12 12:38:34 +0000
@@ -140,16 +140,23 @@
</xsd:sequence>
</xsd:complexType>
+ <xsd:complexType name="literal">
+ <xsd:attribute name="type" type="xsd:string" use="required"/>
+ <xsd:attribute name="value" type="xsd:string" use="required"/>
+ </xsd:complexType>
+
<xsd:complexType name="annotation">
- <xsd:attribute name="prefix" type="xsd:string" use="optional"/>
- <xsd:attribute name="namespace" type="xsd:string" use="optional"/>
- <xsd:attribute name="localname" type="xsd:string" use="optional"/>
- <xsd:attribute name="value" type="xsd:string" use="optional"/>
+ <xsd:sequence>
+ <xsd:element name="literal" type="literal" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="prefix" type="xsd:string" use="optional"/>
+ <xsd:attribute name="namespace" type="xsd:string" use="optional"/>
+ <xsd:attribute name="localname" type="xsd:string" use="optional"/>
</xsd:complexType>
<xsd:complexType name="annotations">
<xsd:sequence>
- <xsd:element name="annotation" type="annotation" minOccurs="1" maxOccurs="unbounded"/>
+ <xsd:element name="annotation" type="annotation" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
@@ -203,6 +210,7 @@
<xsd:element name="uri" type="uri"/>
<xsd:element name="type" type="type" minOccurs="0"/>
<xsd:element name="comment" type="comment" minOccurs="0"/>
+ <xsd:element name="annotations" type="annotations" minOccurs="0"/>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="invoked" type="invoked" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="ref-variable" type="invoked" minOccurs="0" maxOccurs="unbounded"/>
=== modified file 'src/compiler/parsetree/parsenode_print_xqdoc_visitor.cpp'
--- src/compiler/parsetree/parsenode_print_xqdoc_visitor.cpp 2013-07-01 18:59:06 +0000
+++ src/compiler/parsetree/parsenode_print_xqdoc_visitor.cpp 2013-07-12 12:38:34 +0000
@@ -137,8 +137,8 @@
void print_annotations(AnnotationListParsenode* aAnn, store::Item_t aParent)
{
if (aAnn) {
- store::Item_t lTypeName, lAnnotationsQName, lAnnotationQName;
- store::Item_t lAnnotationsElem, lAnnotationElem;
+ store::Item_t lTypeName, lAnnotationsQName, lAnnotationQName, lLiteralQName;
+ store::Item_t lAnnotationsElem, lAnnotationElem, lLiteralElem;
theFactory->createQName(lAnnotationsQName, theXQDocNS, theXQDocPrefix, "annotations");
lTypeName = GENV_TYPESYSTEM.XS_UNTYPED_QNAME;
@@ -159,40 +159,12 @@
store::Item_t lAnnAttr;
lTypeName = GENV_TYPESYSTEM.XS_UNTYPED_QNAME;
- AnnotationLiteralListParsenode* lLits = lAnn->get_literals().getp();
-
- std::ostringstream lAttrValue;
- if (lLits)
- {
- for (size_t j = 0; j < lLits->size(); ++j)
- {
- if (j > 0)
- lAttrValue << " ";
-
- exprnode* lLit = (*lLits)[j].getp();
- StringLiteral* l = dynamic_cast<StringLiteral*>(lLit);
- if (l)
- {
- lAttrValue << l->get_strval();
- }
- else
- {
- NumericLiteral* n = dynamic_cast<NumericLiteral*>(lLit);
- assert(n);
- lAttrValue << n->toString();
- }
- }
- }
- zstring lTmp( lAttrValue.str() );
- store::Item_t lAttrValueItem;
- theFactory->createString(lAttrValueItem, lTmp);
-
store::Item_t lAttrPrefixItem, lAttrNamespaceItem, lAttrLocalnameItem;
zstring lPrefix = lAnn->get_qname()->get_prefix();
theFactory->createString(lAttrPrefixItem, lPrefix);
- lTmp = lAnn->get_qname()->get_prefix();
+ zstring lTmp = lAnn->get_qname()->get_prefix();
lTmp = theNamespaceMap[lTmp];
theFactory->createString(lAttrNamespaceItem, lTmp);
@@ -205,8 +177,6 @@
theFactory->createQName(lNamespaceQName, "", "", "namespace");
store::Item_t lLocalnameQName;
theFactory->createQName(lLocalnameQName, "", "", "localname");
- store::Item_t lValueQName;
- theFactory->createQName(lValueQName, "", "", "value");
lTypeName = GENV_TYPESYSTEM.XS_UNTYPED_QNAME;
theFactory->createAttributeNode(
@@ -223,10 +193,61 @@
lLocalnameQName, lAnnotationElem, lLocalnameQName,
lTypeName, lAttrLocalnameItem);
- lTypeName = GENV_TYPESYSTEM.XS_UNTYPED_QNAME;
- theFactory->createAttributeNode(
- lValueQName, lAnnotationElem, lValueQName,
- lTypeName, lAttrValueItem);
+ AnnotationLiteralListParsenode* lLits = lAnn->get_literals().getp();
+
+ zstring lAttrValue;
+ zstring lAttrType;
+ if (lLits)
+ {
+ for (size_t j = 0; j < lLits->size(); ++j)
+ {
+ exprnode* lLit = (*lLits)[j].getp();
+ StringLiteral* l = dynamic_cast<StringLiteral*>(lLit);
+ if (l)
+ {
+ lAttrValue = l->get_strval();
+ lAttrType = "string";
+ }
+ else
+ {
+ NumericLiteral* n = dynamic_cast<NumericLiteral*>(lLit);
+ assert(n);
+ lAttrValue = n->toString();
+ lAttrType = "numeric";
+ }
+
+ theFactory->createQName(lLiteralQName, theXQDocNS, theXQDocPrefix, "literal");
+ lTypeName = GENV_TYPESYSTEM.XS_UNTYPED_QNAME;
+
+ theFactory->createElementNode(
+ lLiteralElem, lAnnotationElem, lLiteralQName,
+ lTypeName, true, false, theNSBindings, theBaseURI);
+
+ store::Item_t lAttrTypeItem, lAttrValueItem;
+
+ theFactory->createString(lAttrTypeItem, lAttrType);
+ theFactory->createString(lAttrValueItem, lAttrValue);
+
+ lTmp = lAnn->get_qname()->get_localname();
+ theFactory->createString(lAttrLocalnameItem, lTmp);
+
+ store::Item_t lTypeQName;
+ theFactory->createQName(lTypeQName, "", "", "type");
+ store::Item_t lValueQName;
+ theFactory->createQName(lValueQName, "", "", "value");
+
+
+ lTypeName = GENV_TYPESYSTEM.XS_UNTYPED_QNAME;
+ theFactory->createAttributeNode(
+ lTypeQName, lLiteralElem, lTypeQName,
+ lTypeName, lAttrTypeItem);
+
+ lTypeName = GENV_TYPESYSTEM.XS_UNTYPED_QNAME;
+ theFactory->createAttributeNode(
+ lValueQName, lLiteralElem, lValueQName,
+ lTypeName, lAttrValueItem);
+ }
+ }
}
}
}
Follow ups
-
Re: [Merge] lp:~zorba-coders/zorba/fix_bug_1124374 into lp:zorba
From: Matthias Brantner, 2013-08-14
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1124374 into lp:zorba
From: Zorba Build Bot, 2013-08-12
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1124374 into lp:zorba
From: Zorba Build Bot, 2013-08-12
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1124374 into lp:zorba
From: Zorba Build Bot, 2013-08-12
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1124374 into lp:zorba
From: Zorba Build Bot, 2013-08-12
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1124374 into lp:zorba
From: Zorba Build Bot, 2013-08-12
-
Re: [Merge] lp:~zorba-coders/zorba/fix_bug_1124374 into lp:zorba
From: Matthias Brantner, 2013-07-31
-
Re: [Merge] lp:~zorba-coders/zorba/fix_bug_1124374 into lp:zorba
From: Matthias Brantner, 2013-07-17
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1124374 into lp:zorba
From: Zorba Build Bot, 2013-07-12
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1124374 into lp:zorba
From: Zorba Build Bot, 2013-07-12
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1124374 into lp:zorba
From: Zorba Build Bot, 2013-07-12
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1124374 into lp:zorba
From: Zorba Build Bot, 2013-07-12
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1124374 into lp:zorba
From: Zorba Build Bot, 2013-07-12
-
Re: [Merge] lp:~zorba-coders/zorba/fix_bug_1124374 into lp:zorba
From: Sorin Marian Nasoi, 2013-07-12