Valid PI tag names

S

Spacen Jasset

I am thinking of using XML PI tags to convey some preprocessing
instructions to a pre-processor before passing the xml to an xmlparser
in an external library.

Something likethis

<?pi?>

I've read the xml specification and it seems to allow colons in the PI
name like namespaces, thus:

<?pi:test?>

However, internet exporer complains the document isn't valid. So
presumably it's not and there is some footnote to this affect somewhere?
 
M

Martin Honnen

Spacen Jasset wrote:

I've read the xml specification and it seems to allow colons in the PI
name like namespaces, thus:

<?pi:test?>

However, internet exporer complains the document isn't valid. So
presumably it's not and there is some footnote to this affect somewhere?

Yes, XML 1.0 doesn't know about namespaces, a second recommendation
covers that and it says in here
<http://www.w3.org/TR/REC-xml-names/#Conformance>

"No entity names, PI targets, or notation names contain any colons."
 
R

Richard Tobin

Spacen Jasset said:
I've read the xml specification and it seems to allow colons in the PI
name like namespaces, thus:

<?pi:test?>

However, internet exporer complains the document isn't valid. So
presumably it's not and there is some footnote to this affect somewhere?

It's legal XML, but most tools expect conformance to other standards
too, in particular the XML Namespaces specification. This uses colons
for its own purposes, and does not allow them in PI names, so it would
be very unwise to use them. You can still use hyphens and underscores.

-- Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top