Skip to main content

Home/ Groups/ PSI_ESEI
David Gelpi Fleta

XML Schema Complex Type - Text Elements - 0 views

  • This type contains only simple content (text and attributes),
  • <xs:element name="shoesize"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:integer"> <xs:attribute name="country" type="xs:string" />
David Gelpi Fleta

XML Schema Complex Types - Mixed Content - 0 views

  • A mixed complex type element can contain attributes, elements, and text.
  • mixed="true">
David Gelpi Fleta

XML Schema Complex Type - Empty Elements - 0 views

  • <xs:element name="product"> <xs:complexType> <xs:attribute name="prodid" type="xs:positiveInteger"/>
David Gelpi Fleta

XML Schema Complex Elements - 0 views

  • A complex element is an XML element that contains other elements and/or attributes. There are four kinds of complex elements: empty elements elements that contain only other elements elements that contain only text elements that contain both other elements and text Note: Each of these elements may contain attributes as well!
  • <xs:element name="employee"> <xs:complexType> <xs:sequence>
  • type="personinfo"/> <xs:complexType name="personinfo">
  • ...1 more annotation...
  • <xs:complexType name="fullpersoninfo"> <xs:complexContent> <xs:extension base="personinfo">
David Gelpi Fleta

Why Use XML Schemas? - 0 views

  • XML Schemas Support Data Types
  • It is easier to describe allowable document content It is easier to validate the correctness of data It is easier to work with data from a database It is easier to define data facets (restrictions on data) It is easier to define data patterns (data formats) It is easier to convert data between different data types
  • XML Schemas use XML Syntax
  • ...4 more annotations...
  • You don't have to learn a new language You can use your XML editor to edit your Schema files You can use your XML parser to parse your Schema files You can manipulate your Schema with the XML DOM You can transform your Schema with XSLT
  • XML Schemas are Extensible
  • Reuse your Schema in other Schemas Create your own data types derived from the standard types Reference multiple schemas in the same document
  • Well-Formed is not Enough
David Gelpi Fleta

Introduction to XML Schemas - 0 views

  • XML Schema is an XML-based alternative to DTD. An XML schema describes the structure of an XML document. The XML Schema language is also referred to as XML Schema Definition (XSD).
  • An XML Schema: defines elements that can appear in a document defines attributes that can appear in a document defines which elements are child elements defines the order of child elements defines the number of child elements defines whether an element is empty or can include text defines data types for elements and attributes defines default and fixed values for elements and attributes
  • XML Schemas are extensible to future additions XML Schemas are richer and more powerful than DTDs XML Schemas are written in XML XML Schemas support data types XML Schemas support namespaces
  • ...1 more annotation...
  • XML Schema became a W3C Recommendation 02. May 2001.
David Gelpi Fleta

XML CDATA - 0 views

  • Escape Characters Illegal XML characters have to be replaced by entity references. If you place a character like "<" inside an XML element, it will generate an error because the parser interprets it as the start of a new element.
  • < < less than > > greater than & & ampersand  ' ' apostrophe " " quotation mark
  • Apostrophes, quotation marks and greater than signs are legal, but it is a good habit to replace them.
  • ...2 more annotations...
  • CDATA Everything inside a CDATA section is ignored by the parser.
  • A CDATA section starts with "<![CDATA[" and ends with "]]>":
David Gelpi Fleta

XML Namespaces - 0 views

  • XML Namespaces provide a method to avoid element name conflicts. Name Conflicts Since element names in XML are not predefined, a name conflict will occur when two different documents use the same element names.
  • <h:table>
  • <f:table>
  • ...8 more annotations...
  • <h:table xmlns:h="http://www.w3.org/TR/html4/">
  • <f:table xmlns:f="http://www.w3schools.com/furniture">
  • xmlns:namespace-prefix="namespaceURI"
  • Note that the address used to identify the namespace is not used by the parser to look up information. The only purpose is to give the namespace a unique name.
  • Uniform Resource Identifier (URI) A Uniform Resource Identifier (URI) is a string of characters which identifies an Internet Resource. The most common URI is the Uniform Resource Locator (URL) which identifies an Internet domain address.
  • not so common type of URI is the Universal Resource Name (URN)
  • Default Namespaces Defining a default namespace for an element saves us from using prefixes in all the child elements.
  • <table xmlns="http://www.w3.org/TR/html4/">
