0

First time asking a question in StackOverFlow.

I have a question on simplexml_load_string. It does not seem to work when there is attribute and value in the tag.

My code is as follows:

<?php
 $string = '<name use="L">
                    <given>FirstName</given>
                    <given qualifier="BR">NickName</given>
                    <given qualifier="AA">Previous Name</given>
                    <family>LastName</family>
                </name>';
 $a = simplexml_load_string($string);
  print_r($a);
?>

The output I'm getting is:

SimpleXMLElement Object
(
    [@attributes] => Array
        (
            [use] => L
        )

    [given] => Array
        (
            [0] => FirstName
            [1] => NickName
            [2] => Previous Name
        )

    [family] => LastName
)

But it is skipping the attribute Qualifier "BR" and "AA"? Is this a limitation of simplexml_load_string? Is there another way to get the Qualifier attribute? Thanks so much VJ

0 Answers0