Skip to main content

Home/ Groups/ PSI_ESEI
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 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.
hocevik hocevik

XML schema Element - 0 views

  • The <schema> element is the root element of every XML Schema:
  • The <schema> element may contain some attributes. A schema declaration
  • <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3schools.com" xmlns="http://www.w3schools.com" elementFormDefault="qualified">
  • ...7 more annotations...
  • targetNamespace="http://www.w3schools.com" indicates that the elements defined by this schema (note, to, from, heading, body.) come from the "http://www.w3schools.com" namespace.
  • xmlns:xs="http://www.w3.org/2001/XMLSchema" indicates that the elements and data types used in the schema come from the "http://www.w3.org/2001/XMLSchema" namespace.
  • This attribute has two values. The first value is the namespace to use. The second value is the location of the XML schema to use for that namespace
  • xmlns="http://www.w3schools.com" indicates that the default namespace is "http://www.w3schools.com".
  • Referencing a Schema in an XML Document
  • xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3schools.com note.xsd"
  • prefixed with xs:
David Gelpi Fleta

XSLT <xsl:if> Element - 0 views

  • &lt;xsl:if test="expression"&gt; ... ...some output if the expression is true... ... &lt;/xsl:if&gt;
  • add the &lt;xsl:if&gt; element inside the &lt;xsl:for-each&gt; element
  • &lt;xsl:for-each select="catalog/cd"&gt; &lt;xsl:if test="price &amp;gt; 10"&gt;
David Gelpi Fleta

XSLT Transformation - 0 views

  • &lt;?xml-stylesheet type="text/xsl" href="http://www.w3schools.com/cdcatalog.xsl"?&gt;
  • &lt;?xml-stylesheet type="text/xsl" href="http://www.w3schools.com/cdcatalog.xsl"?&gt;
  • Example study: How to transform XML into XHTML using XSLT.
  • ...6 more annotations...
  • orrect Style Sheet Declaration The root element that declares the document to be an XSL style sheet is &lt;xsl:stylesheet&gt; or &lt;xsl:transform&gt;.
  • &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
  • &lt;xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
  • Link the XSL Style Sheet to the XML Document Add the XSL style sheet reference to your XML document
  • &lt;?xml-stylesheet type="text/xsl" href="http://www.w3schools.com/cdcatalog.xsl"?&gt;
  • xmlns:xsl="http://www.w3.org/1999/XSL/Transform" points to the official W3C XSLT namespace.
David Gelpi Fleta

XML Schema Simple Elements - 0 views

  • What is a Simple Element? A simple element is an XML element that can contain only text. It cannot contain any other elements or attributes. However, the "only text" restriction is quite misleading. The text can be of many different types. It can be one of the types included in the XML Schema definition (boolean, string, date, etc.), or it can be a custom type that you can define yourself.
  • xs:string xs:decimal xs:integer xs:boolean xs:date xs:time
    • David Gelpi Fleta
       
      Más tipos de datos predefinidos en: http://www.w3.org/TR/xmlschema-0/#simpleTypesTable
  • you can require the data to match a specific pattern.
  • ...7 more annotations...
  • The syntax for defining a simple element is: &lt;xs:element name="xxx" type="yyy"/&gt;
  • built-in data types
  • You can also add restrictions (facets) to a data type
  • A default value is automatically assigned to the element when no other value is specified.
  • default="red"/
  • A fixed value is also automatically assigned to the element, and you cannot specify another value.
  • fixed="red"/
David Gelpi Fleta

XML Schema Attributes - 0 views

  • Simple elements cannot have attributes. If an element has attributes, it is considered to be of a complex type. But the attribute itself is always declared as a simple type.
  • &lt;xs:attribute name="xxx" type="yyy"/&gt;
    • hocevik hocevik
       
      Simple Element tanımı aşağıdaki gibi :
    • hocevik hocevik
       
      Simple element tanımı :
      <xs:element name="lastname" type="xs:string"/>
  • Attributes may have a default value OR a fixed value specified
  • ...1 more annotation...
  • Attributes are optional by default. To specify that the attribute is required, use the "use" attribute: &lt;xs:attribute name="lang" type="xs:string" use="required"/&gt;
David Gelpi Fleta

