Menu

#541 Invalid parsing with values containing "&"

Feature Request
closed-invalid
nobody
1
2016-08-12
2016-08-11
No

Hi,
I'm using Poco Framework which have a wrapper on top of expat 2.2.0. Unfortunately, while reading Microsoft Analysis Services XMLA response, I have an issue with some values like this:

<root><nested>[FIRST].[SECOND].&[THIRD]</nested></root>

In this case, reading the element value returns me "[FIRST].[SECOND].".
It seems that every time there is a "&" inside the value, the parser is stuck.

Can you have a look at it ?

Regards.

Discussion

  • Sebastian Pipping

    Hi!

    Unless I misunderstand the issue, what you have there looks like malformed XML to me. "&" would have to be "&amp;" to be well-formed. Please see https://www.w3.org/TR/xml/#syntax for the related section in the XML specification. If the XML writer is under your control, please fix the XML writer.

    Best, Sebastian

     

    Last edit: Sebastian Pipping 2016-08-11
    • Sebastian Pipping

      PS: If "&" up there is actually "&amp;" already (and SF.net is mis-displaying it), entity resolution comes into play.

       
  • François MAESEELE

    Hi
    Thank you for your reply.
    So, no it is absolutely not a malformed XML. Please consider that we are talking about a value of a tag, not the tag name. So as a value, you can put whatever car you want.
    This kind of XML is a sample to illustrate what is the issue we are facing using expat while reading Microsoft Analysis Service XMLA answers. This is actually a POC to replace the libxml2 (another C++ xml pull parser), if expat is more faster in this scenario.
    Regards,
    François

     
    • Sebastian Pipping

      Hello François,
      I'm not sure we're on the same page with this. How about posting a minimal XML file with the mentioned characteristics for an attachment. We would be 100% sure to be talking about the same thing then. Okay?

       
  • François MAESEELE

    Hi Sebastian,
    After digging a bit more into this issue, it appears that you are right.
    First, the values come with "&amp;" instead of only "&". (I was mistaken because of debugging Poco wrapper, and not expat itself).
    Second, the issue comes from the Poco wrapper, as it needs to iterate until the node type change from EV_CHARACTER to something else (probably to EV_END_ELEMENT).
    So everything is fine, thank your for your help and your time.

    And don't know if the issue has to be closed by me or you. I'm going to check. anyway this is not a bug :-)

    Regards,

    François

     

    Last edit: François MAESEELE 2016-08-12
  • Sebastian Pipping

    • status: open --> closed-invalid
     
  • Sebastian Pipping

    Excellent, thanks for the update!

    Best, Sebastian

     

Log in to post a comment.