Hi!
On Tuesday, December 2, 2014 6:36:02 AM UTC-5, [email protected] wrote:
>
> Hello,
>
> I try to use Sabre XML Reader to handle this xml:
> http://www.eplakaty.pl/xml/ceneo.xml
>
Awesome!
>
> If I map elements like this:
>
> $this->xmlReader->elementMap = [
> '{}o' => 'Product',
> ];
>
>
>
> I got only attributes from "o" element (url, price etc) but I want map
> also cat, name, imgs and desc.
>
> I would like to do something like:
> $this->xmlReader->elementMap = [
> '{}o' => 'Product',
> '{}cat'=> 'Category',
> '{}etc'=> 'Etc',
> ];
>
> But it map only Product class.
>
> I can get sub elements by
>
> $reader->parseInnerTree()
>
> in Product class, parse it on my own and set fields by myself, but should
> I? Maybe it is better way to do that?
>
It depends what you want the end-result to look like.
Normally, when you parse an element, you are indeed responsible for parsing
anything below it, with or without parseInnerTree().
If you Product class looks a bit like this though:
class Product {
public $category;
public $etc;
}
it does make the most sense to me that deserializeXml loops through the
result of parseInnerTree and set every property.
sabre/xml is still a work in progress. I would be very curious to hear if
you think this is annoying or how you would expect this to work.
If you can give me a general idea how you would prefer this to work,
perhaps we can think about this and see if we can incorporate this somehow!
Evert
--
You received this message because you are subscribed to the Google Groups
"SabreDAV Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sabredav-discuss/32c886e3-2665-4ab1-ad51-1a23d30e059e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.