2

Possible Duplicate:
SimpleXML Reading node with a hyphenated name

I have some xml which has non alpha characters in the element names, such as '.' or '-'

e.g.

<MyXML>
    <SomeData>
        <Period.InTheMiddle>Data i want to get</Period.InTheMiddle>
    </SomeData>
</MyXML>

Now using $xml->SomeData->Period.InTheMiddle to get at the data won't work. So what do I have to do to be able to use elements that have '.' or '-' in their name?

Community
  • 1
  • 1
Matt
  • 91
  • 1
  • 8
  • 4
    Have you tried `$xml->SomeData->{"Period.InTheMiddle"}` ? – ircmaxell Nov 16 '10 at 21:49
  • @ircmaxell I know i'm newer to SO, but I was searching for unanswered questions to see if I have some answers, and came accross this, IMO you should answer the question and @Matt shoud accept the answer, so it will not show in "unanswered" anymore. – Radu Maris Mar 23 '11 at 09:07

0 Answers0