Hacker News new | past | comments | ask | show | jobs | submit login

Yes, you can parse XML that way, but you shouldn't. It's more work than you originally thought.

Example: I've tried two parts of the xml syntax, <?xml version="1.0"?> and namespaces <foo:bar />, and it didn't seem to parse either. (At least if I understood the output right, it doesn't say "parsed" or "not parsed").

So it's the typical "author's idea of xml" parser, not xml parser.




It doesn’t handle self-closing tags, but that’s not the point. It would be trivial to add that, but again, that’s not the point.

The point is that you probably don’t want to do this with regular expressions, even though, contrary to popular opinion, you pretty much can. The article even calls the solution “slow and overspecified, but still kinda neat”.


Self closing tags are to the best of my knowledge not a part of XML.


The XML spec refers to them as "empty-element" tags.

http://www.w3.org/TR/REC-xml/#sec-starttags


Oh ofcourse, I thought evincarofautumn meant the SGML/HTML thing where you don't need to close certain tags.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: