Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

XML for Java programming - Is this a good and correct way to explain XML to a beginner ?  RSS feed

 
Andy Jack
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
XML is like a set of rules for making your own language. Lets say that XML has these rules for language -

1 - Contains words that mean something. You can make your own words.
ex. Sugar = sugar in english, = Zucker in german.

2 - Must have punctuation.
ex end of sentence is . in English and @ in alien language :P

Lets create languages which are based only on these rules.
Later, we will use these languages to express this English sentence -
Ok ! You can play.

(1) - AlienXML
Lets define the 2 rules
Words - Refer to a alien dictionary to see alien words. Ok = Grok, You = krihm
can play = ker sim gah

Punctuation - @ is like a full stop. No , or !
like symbols because aliens dont need them.

Our sentence in alien - Grok krihm ker sim gah @

(2) - MonkeyXML
Lets define the 2 rules
Words - No words really. All sounds. Ooo = ok, creee = you , can eeeh, play = gooo
Punctuation - must be in capitals. ! = OP and . = GEE

Our sentence in monkey - Ooo OP creee eeeh gooo GEE.

Hope this makes sense. Wrote this quickly. If you have a better way of explaining it, please show us how, or find errors in this explanation.

Thanks.


 
Stephan van Hulst
Saloon Keeper
Posts: 7799
142
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hate to break it to you, but this isn't want XML is about at all. This may just be one of the applications of XML, but it's hard to tell because you never show an example of how the XML is used.

XML not a set of rules. XML is a language, mostly used to bring structure to data. It can be used to indicate what a piece of data means, and how it relates to other data. XML is used to store and transmit data in a readable format.

In your particular case, that data can refer to language rules.
 
Andy Jack
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stephan van Hulst wrote:Hate to break it to you, but this isn't want XML is about at all. This may just be one of the applications of XML, but it's hard to tell because you never show an example of how the XML is used.

XML not a set of rules. XML is a language, mostly used to bring structure to data. It can be used to indicate what a piece of data means, and how it relates to other data. XML is used to store and transmit data in a readable format.

In your particular case, that data can refer to language rules.


Yes, I looked it up - xml is a language to create markup languages. So, i made a mistake by thinking that its just a set of rules. Still learning. I hope that I can come up with an awesome, crystal clear, head-first like analogy/answer for this.

Thanks
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Crossposting:
stackoverflow.com/questions/13786331/is-this-a-good-and-correct-way-to-explain-xml-to-a-beginner
 
Andy Jack
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Yes, I did that because people in SO tend to dismiss questions rather hastily. I thought that javaranch would be a better place for such questions.
It seems that cross posting is not ok. Should I stop it ?
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
BeForthrightWhenCrossPostingToOtherSites (<- click)
 
Stephan van Hulst
Saloon Keeper
Posts: 7799
142
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andy Jack wrote:xml is a language to create markup languages


No. Again, this is one of its possible applications. You can use XML to annotate data in all sorts of ways, not just define markup languages.
This is an example of how XML can be used to keep a record of persons. In this case it is not used to define a language. It just annotates data in a readable way.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!