Hi,
I found the bug and fixed it.
The problem was that when a start node is followed directly by a start
node, it do not process the attributes of the first node. When there is
content, e.g. a space, or a XML comment, the attributes were processed
correctly.
Thanks for reporting.
Tommi
On 01.07.2015 13:04, Andreas Welchlin wrote:
This string works:
std::string testmessage(
"<FIXML>"
"<TrdCaptRpt RptID=\"00000A00000C\" >\n"
"<RptSide>\n"
"</RptSide>\n"
"</TrdCaptRpt>"
"</FIXML>");
Am 01.07.2015 um 13:03 schrieb Andreas Welchlin:
Hi Tommi,
I checkt out the newest cxxtools from github, and I still see the
problem:
The original string is ("Foo" is "RptID", there):
std::string testmessage(
"<FIXML>"
"<TrdCaptRpt RptID=\"00000A00000C\" >"
"<RptSide>"
"</RptSide>"
"</TrdCaptRpt>"
"</FIXML>");
My operator is:
void operator>>= (const cxxtools::SerializationInfo& si, FixMl& fields)
{
const cxxtools::SerializationInfo& trdrpt =
si.getMember("TrdCaptRpt");
trdrpt.getMember(RptID) >>= fields.mReportId;
}
Could it be that you have newlines in your testfile and I have none
in my teststring?
Andreas
Am 01.07.2015 um 12:07 schrieb Tommi Mäkitalo:
Hi,
I can't reproduce the problem. Here is my more complete program:
#include <iostream>
#include <cxxtools/xml/xmldeserializer.h>
#include <cxxtools/serializationinfo.h>
#include <cxxtools/log.h>
struct FixMl
{
std::string foo;
};
void operator>>= (const cxxtools::SerializationInfo& si, FixMl&
fixMl)
{
si.getMember("TrdCaptRpt").getMember("Foo") >>= fixMl.foo;
}
int main(int argc, char* argv[])
{
try
{
log_init();
bool extractAttributes = true;
cxxtools::xml::XmlDeserializer deserializer(std::cin,
extractAttributes);
FixMl fixMl;
deserializer.deserialize(fixMl);
std::cout << fixMl.foo << std::endl;
}
catch (const std::exception& e)
{
std::cerr << e.what() << std::endl;
}
}
Compiling to foo and running
./foo <foo1.xml
prints "Bar" with both xml files. Can you show your test case?
Tommi
On 01.07.2015 10:48, Andreas Welchlin wrote:
Hi All,
I think I found a bug in the deserializer. When I want to get the
Attribute "Foo" in the XML below, it is not visible for the serializer.
<FIXML>
<TrdCaptRpt Foo="Bar" >
<RptSide>
</RptSide>
</TrdCaptRpt>
</FIXML>
When the XML looks like this, then Foo is visible and everything is fine.
<FIXML>
<TrdCaptRpt Foo="Bar" >
</TrdCaptRpt>
</FIXML>
The code:
std::istringstream xmlstream(xmlString);
bool extractAttributes = true;
cxxtools::xml::XmlDeserializer deserializer(xmlstream, extractAttributes);
deserializer.deserialize(*this);
Andreas
------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general
------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general
------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general
------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general
------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general