Comments (7)
I have developed a bundle (non public) for the same purpose (mobile.de API) and encountered the same problem.
You just need to correct the ad namespace:
xml_root_name: search-result
xml_root_namespace: 'http://services.mobile.de/schema/search'
properties:
[...]
ads:
expose: true
access_type: public_method
serialized_name: ads
xml_element:
namespace: 'http://services.mobile.de/schema/search'
accessor:
getter: getAds
setter: setAds
type: array<Mobile\Ad\Ad>
xml_list:
inline: false
entry_name: ad
namespace: 'http://services.mobile.de/schema/ad' <---- here
from xsd2php.
@Ama-Gi you save my day! It's working now. Thank you very much.
Do you think there is a bug in this library or do you think it came from mobile.de ?
from xsd2php.
The xsd files from mobile.de look fine to me, I think its a bug. The errors xml list probably has the same problem, i think it should be:
errors:
[...]
xml_list:
inline: false
entry_name: error
namespace: 'http://services.mobile.de/schema/common/error-1.0'
instead of
errors:
[...]
xml_list:
inline: false
entry_name: error
namespace: 'http://services.mobile.de/schema/search'
I guess maybe this library ignores the ref attribute for the child elements (ref="ad:ad")?
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://services.mobile.de/schema/search" xmlns:search="http://services.mobile.de/schema/search" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ad="http://services.mobile.de/schema/ad" xmlns:error="http://services.mobile.de/schema/common/error-1.0" elementFormDefault="qualified">
<xs:import namespace="http://services.mobile.de/schema/ad" schemaLocation="ad-1.0.xsd"/>
<xs:import namespace="http://services.mobile.de/schema/common/error-1.0" schemaLocation="common/error-1.0.xsd"/>
<xs:element name="result">
<xs:complexType>
<xs:sequence>
<xs:element ref="ad:ad" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="total" use="required" type="xs:int"/>
<xs:attribute name="page-size" use="required" type="xs:int"/>
<xs:attribute name="current-page" use="required" type="xs:int"/>
<xs:attribute name="max-pages" use="required" type="xs:int"/>
</xs:complexType>
</xs:element>
<xs:element name="search-result">
<xs:annotation>
<xs:documentation>The ad-search-result including some metadata, probably warnings and the ads (for this
page).
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="total" type="xs:int">
<xs:annotation>
<xs:documentation>The total number of results.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="page-size" type="xs:int">
<xs:annotation>
<xs:documentation>The number of results per page.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="current-page" type="xs:int">
<xs:annotation>
<xs:documentation>The current page number.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="max-pages" type="xs:int">
<xs:annotation>
<xs:documentation>The total number of results-pages.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element ref="error:errors" minOccurs="0"> <------ HERE
<xs:annotation>
<xs:documentation>A list of non fatal errors related to this search request e.g. invalid or
deprecated search parameters. If this list is present then the search result might not be as
intended by the client, so always check that this not present.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="ads">
<xs:annotation>
<xs:documentation>The ad results (of this page).</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element ref="ad:ad" minOccurs="0" maxOccurs="unbounded"/> <------ HERE
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:simpleType name="event-type">
<xs:restriction base="xs:string">
<xs:enumeration value="AD_CREATE_OR_UPDATE">
<xs:annotation>
<xs:documentation/>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="AD_DELETE">
<xs:annotation>
<xs:documentation/>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="ERROR">
<xs:annotation>
<xs:documentation/>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
<xs:element name="event">
<xs:complexType>
<xs:sequence>
<xs:element name="event-type" type="search:event-type" minOccurs="0"/>
<xs:element name="ad-key" type="xs:token" minOccurs="0"/>
<xs:element ref="ad:ad" minOccurs="0"/>
<xs:element ref="error:errors" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>`
from xsd2php.
Okay, we should try to fix that via a pull-request. I will look for it as soon as posible.
from xsd2php.
@robinlehrmann any news?
from xsd2php.
@goetas No, I'm sorry, currently I haven't enough time to resolve it.
from xsd2php.
Anyone had a work around or any solid solution for this?
from xsd2php.
Related Issues (20)
- Problems with JMS-Metadata-Generator HOT 4
- Improper PHP code form choice element HOT 2
- Unable to generate PHP classes from XSD file HOT 3
- Declaration of Xsd2PhpExtension::getAlias() must be compatible with Symfony\Component\DependencyInjection\Extension\Extension::getAlias() HOT 4
- Better Handling of xsd:choice
- [Feature Request] Add option to add PHP type declarations
- Handling of xsd:squence with maxOccurs="unbounded"
- Composer requirements version HOT 3
- still uses psr/log:^1.0 - Please add support for psr/log:^3.0 and ^2.0 HOT 3
- CDATA sections not being disabled in XML despite setting xml_cdata to false in goetas-webservices/xsd2php HOT 2
- Can you help me create config.yml
- where are the simpleType restrictions?
- Wrong rendering of PHPDocs in generated classes HOT 2
- Possibility of upgrade goetas-webservices/xsd-reader dependency to 0.4.1 HOT 1
- Uncaught TypeError issue after upgrading to 0.4.11 HOT 1
- Not escaping */ in php comments
- compatible to symfony 7.0 HOT 5
- xs:Choice of xs:Sequence not supported? HOT 2
- ComplexType with single Sequence fails to generate underlying type class
- xsd:sequence produces Uncaught TypeError like xsd:group in #163 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xsd2php.