equal
deleted
inserted
replaced
52 |
52 |
53 XmlHandler(std::ostream& output) : xmlWriter(new XMLWriter(output)) { |
53 XmlHandler(std::ostream& output) : xmlWriter(new XMLWriter(output)) { |
54 } |
54 } |
55 |
55 |
56 void startRelation(string_t name, std::vector<handlers::AttributeMetadata> attributes) override { |
56 void startRelation(string_t name, std::vector<handlers::AttributeMetadata> attributes) override { |
57 valueCount = 0; |
|
58 columnCount = 0; |
|
59 |
|
60 if (relationCount == 0) { |
57 if (relationCount == 0) { |
61 xmlWriter->writeStartElement(L"relpipe",{L"xmlns", XMLNS}); |
58 xmlWriter->writeStartElement(L"relpipe",{L"xmlns", XMLNS}); |
62 } else { |
59 } else { |
63 xmlWriter->writeEndElement(); |
60 if (valueCount) xmlWriter->writeEndElement(); |
64 xmlWriter->writeEndElement(); |
61 xmlWriter->writeEndElement(); |
65 } |
62 } |
|
63 |
|
64 valueCount = 0; |
|
65 columnCount = 0; |
66 relationCount++; |
66 relationCount++; |
|
67 |
67 xmlWriter->writeStartElement(L"relation"); |
68 xmlWriter->writeStartElement(L"relation"); |
68 |
69 |
69 xmlWriter->writeTextElement(L"name",{}, name); |
70 xmlWriter->writeTextElement(L"name",{}, name); |
70 |
71 |
71 |
72 |
89 } |
90 } |
90 |
91 |
91 void attribute(const string_t& value) override { |
92 void attribute(const string_t& value) override { |
92 integer_t i = valueCount % columnCount; |
93 integer_t i = valueCount % columnCount; |
93 |
94 |
|
95 // TODO: end element on last attribute instead of first + on end of pipe |
94 if (i == 0 && valueCount) xmlWriter->writeEndElement(); |
96 if (i == 0 && valueCount) xmlWriter->writeEndElement(); |
95 if (i == 0) xmlWriter->writeStartElement(L"record"); |
97 if (i == 0) xmlWriter->writeStartElement(L"record"); |
96 |
98 |
97 valueCount++; |
99 valueCount++; |
98 |
100 |