miqwit / dedex

A generic efficient DDEX parser. Parse seemlessly the complex DDEX format and transform it into classes easily useable in your PHP project. Supports several versions (3.8.2, 4.1, 4.1.1) and is listed in the official DDEX page: https://kb.ddex.net/display/HBK/Open+Source+Software
MIT License
20 stars 11 forks source link

ERN 4.1: No functions found for this tag: Party. Path is NewReleaseMessage,PartyList #4

Closed ignacioalles closed 2 years ago

ignacioalles commented 2 years ago

There is an error while parsing a message PartyList node in NewReleaseMessage using ERN 4.1 spec. Error message is:

No functions found for this tag: Party. Path is NewReleaseMessage,PartyList

and the reason is that it seems an intermediate class PartyListType is required between NewReleaseMessage and PartyType.

Message looks like:

<ern:NewReleaseMessage 
   xmlns:ern="http://ddex.net/xml/ern/41"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://ddex.net/xml/ern/41 release-notification.xsd"
   ReleaseProfileVersionId="Audio" LanguageAndScriptCode="en">
   <MessageHeader>
   [....]
   </MessageHeader>
   <PartyList>
      <Party>
         <PartyReference>PSaekoShu</PartyReference>
         <PartyName>
            <FullName>Saeko Shu</FullName>
            <FullNameIndexed>Shu, Saeko</FullNameIndexed>
         </PartyName>
         <PartyName LanguageAndScriptCode="ja-Jpan">
            <FullName>しゅうさえこ</FullName>
         </PartyName>
      </Party>
      <Party>
         <PartyReference>PEMI</PartyReference>
         <PartyName>
            <FullName>EMI MUSIC JAPAN INC.</FullName>
         </PartyName>
      </Party>
   </PartyList>
   <ResourceList>
   [....]

Here is some documentation explaining the addition in ERN-4

I can make a pull request if you'd like.

miqwit commented 2 years ago

Hello @ignacioalles. Thank you in your interest for this repository.

The PartyList is covered already. It can be "zero to many" and hence is part of DedexBundle\Entity\Ern41\NewReleaseMessage, in property partyList. It can be accessed with function addToPartyList.

Now, of course this should be called and populated automatically. I did not add a comprehensive test suite for ERN 4.1 (opposedly to 3.8.1 that I use more often). Could you help me reproducing your issue by providing me the ERN 4.1 that you are working on, maybe by anonmyzing it's content (unique IDS and names).

Thanks for your help and your interest.

miqwit commented 2 years ago

As an additional note, I am not (yet) keen to approve your PR, because the entities are automatically generated by the tool xsd2php, hence I don't want to modify them manually, but rather understand why it's not parsed properly.

ignacioalles commented 2 years ago

Hi @miqwit I've used some xml derived from ERN 4.1.1 provided samples (only changed namespace to match ERN 4.1). I could not find actual 4.1 samples.

The same problem occurs in DealList > ReleaseDeal. I've added a very basic test case in PR. Perhaps you can take it from there.

It seems that generated classes expects document to be:

<PartyList>
         <PartyReference>PSaekoShu</PartyReference>
         <PartyName>
            <FullName>Saeko Shu</FullName>
            <FullNameIndexed>Shu, Saeko</FullNameIndexed>
         </PartyName>
         <PartyName LanguageAndScriptCode="ja-Jpan">
            <FullName>しゅうさえこ</FullName>
         </PartyName>
 </PartyList>
 <PartyList>
         <PartyReference>PEMI</PartyReference>
         <PartyName>
            <FullName>EMI MUSIC JAPAN INC.</FullName>
         </PartyName>
</PartyList>

instead of

<PartyList>
      <Party>
         <PartyReference>PSaekoShu</PartyReference>
         <PartyName>
            <FullName>Saeko Shu</FullName>
            <FullNameIndexed>Shu, Saeko</FullNameIndexed>
         </PartyName>
         <PartyName LanguageAndScriptCode="ja-Jpan">
            <FullName>しゅうさえこ</FullName>
         </PartyName>
      </Party>
      <Party>
         <PartyReference>PEMI</PartyReference>
         <PartyName>
            <FullName>EMI MUSIC JAPAN INC.</FullName>
         </PartyName>
      </Party>
</PartyList>

but the first document does not pass xsd validation: Error: XMLReader::read(): Element 'PartyReference': This element is not expected. Expected is ( Party ).

miqwit commented 2 years ago

Hello @ignacioalles. I am still working on it. I made some progress in branch ddex411 but still some tests fail.

It is not related to DDEX 4.1.1 in fact, but to a special case in DDEX modelling (from XSD) where some List tags, such as PartyList (which is new to DDEX 4.1.1) or ReleaseResourceReferenceList (which is not new but is badly ignored in current version) that do not have a specific class in the model. They are just a list of objects attached to parent node, in fact. And the parser does not support it yet.

Soon! Be patient (and try my branch if you want).

miqwit commented 2 years ago

Hello @ignacioalles I fixed it in branch ddex411 which is now merge to master. Check the last version!

ignacioalles commented 2 years ago

Sorry for the late reply. I can confirm it works fine with our testing files.