Closed ricoos closed 3 years ago
I see \AnyType
. Did you check the section on how to handle the xsd any type (https://github.com/goetas-webservices/xsd2php#dealing-with-xsdanytype-or-xsdanysimpletype)?
The error is on the attribute issuing-type
that is marked as "any type"
Thanks for you help. In fact AnyType was because of a poorly defined XSD in the first place so I went the other way regarding \AnyType; I made a correction in the XSD (added a type = string for element issuing-type) and have no \AnyType anymore. It works well now with attribute issuing-type. I will try to avoid AnyType where possible, as I am too much a beginner to deal with XmlSerializationVisitor and stuff.
Hello
I wand to deserialize an xml that has attributes which is xs:NCName in xsd. In metadata file, it is
<xs:attribute name="issuing-type" use="required"/>
. For example(...)<invoice issuing-type="DEMAT">(...)
if I remove the attributes in my xml it works. If I leave the attributes it throws Uncaught ReflectionException: Class \ does not exist in C:\xampp\htdocs\test\import12\vendor\jms\metadata\src\MetadataFactory.php:175Can you help me understand where is my mistake ?
During deserialization of an xml with attributes, the classloader is called with an empty class name, the stack trace shows "[0]" object on line number 5. Here is a trace if classloader in case serached class is empty
During deserialization of an xml without attributes, the classloader is called , the stack trace shows showing "invoice" on line number 5
0 Composer\Autoload\ClassLoader->loadClass(App\Bindings\XXX\Invoices\Invoices)
1 spl_autoload_call(App\Bindings\XXX\Invoices\Invoices)
(...)
5 JMS\Serializer\GraphNavigator\DeserializationGraphNavigator->accept(SimpleXMLElement Object ([invoice] => SimpleXMLElement Object ([placeOfSupply] => FR,[exclusive-tax-amount] =(...)
here is App.Bindings.XXX.Invoices.Invoice.yml :
here is my php class file Invoice.php :
my xml file that fails
my xml file that works
my calling php code :
extract from xsd that originate php class