XML Schema Restrictions/Facets - 0 views

  • Restrictions are used to define acceptable values for XML elements or attributes. Restrictions on XML elements are called facets.
  • Restrictions on Values
  • &lt;xs:restriction base="xs:integer"&gt; &lt;xs:minInclusive value="0"/&gt; &lt;xs:maxInclusive value="120"/&gt; &lt;/xs:restriction&gt;
  • ...15 more annotations...
  • Restrictions on a Set of Values To limit the content of an XML element to a set of acceptable values, we would use the enumeration constraint.
  • &lt;xs:restriction base="xs:string"&gt; &lt;xs:enumeration value="Audi"/&gt; &lt;xs:enumeration value="Golf"/&gt; &lt;xs:enumeration value="BMW"/&gt; &lt;/xs:restriction&gt;
  • type="carType"/&gt;
  • &lt;xs:simpleType name="carType"&gt;
  • the type "carType" can be used by other elements
  • series of numbers or letters that can be used, we would use the pattern constraint.
  • &lt;xs:minLength value="5"/&gt; &lt;xs:maxLength value="8"/&gt;
  • &lt;xs:pattern value="male|female"/&gt;
  • The whiteSpace constraint is set to "preserve", which means that the XML processor WILL NOT remove any white space characters:
  • &lt;xs:whiteSpace value="preserve"/&gt;
  • The whiteSpace constraint is set to "replace", which means that the XML processor WILL REPLACE all white space characters (line feeds, tabs, spaces, and carriage returns) with spaces:
  • &lt;xs:whiteSpace value="replace"/&gt;
  • &lt;xs:length value="8"/&gt;
  • &lt;xs:restriction base="xs:string"&gt; &lt;xs:pattern value="[a-z]"/&gt;
  • Constraint Description enumeration Defines a list of acceptable values fractionDigits Specifies the maximum number of decimal places allowed. Must be equal to or greater than zero length Specifies the exact number of characters or list items allowed. Must be equal to or greater than zero maxExclusive Specifies the upper bounds for numeric values (the value must be less than this value) maxInclusive Specifies the upper bounds for numeric values (the value must be less than or equal to this value) maxLength Specifies the maximum number of characters or list items allowed. Must be equal to or greater than zero minExclusive Specifies the lower bounds for numeric values (the value must be greater than this value) minInclusive Specifies the lower bounds for numeric values (the value must be greater than or equal to this value) minLength Specifies the minimum number of characters or list items allowed. Must be equal to or greater than zero pattern Defines the exact sequence of characters that are acceptable totalDigits Specifies the exact number of digits allowed. Must be greater than zero whiteSpace Specifies how white space (line feeds, tabs, spaces, and carriage returns) is handled
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!
  • &lt;xs:element name="employee"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt;
  • type="personinfo"/&gt; &lt;xs:complexType name="personinfo"&gt;
  • ...1 more annotation...
  • &lt;xs:complexType name="fullpersoninfo"&gt; &lt;xs:complexContent&gt; &lt;xs:extension base="personinfo"&gt;
David Gelpi Fleta

XML Schema Complex Type - Empty Elements - 0 views

  • &lt;xs:element name="product"&gt; &lt;xs:complexType&gt; &lt;xs:attribute name="prodid" type="xs:positiveInteger"/&gt;
David Gelpi Fleta

XML Schema Complex Type - Text Elements - 0 views

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

XML Schema Complex Types - Mixed Content - 0 views

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

Extensible Markup Language (XML) 1.0 (Second Edition) - 0 views

  • A Name is a token beginning with a letter or one of a few punctuation characters, and continuing with letters, digits, hyphens, underscores, colons, or full stops, together known as name characters.] Names beginning with the string " xml", or any string which would match (('X'|'x') ('M'|'m') ('L'|'l')) , are reserved for standardization in this or future versions of this specification.
  • An Nmtoken (name token) is any mixture of name characters.
  • NameChar&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp; Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender
  • ...1 more annotation...
  • Nmtoken&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp; (NameChar)+
David Gelpi Fleta

XSLT <xsl:value-of> Element - 0 views

  • The &lt;xsl:value-of&gt; element is used to extract the value of a selected node.
  • &lt;xsl:value-of select="catalog/cd/title"/&gt;
  • he value of the select attribute is an XPath expression. An XPath expression works like navigating a file system; where a forward slash (/) selects subdirectories.
David Gelpi Fleta

XSLT <xsl:sort> Element - 0 views

  • To sort the output, simply add an &lt;xsl:sort&gt; element inside the &lt;xsl:for-each&gt; element in the XSL file:
  • &lt;xsl:for-each select="catalog/cd"&gt; &lt;xsl:sort select="artist"/&gt;
David Gelpi Fleta

XSLT <xsl:choose> Element - 0 views

  • The &lt;xsl:choose&gt; element is used in conjunction with &lt;xsl:when&gt; and &lt;xsl:otherwise&gt; to express multiple conditional tests.
  • &lt;xsl:choose&gt; &lt;xsl:when test="expression"&gt; ... some output ... &lt;/xsl:when&gt; &lt;xsl:otherwise&gt; ... some output .... &lt;/xsl:otherwise&gt; &lt;/xsl:choose&gt;
David Gelpi Fleta

Introduction to XSLT - 0 views

  • What is XSLT? XSLT stands for XSL Transformations XSLT is the most important part of XSL XSLT transforms an XML document into another XML document XSLT uses XPath to navigate in XML documents XSLT is a W3C Recommendation
  • XSLT is used to transform an XML document into another XML document, or another type of document that is recognized by a browser, like HTML and XHTML. Normally XSLT does this by transforming each XML element into an (X)HTML element.
  • A common way to describe the transformation process is to say that XSLT transforms an XML source-tree into an XML result-tree.
  • ...2 more annotations...
  • XSLT Uses XPath XSLT uses XPath to find information in an XML document. XPath is used to navigate through elements and attributes in XML documents.
  • How Does it Work? In the transformation process, XSLT uses XPath to define parts of the source document that should match one or more predefined templates. When a match is found, XSLT will transform the matching part of the source document into the result document.
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

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.
David Gelpi Fleta

XML Data Islands - 0 views

  • An XML data island is XML data embedded into an HTML page.
  • &lt;html&gt; &lt;body&gt; &lt;xml id="note" src="http://www.w3schools.com/note.xml"&gt;&lt;/xml&gt;
1 - 20 Next ›
Showing 20 items per page