David Gelpi Fleta

XML Data Islands - 0 views

  • An XML data island is XML data embedded into an HTML page.
  • <html> <body> <xml id="note" src="http://www.w3schools.com/note.xml"></xml>
David Gelpi Fleta

XML DTD - 0 views

  • A "Well Formed" XML document has correct XML syntax. A "Well Formed" XML document is a document that conforms to the XML syntax rules that were described in the previous chapters: XML documents must have a root element XML elements must have a closing tag XML tags are case sensitive XML elements must be properly nested XML attribute values must always be quoted
  • A "Valid" XML document also conforms to a DTD. A "Valid" XML document is a "Well Formed" XML document, which also conforms to the rules of a Document Type Definition (DTD):
  • XML Schema is an XML based alternative to DTD.
David Gelpi Fleta

XML Attributes - 0 views

  • Attributes often provide information that is not a part of the data
  • <gangster name='George "Shotgun" Ziegler'>
  • <gangster name="George 'Shotgun' Ziegler">
  • ...3 more annotations...
  • Use of Elements vs. Attributes Data can be stored in child elements or in attributes.
  • Should you avoid using attributes? Some of the problems with using attributes are: attributes cannot contain multiple values (child elements can) attributes are not easily expandable (for future changes) attributes cannot describe structures (child elements can) attributes are more difficult to manipulate by program code attribute values are not easy to test against a Document Type Definition (DTD) - which is used to define the legal elements of an XML document
  • Try to use elements to describe data. Use attributes only to provide information that is not relevant to the data.
David Gelpi Fleta

XML Elements - 0 views

  • XML documents can be extended to carry more information.
  • Elements are related as parents and children.
  • child elements
  • ...10 more annotations...
  • root element
  • parent element
  • siblings
  • Elements can have different content types.
  • An element can have element content, mixed content, simple content, or empty content. An element can also have attributes.
  • simple content (or text content)
  • XML elements must follow these naming rules: Names can contain letters, numbers, and other characters Names must not start with a number or punctuation character Names must not start with the letters xml (or XML, or Xml, etc) Names cannot contain spaces
  • make names descriptive.
  • Avoid "-" and "." in names
  • ":" should not be used
davidg

XML Syntax - 0 views

  • The syntax rules of XML are very simple and very strict. The rules are very easy to learn, and very easy to use.
  • XML documents use a self-describing
  • the XML declaration
  • ...10 more annotations...
  • All XML Elements Must Have a Closing Tag
  • XML Tags are Case Sensitive
  • XML Elements Must be Properly Nested
  • XML Documents Must Have a Root Element
  • (child elements
  • XML Attribute Values Must be Quoted
  • <note date="12/11/2002">
  • With XML, White Space is Preserved
  • Comments in XML
  • <!-- This is a comment -->
David Gelpi Fleta

XML Usage - 0 views

  • XML can Separate Data from HTML With XML, your data is stored outside your HTML.
  • XML and B2B With XML, financial information can be exchanged over the Internet.
  • XML is Used to Exchange Data With XML, data can be exchanged between incompatible systems. In the real world, computer systems and databases contain data in incompatible formats
  • ...6 more annotations...
  • changes in the underlying data will not require any changes to your HTML.
  • XML Can be Used to Create New Languages
  • With XML, your data is available to more users.
  • Since XML is independent of hardware, software and application, you can make your data available to other than only standard HTML browsers.
  • XML can also be used to store data in files or in databases
  • Since XML data is stored in plain text format, XML provides a software- and hardware-independent way of sharing data.
‹ Previous 21 - 34 of 34
Showing 20 items per page