Skip to main content

Home/ Groups/ PSI_ESEI
David Gelpi Fleta

XML Schema Part 0: Primer Second Edition - 0 views

  • <xsd:element name="comment" type="xsd:string"/>
  • Global elements, and global attributes, are created by declarations that appear as the children of the schema element. Once declared, a global element or a global attribute can be referenced in one or more declarations using the ref attribute as described above.
  • ref="comment"
    • David Gelpi Fleta
       
      Uso de elementos globales. Ver sección 2.2.2
  • ...151 more annotations...
  • The declaration of a global element also enables the element to appear at the top-level of an instance document
  • , global declarations cannot contain the ref attribute, they must use the type attribute
  • global declarations cannot contain the attributes minOccurs, maxOccurs, or use.
  • If the two things are a type and an element or attribute,
  • What happens if we give two things the same name?
  • Naming Conflicts
  • there is a conflict
  • If the two things are both types
  • the more similar are the two things, the more likely there will be a conflict.
  • there is no conflic
  • If the two things are elements within different types (i.e. not global elements),
  • there is no conflict
  • if the two things are both types and you define one and XML Schema has defined the other, say you define a simple type called decimal, there is no conflict. The reason for the apparent contradiction in the last example is that the two types belong to different namespaces
  • local element
  • <xsd:attributeGroup ref="ItemDelivery"/>
  • we can create a named attribute group containing all the desired attributes of an item element, and reference this group by name in the item element declaration:
  • Attribute Groups
  • <xsd:attributeGroup id="ItemDelivery">
  • A schema can be viewed as a collection (vocabulary) of type definitions and element declarations whose names belong to a particular namespace called a target namespace. Target namespaces enable us to distinguish between definitions and declarations from different vocabularies.
  • When we want to check that an instance document conforms to one or more schemas (through a process called schema validation), we need to identify which element and attribute declarations and type definitions in the schemas should be used to check which elements and attributes in the instance document. The target namespace plays an important role in the identification process
  • <element name="purchaseOrder" type="po:PurchaseOrderType"/> <element name="comment" type="string"/>
  • <apo:purchaseOrder xmlns:apo="http://www.example.com/PO1"
  • <apo:comment>
  • The instance document declares one namespace, http://www.example.com/PO1, and associates it with the prefix apo:. This prefix is used to qualify two elements in the document, namely purchaseOrder and comment. The namespace is the same as the target namespace of the schema in po1.xsd, and so a processor of the instance document will know to look in that schema for the declarations of purchaseOrder and comment. In fact, target namespaces are so named because of the sense in which there exists a target namespace for the elements purchaseOrder and comment. Target namespaces in the schema therefore control the validation of corresponding namespaces in the instance.
  • Elements and attributes can be independently required to be qualified,
  • elementFormDefault="qualified" attributeFormDefault="unqualified"
  • <apo:name>Alice Smith</apo:name> <apo:street>123 Maple Street</apo:street>
  • To specify that all locally declared elements in a schema must be qualified, we set the value of elementFormDefault to qualified:
  • we can replace the explicit qualification of every element with implicit qualification provided by a default namespace
  • xmlns="http://www.example.com/PO1"
  • xml, all the elements in the instance belong to the same namespace, and the namespace statement declares a default namespace that applies to all the elements in the instance. Hence, it is unnecessary to explicitly prefix any of the elements.
  • Attributes that must be qualified, either because they are declared globally or because the attributeFormDefault attribute is set to qualified, appear prefixed in instance documents.
  • he Namespaces in XML specification does not provide a mechanism for defaulting the namespaces of attributes
  • attributeFormDefault="unqualified">
  • form="qualified"
  • the form attribute can be applied to an element declaration in the same manner
  • create schemas in which all elements are global
  • we have omitted the elementFormDefault and attributeFormDefault attributes in this example to emphasize that their values are irrelevant when there are only global element and attribute declarations.
  • <element name="purchaseOrder" type="po:PurchaseOrderType"/> <element name="shipTo" type="po:USAddress"/> <element name="billTo" type="po:USAddress"/> <element name="comment" type="string"/> <element name="name" type="string"/> <element name="street" type="string"/>
  • both schema approaches can validate the same, namespace defaulted, document.
  • n cases where a schema is designed without a target namespace, it is strongly recommended that all XML Schema elements and types are explicitly qualified with a prefix such as xsd: that is associated with the XML Schema namespace
  • without prefixes, then references to XML Schema types may not be distinguishable from references to user-defined types.
  • Element declarations from a schema with no target namespace validate unqualified elements in the instance document. That is, they validate elements for which no namespace qualification is provided by either an explicit prefix or by default (xmlns:).
  • As schemas become larger, it is often desirable to divide their content among several schema documents for purposes such as ease of maintenance, access control, and readability
  • <include schemaLocation="http://www.example.com/schemas/address.xsd"/>
  • <include schemaLocation="http://www.example.com/schemas/address.xsd"/> The effect of this include element is to bring in the definitions and declarations contained in address.xsd,
  • The one important caveat to using include is that the target namespace of the included components must be the same as the target namespace of the including schema
  • Bringing in definitions and declarations using the include mechanism effectively adds these components to the existing target namespace
  • it is possible to include more than one document using multiple include elements, and documents can include documents that themselves include other documents. However, nesting documents in this manner is legal only if all the included parts of the schema are declared with the same target namespace.
  • Instance documents that conform to schema whose definitions span multiple schema documents need only reference the 'topmost' document and the common namespace, and it is the responsibility of the processor to gather together all the definitions specified in the various included documents
  • XML Schema uses the schemaLocation and xsi:schemaLocation attributes in three circumstances.
  • 1. In an instance document, the attribute xsi:schemaLocation provides hints from the author to a processor regarding the location of schema documents. The author warrants that these schema documents are relevant to checking the validity of the document content, on a namespace
  • The schemaLocation attribute value consists of one or more pairs of URI references, separated by white space. The first member of each pair is a namespace name, and the second member of the pair is a hint describing where to find an appropriate schema document for that namespace.
  • A schema is not required to have a namespace
  • and so there is a noNamespaceSchemaLocation attribute which is used to provide hints for the locations of schema documents that do not have target namespaces.
  • 2. In a schema, the include element has a required schemaLocation attribute, and it contains a URI reference which must identify a schema document. The effect is to compose a final effective schema by merging the declarations and definitions of the including and the included schemas.
  • targetNamespace="http://www.example.com/IPO
  • targetNamespace="http://www.example.com/IPO"
  • <element name="shipTo" type="ipo:Address"/> <element name="billTo" type="ipo:Address"/>
    • David Gelpi Fleta
       
      El prefijo "ipo", correspondiente al espacio de nombres que valida este Schema, se aplica al tipo de dato "Address" aunque su definición se encuentre en el fichero Schema incluido.
  • <xsd:element name="item" minOccurs="0" maxOccurs="unbounded"> <xsd:complexType>
  • <xsd:element name="item" minOccurs="0" maxOccurs="unbounded"> <xsd:complexType>
    • David Gelpi Fleta
       
      Elemento con tipo anónimo: no contiene el atributo "type=valor". La definición de tipo no especifica indentificador.
  • <xsd:element name="quantity"> <xsd:simpleType>
    • David Gelpi Fleta
       
      Elemento con tipo anónimo: no contiene el atributo "type=valor". La definición de tipo no especifica indentificador.
  • 2. In a schema, the include element has a required schemaLocation attribute, and it contains a URI reference which must identify a schema document. The effect is to compose a final effective schema by merging the declarations and definitions of the including and the included schemas.
  • The technique we use here to derive new (complex) address types by extending an existing type is the same technique we used in Complex Types from Simple Types (§2.5.1), except that our base type here is a complex type whereas our base type in the previous section was a simple type.
  • we indicate that the content models of the new types are complex, i.e. contain elements, by using the complexContent element, and we indicate that we are extending the base type Address by the value of the base attribute on the extension element.
  • When a complex type is derived by extension, its effective content model is the content model of the base type plus the content model specified in the type derivation. Furthermore, the two content models are treated as two children of a sequential group
  • xsi:type="ipo:UKAddress"
  • to identify exactly which derived type is intended, the derived type must be identified in the instance document. The type is identified using the xsi:type attribute which is part of the XML Schema instance namespace.
  • The import mechanism that we describe in this section is an important mechanism that enables schema components from different target namespaces to be used together, and hence enables the schema validation of instance content defined across multiple namespaces.
    • David Gelpi Fleta
       
      Ver ejemplo "The Report Schema, report.xsd" en la sección 5.
  • only global schema components can be imported:
  • Only named complex types can be imported; local, anonymously defined types cannot
  • When schema components are imported from multiple namespaces, each namespace must be identified with a separate import element. The import elements themselves must appear as the first children of the schema element. Furthermore, each namespace must be associated with a prefix, using a standard namespace declaration, and that prefix is used to qualify references to any schema components belonging to that namespace. Finally, import elements optionally contain a schemaLocation attribute to help locate resources associated with the namespaces
  • the import element has optional namespace and schemaLocation attributes.
  • If present, the schemaLocation attribute is understood in a way which parallels the interpretation of xsi:schemaLocation in (1).
  • To import components that are not in any target namespace, the import element is used without a namespace attribute (and with or without a schemaLocation attribute)
  • <import namespace="http://www.example.com/IPO"/>
    • David Gelpi Fleta
       
      En el ejemplo, el autor/a importa el tipo SKU definido en otro documento schema.
      1. Para importar tipos de datos, identificamos el espacio de nombres en el cual están definidos y asociamos dicho espacio de nombres con un prefijo. En el ejemplo:
      xmlns:xipo="http://www.example.com/IPO"

      2. Usamos el elemento "import" para identificar el espacio de nombres objetivo:
      <import namespace="http://www.example.com/IPO"/&gt;

      Es conveniente incluir el atributo Schemalocation en la etiqueta "import" para indicar la ruta de accedo al fichero Schema que contiene el tipo importado.


      3. En la instancia XML sólo es preciso indicar la localización del Schema que referencia a los demás empleados.
  • xmlns:xipo="http://www.example.com/IPO
  • type="xipo:SKU"
  • List Types
  • XML Schema has the concept of a list type, in addition to the so-called atomic types that constitute most of the types listed in Table 2.
  • The value of an atomic type is indivisible from XML Schema's perspective. For example, the NMTOKEN value US is indivisible in the sense that no part of US, such as the character "S", has any meaning by itself.
  • NMTOKENS is a list type, and an element of this type would be a white-space delimited list of NMTOKEN's, such as "US UK FR"
  • you can create new list types by derivation from existing atomic types
  • &lt;xsd:simpleType name="listOfMyIntType"&gt; &lt;xsd:list itemType="myInteger"/&gt; &lt;/xsd:simpleType&gt;
  • Several facets can be applied to list types: length, minLength, maxLength, pattern, and enumeration
  • &lt;xsd:simpleType name="USStateList"&gt; &lt;xsd:list itemType="USState"/&gt; &lt;/xsd:simpleType&gt; &lt;xsd:simpleType name="SixUSStates"&gt; &lt;xsd:restriction base="USStateList"&gt; &lt;xsd:length value="6"/&gt; &lt;/xsd:restriction&gt; &lt;/xsd:simpleType&gt;
    • David Gelpi Fleta
       
      USState es una enumeración, definida en este documento en la sección 2.3. ASí, precisamos siempre de un tipo de dato definido previamente para construir una lista.
  • Note that it is possible to derive a list type from the atomic type string. However, a string may contain white space, and white space delimits the items in a list type, so you should be careful using list types whose base type is string.
  • The include mechanism enables you to use externally created schema components "as-is", that is, without any modification.
  • &lt;redefine schemaLocation="http://www.example.com/schemas/address.xsd"&gt;
  • &lt;/redefine&gt;
  • &lt;complexType name="Address"&gt;
  • base="ipo:Address"
    • David Gelpi Fleta
       
      El tipo base y el extendido tienen igual identificador.
      Fuera del elemento "redefine" cualquier intento de nombrar a dos tipos de datos usando el mismo identificador producirá un error.
      Notar cómo el elemento "redefine" debe ser el primer hijo del elemento "schema" y encerrar al tipo de dato que redefinimos.
  • The redefine element acts very much like the include element as it includes all the declarations and definitions from the address.xsd file
  • Outside of the redefine element, any such attempt to define a complex type with the same name (and in the same namespace) as the base from which it is being derived would cause an error.
  • Now that Address has been redefined, the extension applies to all schema components that make use of Address
    • David Gelpi Fleta
       
      Cuando un elemento es redefinido, la extensión se aplica a todos los tipos de datos que hacen uso de él como, p.e., sus tipos derivados (ver sección 4.2 y 4.3, así como los ejemplos en Creaweb).
  • Substitution GroupsXML Schema provides a mechanism, called substitution groups, that allows elements to be substituted for other elements. More specifically, elements can be assigned to a special group of elements that are said to be substitutable for a particular named element called the head element. (Note that the head element as well as the substitutable elementsmust be declared as global elements
  • Elements in a substitution group must have the same type as the head element, or they can have a type that has been derived from the head element's type
  • &lt;element name="shipComment" type="string" substitutionGroup="ipo:comment"/&gt;
  • &lt;ipo:shipComment&gt;
    • David Gelpi Fleta
       
      - no todos los elementos del grupo de sustitución han de aparecer en la instancia XML. - los indicadores minOccurs y maxOccurs del elemento cabecera deben ser adecuados al número de elementos de sustitución que permitamos aparecer (pueden aparecer tantos como el valor maxOccurs del elemento cabecera). - si maxOccurs así lo permite, puede aparecer el elemento cabecera y sus sustitutos.
  • substitutionGroup="ipo:comment"/&gt;
  • &lt;ipo:customerComment&gt;
  • The existence of a substitution group does not require any of the elements in that class to be used
  • Abstract Elements and TypesXML Schema provides a mechanism to force substitution for a particular element or type. When an element or type is declared to be "abstract", it cannot be used in an instance document. When an element is declared to be abstract, a member of that element's substitution group must appear in the instance document. When an element's corresponding type definition is declared as abstract, all instances of that element must use xsi:type to indicate a derived type that is not abstract.
  • Declaring an element as abstract requires the use of a substitution group. Declaring a type as abstract simply requires the use of a type derived from it (and identified by the xsi:type attribute) in the instance document
    • David Gelpi Fleta
       
      Ver los ejemplos "abstract_tipo" y "abstract_elemento" en Creaweb.
  • the redefine mechanism we describe here enables you to redefine simple and complex types, groups, and attribute groups that are obtained from external schema files. Like the include mechanism, redefine requires the external components to be in the same target namespace as the redefining schema,
  • xsi:type="Car"
  • abstract="true"
  • extension base
  • abstract="true"
  • extension
  • extension
  • Controlling the Creation &amp; Use of Derived Types
  • schema authors will sometimes want to control derivations of particular types, and the use of derived types in instances.
  • to specify that for a particular complex type, new types may not be derived from it, either (a) by restriction, (b) by extension, or (c) at all.
  • The restriction value of the final attribute prevents derivations by restriction. Preventing derivations at all, or by extension, are indicated by the values #all and extension respectively
  • an optional finalDefault attribute on the schema element whose value can be one of the values allowed for the final attribute. The effect of specifying the finalDefault attribute is equivalent to specifying a final attribute on every type definition and element declaration in the schema.
  • When a simple type is defined, the fixed attribute may be applied to any of its facets to prevent a derivation of that type from modifying the value of the fixed facets.
  • fixed="true"
  • eplacement by derived types can be controlled using the block attribute in a type definition
    • David Gelpi Fleta
       
      Previene la sustitución de un elemento por su tipo derivado, bien sea por extensión o restricción. No confundir este mecanismo con "final", que sólo previene la definición de tipos derivados (por extensión o restricción) de un tipo determinado.
  • final="restriction"
  • final="restriction"
  • final="restriction"
  • block="restriction"
  • Preventing replacement by derivations at all, or by derivations-by-extension, are indicated by the values #all and extension respectively. As with final, there exists an optional blockDefault attribute on the schema element whose value can be one of the values allowed for the block attribute.
  • a mechanism that controls which derivations and substitution groups may be used in instance documents
  • substitutionGroup=
  • global declarations cannot contain the attributes > minOccurs > , > maxOccurs > , or > use > . >
  • The schemaLocation attribute value consists of one or more pairs of URI references, separated by white space. The first member of each pair is a namespace name, and the second member of the pair is a hint describing where to find an appropriate schema document for that namespace
  • there is a noNamespaceSchemaLocation attribute which is used to provide hints for the locations of schema documents that do not have target namespaces.
  • the include element has a required schemaLocation attribute, and it contains a URI reference which must identify a schema document.
  • the import element has optional namespace and schemaLocation attributes. If present, the schemaLocation attribute is understood in a way which parallels the interpretation of xsi:schemaLocation
  • The default value for both the minOccurs and the maxOccurs attributes is 1.
  • Be sure that if you specify a value for only the minOccurs attribute, it is less than or equal to the default value of maxOccurs,
  • Attributes may appear once or not at all, but no other number of times
  • mechanism that enables schema components from different target namespaces to be used together, and hence enables the schema validation of instance content defined across multiple namespaces.
  • Importing Types
  • only global schema components can be imported:
  • Only named complex types can be imported; local, anonymously defined types cannot.
  • each namespace must be identified with a separate import element.
  • The import elements themselves must appear as the first children of the schema element
  • each namespace must be associated with a prefix, using a standard namespace declaration
  • import elements optionally contain a schemaLocation attribute to help locate resources associated with the namespaces.
  • ref="xipo:
  • Deriving Types by Extension
  • we indicate that the content models of the new types are complex, i.e. contain elements, by using the complexContent element, and we indicate that we are extending the base type Address by the value of the base attribute on the extension element.
  • xsi:type="ipo:UKAddress"&gt;
  • xsi:type="ipo:USAddress"&gt;
  • Deriving Complex Types by Restriction
  • the values represented by the new type are a subset of the values represented by the base type (as is the case with restriction of simple types).
  • &lt;complexContent&gt; &lt;restriction base=
  • Table 3 shows several examples of how element and attribute declarations within type definitions may be restricted
David Gelpi Fleta

XPath Syntax - 0 views

  • Selecting Nodes XPath uses path expressions to select nodes in an XML document.
  • Expression Description nodename Selects all child nodes of the named node / Selects from the root node // Selects nodes in the document from the current node that match the selection no matter where they are . Selects the current node .. Selects the parent of the current node @ Selects attributes
  • Selecting Several Paths By using the | operator in an XPath expression you can select several paths.
  • ...10 more annotations...
  • Wildcard Description * Matches any element node @* Matches any attribute node node() Matches any node of any kind
  • Predicates Predicates are used to find a specific node or a node that contains a specific value.
  • Predicates are always embedded in square brackets.
  • [last()]
  • [position()&lt;3]
  • title[@lang]
  • [@lang]
  • [@lang='eng']
  • [price&gt;35.00]
  • [1]
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

Enunciado práctica - 41 views

English version of the practice available in section "Apuntes de prácticas" in Creaweb: http://creaweb.ei.uvigo.es/creaweb/jsp/crearAsignatura.jsp?codigo=110421 dgelpi wrote: > Estimad@s tod@s,...

practica

David Gelpi Fleta

XSL - 24 views

Hemos marcado a través de la herramienta Diigo lo estrictamente necesario para añadir una capa de presentación a los datos etiquetados mediante XML. Encontraréis los apuntes en los "bookmarks" del ...

practica

started by David Gelpi Fleta on 27 Nov 07 no follow-up yet
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

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 <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

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:apply-templates> Element - 0 views

  • The &lt;xsl:apply-templates&gt; element applies a template to the current element or to the current element's child nodes.
  • If we add a select attribute to the &lt;xsl:apply-templates&gt; element it will process only the child element that matches the value of the attribute
David Gelpi Fleta

XSLT <xsl:for-each> Element - 0 views

  • The &lt;xsl:for-each&gt; Element The XSL &lt;xsl:for-each&gt; element can be used to select every XML element of a specified node-set:
  • &lt;xsl:for-each select="catalog/cd"&gt;
  • We can also filter the output from the XML file by adding a criterion to the select attribute in the &lt;xsl:for-each&gt; element.
  • ...1 more annotation...
  • Legal filter operators are: =&nbsp; (equal) != (not equal) &amp;lt; less than &amp;gt; greater than
David Gelpi Fleta

XSL Languages - 0 views

  • XSL stands for EXtensible Stylesheet Language.
  • XSL describes how the XML document should be displayed!
  • XSL consists of three parts: XSLT - a language for transforming XML documents XPath - a language for navigating in XML documents XSL-FO - a language for formatting XML documents
David Gelpi Fleta

XSLT <xsl:template> Element - 0 views

  • An XSL style sheet consists of one or more set of rules that are called templates. Each template contains rules to apply when a specified node is matched.
  • &lt;xsl:template&gt; element is used to build templates. The match attribute is used to associate a template with an XML element. The match attribute can also be used to define a template for the entire XML document. The value of the match attribute is an XPath expression (i.e. match="/" defines the whole document).
  • &lt;xsl:template match="/"&gt; &lt;html&gt;
  • ...3 more annotations...
  • Since an XSL style sheet is an XML document itself, it always begins with the XML declaration: &lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
  • &lt;xsl:stylesheet&gt;, defines that this document is an XSLT style sheet document
  • The content inside the &lt;xsl:template&gt; element defines some HTML to write to the output.
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

Código ejemplos laboratorio. - 22 views

Están disponibles (por el momento) - ejercicio base sobre trabajo con espacio de nombres - ejercicio con recurso Include - ejercicio con recurso Import - ejercicio con Tipos Derivados - ejercicio ...

ejercicios

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

XML Schema Part 2: Datatypes Second Edition - 0 views

  • The ·value space· of NMTOKEN is the set of tokens that ·match· the Nmtoken production
  • token represents tokenized strings. The ·value space· of token is the set of strings that do not contain the carriage return (#xD), line feed (#xA) nor tab (#x9) characters, that have no leading or trailing spaces (#x20) and that have no internal sequences of two or more spaces.
  • NMTOKEN has the following ·constraining facets·: lengthminLengthmaxLengthpatternenumerationwhiteSpace
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;
hocevik hocevik

XML schema Element - 0 views

  • The &lt;schema&gt; element is the root element of every XML Schema:
  • The &lt;schema&gt; element may contain some attributes. A schema declaration
  • &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3schools.com" xmlns="http://www.w3schools.com" elementFormDefault="qualified"&gt;
  • ...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

XML Schema Indicators - 0 views

  • Order indicators: All Choice Sequence Occurrence indicators: maxOccurs minOccurs Group indicators: Group name attributeGroup name
  • &lt;all&gt; indicator specifies that the child elements can appear in any order, and that each child element must occur only once
  • When using the &lt;all&gt; indicator you can set the &lt;minOccurs&gt; indicator to 0 or 1 and the &lt;maxOccurs&gt; indicator can only be set to 1
    • David Gelpi Fleta
       
      The all group is limited to the top-level of any content model. Es ilegal!! : ...... ....
  • ...14 more annotations...
  • &lt;choice&gt; indicator specifies that either one child element or another can occur
  • Occurrence indicators are used to define how often an element can occur.
  • The &lt;sequence&gt; indicator specifies that the child elements must appear in a specific order:
  • The &lt;maxOccurs&gt; indicator specifies the maximum number of times an element can occur:
  • For all "Order" and "Group" indicators (any, all, choice, sequence, group name, and group reference) the default value for maxOccurs and minOccurs is 1.
  • The &lt;minOccurs&gt; indicator specifies the minimum number of times an element can occur:
  • To allow an element to appear an unlimited number of times, use the maxOccurs="unbounded" statement:
    • David Gelpi Fleta
       
      Ver algunos ejemplos sobre indicadores de ocurrencia: http://www.w3.org/TR/xmlschema-0/#cardinalityTable
  • Group indicators are used to define related sets of elements.
  • &lt;xs:group name="groupname"&gt;
  • After you have defined a group, you can reference it in another definition
  • &lt;xs:group name="persongroup"&gt;
  • &lt;xs:group ref="persongroup"/&gt;
  • &lt;xs:attributeGroup name="groupname"&gt;
  • &lt;xs:attributeGroup ref="personattrgroup"/&gt;
1 - 20 of 43 Next › Last »
Showing 20 items per page