Boost.Spirit.Qi - Errors at the beginning of a rule

爱⌒轻易说出口 提交于 2019-12-01 19:22:14

You'd want to require an element at the document root level.

The other messages are generated by failed expectation points. You'll want an extra expectation point at the start. I'd do this:

  1. rename old xml rule to element
  2. create a new xml rule that has the element at an expectation point:

        xml = qi::eps > element;
    
  3. [Don't change anything else]

  4. profit!

The output becomes:

Error! Expecting <element> here: "element>this is a test</element>
"
-------------------------
Parsing failed
-------------------------

See it live here

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!