good day, I have a UML class diagram exported to an XML file, and the code basically and repeatedly is like this:
<UML:Class name="Zip Code" isLeaf="false" xmi.id="{C7C65474-DD51-4165-89A0-FB552A929185}" isAbstract="false" visibility="public">
So, what i need to do, is to output to the user all the class(etc) found in the file. More exactly, i need to read the name inside the double quotes.
More properly, read the string inside the double quotes from a specific tag, example:
to get all classes names i must search in: <UML:Class name=" STRING WHAT I WANNA GET "
to get all atributtes names i must search in: <UML:Attribute name=" STRING I WANNA GET "
edit : i have tried but sttil not working :x
i have this;
example.php
<?php
$xmlstr = <<<XML
<UML:Class name="Colaborator" isLeaf="false" xmi.id="{B8D626AE-F100-4548-9136-057E68BE577D}" isAbstract="false" visibility="public">
<UML:Classifier.feature>
<UML:Attribute name="Colaborator Name" xmi.id="{BB9111A8-740A-4463-9DF8-719E21E3F1CC}" ownerScope="instance" visibility="private" changeability="changeable">
<UML:StructuralFeature.type>
<UML:Classifier xmi.idref="Dttp0"/>
<UML:lol> sfdsf </UML:lol>
</UML:StructuralFeature.type>
</UML:Attribute>
<UML:Attribute name="Colaborator Address" xmi.id="{D7C15DA3-F86B-4696-874C-C69F94CDEE51}" ownerScope="instance" visibility="private" changeability="changeable">
<UML:StructuralFeature.type>
<UML:Classifier xmi.idref="Dttp1"/>
</UML:StructuralFeature.type>
</UML:Attribute>
</UML:Classifier.feature>
</UML:Class>
XML;
?>
and in test.php
<?php
include 'example.php';
$UML:Class = new SimpleXMLElement($xmlstr);
foreach ($UML:Class->xpath('//UML:Attribute') as $attr) {
echo $attr->name, PHP_EOL;
}
?>