PHP inside attributes

Having trouble installing Oxygen? Got a bug to report? Post it all here.
biolizard89

PHP inside attributes

Post by biolizard89 »

I currently use XMLSpy, and one of my problems with it is that its validator gets annoyed about PHP inside an attribute value, because processing instructions aren't allowed there. It also gets annoyed at me when I try to echo() the XML declaration like PHP likes, because the ?> in the XML declaration isn't recognized as part of a PHP string, so it thinks it's the end of the PHP and then gets annoyed when it finds the rest of the code.

Does oXygen have these same problems? If it doesn't, I would probably switch to it.

Thanks in advance.
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi,

If you edit an XML document then you should escape < as < otherwise that XML document is not wellformed. This is only a representation constraint as any application that will read the document will get the < character in the attribute value instead of <

So instead of:
<test att="<?php ... ?>"/>
you should write
<test att="<?php ... ?>"/>

I do not understand your second problem maybe you can add a sample.

You can get a 30 days trial of oXygen and try it out to see if it works for you.

Best Regards,
George
Post Reply