KBD

Keith Devens .com

Friday, July 4, 2008 Flag waving
In Iran, we don’t have homosexuals like you do in this country. – Mahmoud Ahmadinejad (speech at Columbia University, 9/24/07)
← Entry 1722Entry 1724 →

Daily link icon Wednesday, March 27, 2002

Entry 1723

Invalid characters in XML tags?

If anyone knows the answer to this please tell me. What characters are illegal in XML tags? In my XML parser (which I now plan on finishing again thanks to PYX), for simplicity I want to have a tag be directly available in a data structure, as in $xml["tag"], and have any attributes of the "tag" tag be available as something like $xml["tag:attribute"]. The problem is ":" isn't illegal... well, technically it's illegal in a tag because it's the namespace separator.

In any case, I won't be able to separate tags and attributes by a colon. How's a semicolon? Or is anything wrong with just using a space?

← Entry 1722Entry 1724 →

Comments XML gif

Adam Vandenberg (http://flangy.com) wrote:

Specs on tag names:
http://www.w3.org/TR/2000/REC-xml-20001006

You can start a tag with a letter or _ or :, and after that you can use letters, numbers, certain UNICODE characters, or the punctuation .-_:

A semicolon or comma or space would be illegal in a tag name, so I guess they'd be OK for your syntax.

∴ Adam Vandenberg | 27-Mar-2002 3:41am est | http://flangy.com | #155

Keith (http://www.keithdevens.com/) wrote:

Wow, I didn't realize a period is allowed. A period would have been nice to use, though I didn't think of it. Thanks a bunch Adam. I'll use a space Smiley

By the way, you pointed to the spec... here's the actual BNF for the opening tag (http://www.w3.org/TR/2000/REC-xml-20001006#dt-stag).

Keith | 27-Mar-2002 4:00am est | http://www.keithdevens.com/ | #156

Adam Vandenberg wrote:

Whoops. I /meant/ to post to the BNF for names, but I was using a browser that didn't update the URL bar when an anchor was follwed.

∴ Adam Vandenberg | 27-Mar-2002 4:06pm est | #158

Feel free to post a comment below. Please see my comment policy.

Formatting Rules (No HTML):

  • **bold**, *italic*, _underlined_, --strikeout--
  • "text"="url" creates a link, and URLs are auto-highlighted
  • Blockquote: Like e-mail, begin paragraph with > (greater-than sign)
  • Lists: begin paragraph with *,-, or + (unordered), or # (ordered)
  • Code block: ?!code:language=perl|php|sql|javascript|etc.{\n}...{\n}?!/code

:
(will be your IP address if blank)
: (optional)
(Will not be shown on site)

: (optional)
:

July 2008
SunMonTueWedThuFriSat
 12345
6789101112
13141516171819
20212223242526
2728293031 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 5 posts

Recent comments XML

Girls, please don't get breast implants

> And no, you will not be receiving​a picture.

:-(...

Keith: Jul 2, 6:05am

Javascript clone function

This is a clever way to clone an​object if you are using YAHOO UI.​Same tec...

Antonio: Jul 1, 12:47pm

I hate Norton Antivirus

Oh just one other thing norton is​great at keeping people out of your​compu...

kevin.sands: Jul 1, 12:50am

Terminator 3 was awful

I think the biggest reason why T3​totally blew was because Edward​Furlong g...

76.167.172.64: Jun 29, 3:06am

Generated in about 0.13s.

(Used 8 db queries)

mobile phone