Opened 11 years ago

Closed 11 years ago

#6041 closed Bugs (wontfix)

Exception in basic_xml_iarchive(...) when xml contains short tags

Reported by: Darren Griffin <darren.griffin@…> Owned by: Robert Ramey
Milestone: To Be Determined Component: serialization
Version: Boost 1.38.0 Severity: Showstopper
Keywords: Cc:

Description

Hi Guys,

I'm getting an exception thrown when DE serializing XML which contains short-tags '<tag/>' where no data is present.

If you take a look at the following StackOverflow link this will explain my problem.

http://stackoverflow.com/questions/7823875/boost-serialization-exception-to-and-from-xml-via-sql-server-xml-datatype

I've looked into the code in some depth now, so I’ll do my best to point out my findings.

The exception happens in 'basic_xml_iarchive.ipp', line 34, the function called 'basic_xml_iarchive<Archive>::load_start(const char *name)'

If the 'parse_start_tag(..)' call in this function begins to find the starting tag for said name, and the tag in question is a short-tag it is unable to find a pattern match for that tag and the exception is thrown.

With my understanding and following the code through this function it takes me to where i believe the problem lies.

If you look in 'basic_xm_grammar.ipp' at the function 'basic_xml_grammar<CharType>::basic_xml_grammar()' which begins on line 233, you will see what looks like 2 pattern attributes defined..

STag (line 255) ETag (line 264)

These, from what I can gather, define the pattern for what the start and end tags of an XML tag would look like, and i can see no patterns here which would be capable of capturing the short-tag, so one can only assume this has been overlooked, or at least that’s my view.

I've looked at later version of boost and I can see no changes which lead me to believe this has been fixed.

I'm hoping it's just me not doing something correctly, but I leave it to you guys to determine if it really is a bug or not.

Great libraries though, they have made my job much more enjoyable over the past few years.

Any questions feel free to contact me.

Cheers, Darren

Change History (1)

comment:1 by Robert Ramey, 11 years ago

Resolution: wontfix
Status: newclosed

the xml_archive code, as does all the serialization code presumes that we load exactly what we save. Generally trying to make it more general never seemed worth the risk. If you want to create, test and submit a patch to the spirit parser which would handle the </..> tags I would look at it. But lacking this, I'm not inclined to spend time on this.

Robert Ramey

Note: See TracTickets for help on using tickets.