Hi Evert,
I have been working with Sabre-XML for most of the day, but I'm stuck now.
I have a nested XML file and I would like to map that into a PHP class, for which I am using the mapValueObject system. This works pretty well so far.
At one point my XML file lists elements called "Category". Each category has an attribute "Number", which defines the category. Within each Category element, there are various sub-elements.
<Category Number="03">
.......
</Category>
<Category Number="04">
......
</Category>
<Category Number="05">
......
</Category>
However, the subelements in "Category 3" have absolutely nothing to do
with those in "Category 4", and they both have nothing in common with the
sub-elements in "Category 5". Therefore, I would like to create a custom class for each Category:
Class Category3 {
....
}
Class Category4 {
....
}
Class Category5 {
....
}
However, here's the catch: I am not able to define the "Number" attribute for the Category in the mapValueObject call. In very simple terms, I am trying to accomplish something like this:
$this->mapValueObject($atom . 'Category'[Number='03'], Element\Category3::class);
Is there any way to do this? I'm sorry if I'm being a pest, but I'd appreciate if you could point me towards the right direction. I've been stuck at this point for hours.