[studxml-users] problem with choosing content model at runtime

Gábor Balló kvantumbit at gmail.com
Fri Dec 13 06:24:07 EST 2019


Hi!

I just started to use libstudxml for a project. I think it is very
straightforward and easy to use.
However there is one thing I could not solve in any way so far. I am
trying to parse an XML like this:

<object>
  <item>text1</item>
  <item>text2</item>
  <item>
      <object2>
        <tag>text3</tag>
      </object2>
  </item>
  <item>text5</item>
  ...
  ...
</object>

My problem is that the first two item elements would use simple
content model, but the third is complex.
There can be any number of item elements, this is just an example.
Also I cannot assume that the complex item element will be the third
one. It can appear anywhere in the list of item elements.

Unfortunately I could not find a way to check, what does the next item
element contain (text or other elements), so what content model should
I use to parse it.

Is there any way to do this with libstudxml?

Thank you!
Best regards,
Gabor



More information about the studxml-users mailing list