Live data from Hacker News

Why XML tags are so fundamental to Claude

glthr.com

41–50 of 160 posts

Re: Why XML tags are so fundamental to Claude

#41

Total tangent, but what vagary of HTML (or the Brave Browser, which I'm using here) causes words to be split in very odd places? The "inspect" devtools certainly didn't show anything unusual to me. (Edit: Chrome, MS Edge, and Firefox do the same thing. I also notice they're all links; wonder if that has something to do with it.) https://i.imgur.com/HGa0i3m.png

Ask Claude?

Re: Why XML tags are so fundamental to Claude

#42

> a contrast between Claude’s modern approach [...] XML, a technology dating back to 1998 Are we really at the point where some people see XML as a spooky old technology? The phrasing dotted around this article makes me feel that way. I find this quite strange.

Yup. Kids these days...

Re: Why XML tags are so fundamental to Claude

#43

I think XML is good to know for prompting (similar to how was popular for outputs, you can do that for other sections). But I have had much better experience just writing JSON and using line breaks, colons, etc. to demarcate sections. E.g. instead of .... ..... .... ... .... {actual input} Just doing something like: ...instructions... input: .... output: {..json here} ...maybe further instructions... input: {actual i…

XML is much more readable than JSON, especially if your data has characters that are meaningful JSON syntax

Re: Why XML tags are so fundamental to Claude

#44

> a contrast between Claude’s modern approach [...] XML, a technology dating back to 1998 Are we really at the point where some people see XML as a spooky old technology? The phrasing dotted around this article makes me feel that way. I find this quite strange.

XML has been "spooky old technology" for over a decade now. It's heyday was something like 2002.

Nobody dares advertise the XML capabilities of their product (which back then everybody did), nobody considers it either hot new thing (like back then) or mature - just obsolete enterprise shit.

It's about as popular now as J2EE, except to people that think "10 years ago" means 1999.

Re: Why XML tags are so fundamental to Claude

#46

> a contrast between Claude’s modern approach [...] XML, a technology dating back to 1998 Are we really at the point where some people see XML as a spooky old technology? The phrasing dotted around this article makes me feel that way. I find this quite strange.

The evidence suggests that XML was never that popular though for the general audience, you have to admit.

For Web markup, as an industry we tried XHTML (HTML that was strictly XML) for a while, and that didn't stick, and now we have HTML5 which is much more lenient as it doesn't even require closing tags in some cases.

For data exchange, people vastly prefer JSON as an exchange format for its simplicity, or protobuf and friends for their efficiency.

As a configuration format, it has been vastly overtaken by YAML, TOML, and INI, due to their content-forward syntax.

Having said all this I know there are some popular tools that use XML like ClickHouse, Apple's launchd, ROS, etc. but these are relatively niche compared to (e.g.) HTML

Re: Why XML tags are so fundamental to Claude

#47

I think XML is good to know for prompting (similar to how was popular for outputs, you can do that for other sections). But I have had much better experience just writing JSON and using line breaks, colons, etc. to demarcate sections. E.g. instead of .... ..... .... ... .... {actual input} Just doing something like: ...instructions... input: .... output: {..json here} ...maybe further instructions... input: {actual i…

XML helps because it a) Lets you to describe structures b) Make a clear context-change which make it clear you are not "talking in XML" you are "talking about XML".

I assume you are right too, JSON is a less verbose format which allows you to express any structure you can express in XML, and should be as easy for AI to parse. Although that probably depends on the training data too.

I recently asked AI why .md files are so prevalent with agentic AI and the answer is ... because .md files also express structure, like headers and lists.

Again, depends on what the AI has been trained on.

I would go with JSON, or some version of it which would also allow comments.

Re: Why XML tags are so fundamental to Claude

#48

I think XML is good to know for prompting (similar to how was popular for outputs, you can do that for other sections). But I have had much better experience just writing JSON and using line breaks, colons, etc. to demarcate sections. E.g. instead of .... ..... .... ... .... {actual input} Just doing something like: ...instructions... input: .... output: {..json here} ...maybe further instructions... input: {actual i…

XML is much more readable than JSON, especially if your data has characters that are meaningful JSON syntax

I think readability is in the eye of the reader. JSON is less verbose, no ending tags everywhere, which I think makes it more readable than XML.

But I'd be happy to hear about studies that show evidence for XML being more readable, than JSON.

Re: Why XML tags are so fundamental to Claude

#49
This seems like an actual good use for XML. Using it as a serialization format always rubbed me the wrong way (it’s super verbose, the named closing tag are unnecessary grammar-wise, the attribute-or-child question etc.) But to markup and structure LLM prompts and response it feels better than markdown (which doesn’t stream that well)

Re: Why XML tags are so fundamental to Claude

#50
post #23

Earlier quoted context omitted.

Could you clarify, do those tags need to be tags which exist and we need to lear about them and how to use them? Or we can put inside them whatever we want and just by virtue of being tags, Claude understands them in a special way?

They probably don’t need to be specific values. The model is fine tuned to see the tags as signals and then interprets them

If it walks like a duck ... AI thinks it is something like a duck.
Post reply on HN