26 ms·
Your example shows taking a subset of a text node and wrapping in a tag. How many XML languages use this quality? The only ones I've ever worked with go to grea
by simpaticoder 3y ago
Your example shows taking a subset of a text node and wrapping in a tag. How many XML languages use this quality? The only ones I've ever worked with go to great lengths to not mix text nodes with other children nodes. And it's easy to see why such usage is considered poor practice: if you're making a language, you generally want more structure, not less.
I'm not familiar with the distinction between 'markup languages' and 'data languages'. Ignoring the text/structured mixing issue, which I think is vestigial in XML and unused in DSLs, these are all isomorphic to each other and can nest data inside of data in a similar way:
<person>
<name>John Doe</name>
<age>30</age>
<city>New York</city>
<employment>
<position>Software Engineer</position>
<company>ABC Tech</company>
<years>5</years>
</employment>
</person>
{
"person": {
"name": "John Doe",
"age": 30,
"city": "New York",
"employment": {
"position": "Software Engineer",
"company": "ABC Tech",
"years": 5
}
}
}
person:
name: John Doe
age: 30
city: New York
employment:
position: Software Engineer
company: ABC Tech
years: 5