Page 1 of 1

PHP inside attributes

Posted: Tue Aug 31, 2004 3:13 am
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.

Posted: Tue Aug 31, 2004 11:33 am
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