1 / 9

XML Example: a datafile <People> <Person> <FirstName>Ed</FirstName> <LastName>Gogol</L

XML Example: a datafile <People> <Person> <FirstName>Ed</FirstName> <LastName>Gogol</LastName> </Person> <Person> <FirstName>John</FirstName> <LastName>Smith</LastName> </Person> </People>

tanuja
Download Presentation

XML Example: a datafile <People> <Person> <FirstName>Ed</FirstName> <LastName>Gogol</L

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. XML Example: a datafile <People> <Person> <FirstName>Ed</FirstName> <LastName>Gogol</LastName> </Person> <Person> <FirstName>John</FirstName> <LastName>Smith</LastName> </Person> </People> Elements have an opening tag, for example <Person> and a closing tag, for example </Person>. Person is the element name. Everything within the opening and closing tag pertains to that instance of the element. Note how the Person element contains the FirstName and LastName elements.

  2. XML Isn’t Positional: “White Space” is ignored This: <People> <Person> <FirstName>Ed</FirstName> <LastName>Gogol</LastName> </Person> <Person> <FirstName>John</FirstName> <LastName>Smith</LastName> </Person> </People> Is the same as this: <People> <Person> <FirstName>Ed</FirstName> <LastName>Gogol</LastName> </Person> <Person> <FirstName>John</FirstName> <LastName>Smith</LastName> </Person> </People> Is the same as this: <People> <Person><FirstName>Ed</FirstName><LastName>Gogol</LastName></Person> <Person><FirstName>John</FirstName><LastName>Smith</LastName></Person> </People>

  3. Data Values can get as large as they need to be – there is no inherent limit: <People> <Person> <FirstName>Ed</FirstName> <LastName>Gogol</LastName> </Person> <Person> <FirstName>John</FirstName> <LastName>Smith-Jones-Doe-Roe-Hastings-Michaels-George-Mom-Dad-Sis-Brother-Mommy-Daddy-Brown-Okay</LastName> </Person> </People> If a field needs to expand, it simply expands. This is in stark contrast to the hassles associated with expanding standard positional-format records.

  4. If you need to add a new element, you simply add it: <People> <Person> <FirstName>Ed</FirstName> <MiddleName>Martina</MiddleName> <LastName>Gogol</LastName> </Person> <Person> <FirstName>John</FirstName> <LastName>Smith</LastName> </Person> </People> Likewise, in stark contrast to the hassles associated with expanding standard positional-format records. In this case the MiddleName element is optional.

  5. Elements can contain elements can contain elements – there’s no limit: <People> <Person> <FirstName>Ed</FirstName> <MiddleName>Martina</MiddleName> <LastName>Gogol</LastName> <Pet> <PetName>Fido</PetName> <PetType>Bowser</PetType> </Pet> <Pet> <PetName>Slithery</PetName> <PetType>Python</PetType> </Pet> </Person> </People> There’s no limit to the number of Pets a Person can have.

  6. Numeric values can get as big (or as small) (or as negative) as they need: <People> <Person> <FirstName>Kim</FirstName> <LastName>Taylor</FirstName> <NetWorth>56000000</NetWorth> </Person> <Person> <FirstName>Ed</FirstName> <LastName>Gogol</LastName> <NetWorth>-57.1768</NetWorth> </Person> </People> No more hassles with assumed numbers of decimal positions, decimal locators, or reading “packed” fields.

  7. Using “Attributes” for data values makes it simpler: With Elements Only: <People> <Person> <FirstName>Kim</FirstName> <LastName>Taylor</FirstName> <NetWorth>56000000</NetWorth> </Person> <Person> <FirstName>Ed</FirstName> <LastName>Gogol</LastName> <NetWorth>-57.1768</NetWorth> </Person> </People> With Elements and Attributes: <People> <Person FirstName = “Kim” LastName = “Taylor” NetWorth = 56000000> </Person> <Person FirstName = “Ed” LastName = “Gogol” NetWorth = -57.1768 /> </People> Note how the /> at the end of the second Person eliminates the need for the closing tag.

  8. XML (Extensible Markup Language) is nothing more (or less) than an impossibly flexible means of formatting data. • Its flexibility is derived from its simplicity. And its power comes from its flexibility. • You define your own XML Vocabulary for a particular purpose. For example: • FIXML – FIX Protocol Markup Language • MDDL – Market Data Definition Language • FPML – Financial Products Markup Language • SPANml – SPAN Markup Language • Each XML vocabulary specifies the exact definition of the elements, the attributes, how they must be ordered, how they relate to each other, etc. • The original means for specifying an XML vocabulary was a DTD (Data Type Definition) File. The newer and more powerful method is with a schema file. With a schema you can specify data types, etc.

  9. All the major software companies – Sun, IBM, Microsoft, etc. – are deeply committed to XML as a revolutionary technology. • There is a universe of tools out there for developers to use. • It’s tremendously powerful (once you know how to use it.) • Does it increase bandwidth? Not necessarily. • You don’t waste space as you do with fixed-length fields. • You can choose your attribute names and element names so the ones that are the most widely used are fairly small. • It compresses very well. • There are new features coming which allow the use of aliases rather than the full element or attribute name.

More Related