Any idea how can join and ID with another set of data and then print out certain information? I want to print out The name and the country of a user. I am stuck already for a few hours and I would appreciate any help and suggestion!
These are the the files : https://drive.google.com/drive/folders/15vi1sW5TExqZBCAz-gUTWF5xYCq9pC4u?usp=sharing
EDIT: The code that I wrote is the problem. I get partial results but I am missing the "JOIN" between different XML sets of data.
Edit2: I need to obtain as a result: 1) A project title 2) Acronym 3) Abstract and 4) Partner name and country. I am missing part 4) where I was trying to join based on PartnerRef values and by the list of partners at the end of the xml file.
XML:
<?xml version="1.0" encoding="UTF-8"?>
<InfoSystem>
<Workflows>
<Workflow>
<Name>project-workflow</Name>
<Transition>
<From>in-preparation</From>
<To>submitted</To>
</Transition>
<Transition>
<From>submitted</From>
<To>accepted</To>
<To>rejected</To>
</Transition>
<Transition>
<From>accepted</From>
<To>running</To>
</Transition>
<Transition>
<From>running</From>
<To>completed</To>
</Transition>
</Workflow>
</Workflows>
<Projects>
<Project>
<Id>3</Id>
<StatusHistory>
<Status>
<Value>in-preparation</Value>
<Date>2019-01-20</Date>
</Status>
<Status>
<Value>submitted</Value>
<Date>2019-03-20</Date>
</Status>
<Status>
<Value>rejected</Value>
<Date>2019-06-01</Date>
</Status>
</StatusHistory>
<Submission>
<Title>Secure environments for e-commerce</Title>
<Acronym>SEEC</Acronym>
<Abstract>
<Parag><Fragment>The project aims at providing innovative solutions for secure e-commerce</Fragment></Parag>
</Abstract>
<WorkPackages>
<WorkPackage>
<No>1</No>
<Title>Coordination</Title>
<Tasks>
<Task>
<No>1</No>
<Name>Setting-up the project framework</Name>
<Start>2019-07-01</Start>
<End>2019-09-01</End>
<Effort>
<Partner>
<PartnerRef>4</PartnerRef>
<DaysNb>20</DaysNb>
</Partner>
</Effort>
</Task>
<Task>
<No>2</No>
<Name>Project management</Name>
<Start>2019-07-01</Start>
<End>2019-07-01</End>
<Effort>
<Partner>
<PartnerRef>4</PartnerRef>
<DaysNb>100</DaysNb>
</Partner>
<Partner>
<PartnerRef>6</PartnerRef>
<DaysNb>40</DaysNb>
</Partner>
<Partner>
<PartnerRef>7</PartnerRef>
<DaysNb>40</DaysNb>
</Partner>
</Effort>
</Task>
</Tasks>
<Deliverables>
<Deliverable>
<Id>1</Id>
<Name>Management report 1</Name>
<Type>report</Type>
<DueDate>2019-12-20</DueDate>
</Deliverable>
<Deliverable>
<Id>2</Id>
<Name>Management report 2</Name>
<Type>report</Type>
<DueDate>2020-06-30</DueDate>
</Deliverable>
<Deliverable>
<Id>3</Id>
<Name>Final management report</Name>
<Type>report</Type>
<DueDate>2021-07-01</DueDate>
</Deliverable>
</Deliverables>
</WorkPackage>
<WorkPackage>
<No>2</No>
<Title>Design of the platform</Title>
<Tasks>
<Task>
<No>1</No>
<Name>User interface design</Name>
<Start>2020-09-01</Start>
<End>2020-12-12</End>
<Effort>
<Partner>
<PartnerRef>6</PartnerRef>
<DaysNb>150</DaysNb>
</Partner>
<Partner>
<PartnerRef>7</PartnerRef>
<DaysNb>220</DaysNb>
</Partner>
</Effort>
</Task>
</Tasks>
<Deliverables>
<Deliverable>
<Id>1</Id>
<Name>Paper about existing approaches</Name>
<Type>publication</Type>
<DueDate>2020-10-30</DueDate>
</Deliverable>
</Deliverables>
</WorkPackage>
</WorkPackages>
</Submission>
</Project>
<Project>
<Id>4</Id>
<StatusHistory>
<Status>
<Value>in-preparation</Value>
<Date>2022-02-02</Date>
</Status>
</StatusHistory>
<Submission>
<Title>An approach to develop Web-based applications</Title>
<Acronym>WBA</Acronym>
<Abstract><Parag><Fragment>The approach relies on the use of semi-structured data</Fragment></Parag></Abstract>
</Submission>
</Project>
</Projects>
<Partners>
<Partner>
<Id>1</Id>
<Name>UNI1</Name>
<Country>CH</Country>
</Partner>
<Partner>
<Id>2</Id>
<Name>UNI2</Name>
<Country>FR</Country>
</Partner>
<Partner>
<Id>3</Id>
<Name>Pear</Name>
<Country>BE</Country>
</Partner>
<Partner>
<Id>4</Id>
<Name>CIMER</Name>
<Country>FR</Country>
</Partner>
<Partner>
<Id>5</Id>
<Name>LFPE</Name>
<Country>CH</Country>
</Partner>
<Partner>
<Id>6</Id>
<Name>UNI3</Name>
<Country>IT</Country>
</Partner>
<Partner>
<Id>7</Id>
<Name>UNI4</Name>
<Country>BE</Country>
</Partner>
<Partner>
<Id>8</Id>
<Name>APER</Name>
<Country>GR</Country>
</Partner>
</Partners>
<Publications>
<PaperInJournal>
<Id>1</Id>
<Title>Principles of remote learning</Title>
<Authors>
<Author>
<FirstName>Alain</FirstName>
<LastName>Térieur</LastName>
</Author>
<Author>
<FirstName>Alex</FirstName>
<LastName>Térieur</LastName>
</Author>
</Authors>
<Year>2022</Year>
<Journal>Journal of e-learning</Journal>
<Vol>3</Vol>
<No>11</No>
<Pages>
<From>34</From>
<To>45</To>
</Pages>
</PaperInJournal>
<PaperInJournal>
<Id>2</Id>
<Title>Authoring multimedia</Title>
<Authors>
<Author>
<FirstName>Anne</FirstName>
<LastName>Dupont</LastName>
</Author>
<Author>
<FirstName>Victor</FirstName>
<LastName>Térieur</LastName>
</Author>
</Authors>
<Year>2021</Year>
<Journal>Information systems</Journal>
<Vol>5</Vol>
<No>3</No>
<Pages>
<From>134</From>
<To>145</To>
</Pages>
</PaperInJournal>
</Publications>
</InfoSystem>
php code:
<?php
include 'info-systems.php';
include 'example.php';
$InfoSystem = simplexml_load_file("info-systems.xml");
foreach($InfoSystem->xpath('//Project') as $project){
$projectId = $project->Id;
$selectedPartner = $project->xpath('//PartnerRef');
//print_r($selectedPartner);
echo "Title: " . $project->Submission->Title;
echo "<br>";
echo "Acronym: " . $project->Submission->Acronym;
echo "<br>";
echo "Abstract: " . $project->Submission->Abstract->Parag->Fragment;
echo "<br>";
echo $project->Submission->Abstract->List->asXML();
echo "<br>";
foreach($InfoSystem->xpath('//Partner') as $partner){
if(in_array(1, $selectedPartner, TRUE)){ // This doesn't work at all
echo 'Name: ' . $partner->Name;
echo 'Country: ' . $partner->Country;
}
//echo $partner->Name;
}
echo "<br><br>";
}
?>