Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Apr 2013
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts

    XML data representation

    If I take data (1,2,3,a,b,c,..) and I put it in XML form (<a>, <b>, <c>,..), does that mean that data becomes information because of XML? Does XML turn data into information by representing it in tags?

    I am also reading here in a slideshow: "In JDOM, every XML tree is approached as a document even though the content has nothing to do with documents". I looked up the definition of 'document' on dictionary.com and it states that a document is meant as being informative. 'informative' means 'to convey information'. Then, if the purpose of XML is to represent data into information, why does the content of an XML tree supposedly not have anything to do with a document and therefore nothing to do with information? This is confusing. Perhaps the author of that slideshow was using different semantics than I have in my mind right now.

    Any thoughts on this?

    Thank you.

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,313
    Thanks
    23
    Thanked 612 Times in 611 Posts
    XML stands for extensible Markup Language.
    XML is designed to transport and store data.

    If a line of xml code looks like this:
    <name>Thomas</name>
    You can extract "Thomas" when you go to find out the name.

    Does that help?
    Evolution - The non-random survival of random variants.

    "If you leave hydrogen alone, for long enough, it begins to think about itself."

  • #3
    New to the CF scene
    Join Date
    Apr 2013
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Not really, I was looking for an ontological and metaphysical explanation, i.e. what are we looking at when we see <name>Thomas</name> as opposed to the raw data Thomas? What happens biologically in our brain when our eyes see that pattern? 'Thomas' gets associated with 'name', which gets associated with 'person'. For someone not knowing the name 'Thomas', then it would simply be a collection of singularities: T h o m a s.

    Is <name>Thomas</name> information? I would think so, because our brain translates that pattern into an entity. Thus, is XML on its own information? Because data comes raw from a database.

    So if XML is just another representation of data, it does not necessarily mean that data becomes information when poured into the XML format? After all, information is meaningful by itself (and therefore having semantics), as is said here:
    http://answers.yahoo.com/question/in...3173846AA6IEbh

    XML translates data into a structure and our brain translates that structure into entities that make sense to us.. ultimately conveying to our brain that what is being seen is actually information. I have my doubts on that last part.

    <parent>
    <child>1</child>
    <child>2</child>
    </parent>

    When we introduce 1 and 2 into the element <child>, then our brain (like the gestalt theory postulates: http://en.wikipedia.org/wiki/Gestalt_psychology) translates that <child> as having the 'child' relationship with its 'parent'. We therefore see it as a whole, an entity and not as a 'sum of parts'. Another relationship would be that values 1 and 2 are now associated with the word 'child'. I could say as well <a>1</a>, <a>2</a>. Now our brain knows that 1 is an 'a'. And so forth.

    In practical terms however, XML (as is stated in the slides I am reading) represents data like this:

    (input)XML file -> (search its structure and represent it)XPath -> (output) XAML, XHTML, XML, CSV. As we can see, another XML itself can be the result of an input XML file. Therefore it confuses me a little bit what the purpose of the language itself actually is. I agree that it is just another representation of data. In my example, one could say that one takes data, represents it into XML, uses XPath to search in its tree to use its values, to finally represent it into another format. So yes, it transports it.

    So according to this article:
    http://en.wikipedia.org/wiki/Markup_language

    XML does not have presentation semantics. However, when we look at XML our brain creates semantics for us, because of the gestalt.
    If XML is extensible, how do you extend it then?
    How does XML store data?

    I will do some more thinking on this.

  • #4
    Regular Coder patryk's Avatar
    Join Date
    Oct 2012
    Location
    /dev/couch
    Posts
    398
    Thanks
    2
    Thanked 64 Times in 64 Posts
    "extensible" means you don't have finite mumber of markups there like for example in html.

    like in this example:
    if you have a basket containing 3 veggies say potato, selery, and tomato, in XML it would be:
    Code:
    <basket>
       <veggie>potato</veggie>
       <veggie>selery</veggie>
       <veggie>tomato</veggie>
    </basket>
    or if you would like to represent quantities of those veggies in you r basket, you could do it this way:
    Code:
    <basket>
       <veggie>
            <name>potato</name>
            <quantity>1</quantity>
       </veggie>
       <veggie>
            <name>selery</name>
            <quantity>1</quantity>
       </veggie>
       <veggie>
            <name>tomato</name>
            <quantity>1</quantity>
       </veggie>
    </basket>
    sorry i can't explain it better

    -------------------------------------------------------------------------------
    "Real Programmers can write assembly code in any language" - Larry Wall

  • Users who have thanked patryk for this post:

    123555 (04-09-2013)

  • #5
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    XML is simply a self describing language. That means that when I create a document that contains:
    Code:
    <animals>
        <animal>
            <type>Cat</type>
        </animal>
        <animal>
            <type>Dog</type>
        </animal>
    </animals>
    It would mean that I have a collection of animals which are type Cat and Dog. That is a human readable aspect of it, the self-describing mechanism. The tags are structural elements and are how we logically divide the sections. It carries all meaning, and absolutely no meaning at the same time. I could just as easily have a text document:
    Code:
    Cat
    Dog
    What gives the XML the meaning is the doctype or schema in use, and how the language reading it interprets it. So that would indicate that the element name's chosen don't represent information, rather they represent a logical division of said information. Does that mean it doesn't represent information? No it doesn't. I could just as easily write the same document as:
    Code:
    <animals>
        <Cat/>
        <Dog/>
    </animals>
    And it may be just as valid as the previous (although IMHO I wouldn't consider this to be information as its structural, but that doesn't mean it cannot be treated as such). This is the point of XML; aside from syntax, there are no rules only how I interpret said rules.

    The choice of names is for human readability, simply the associations we make as people. That would fall in line with why would I name a method getPerson() instead of _53askk66k477kj4j()? Both are completely valid, and ultimately either can be chosen. Obviously I'll use the one that I can read though.

    So the purpose of XML? To describe itself to another language based on the ruleset governed by the language itself. Take a soap service for example. The WSDL is a type of schema document that dictates what information is provided, and how its presented. This is then used by a soap client to know what and how it can ask for information from the soap server. It is loose, so you can provide a plethora of information to it regarding arguments and types, but its tight in the sense that it must come in a particularly described structure. This is the difference between well formed XML and correct XML. Correct XML is simply XML that is governed by a DTD or Schema ruleset and has adhered to it. Well formed is simply XML that has no particular meaning.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • Users who have thanked Fou-Lu for this post:

    123555 (04-09-2013)

  • #6
    New to the CF scene
    Join Date
    Apr 2013
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts
    That was very quick to the point. It was exactly what I was thinking. Thanks, I understand it now.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •