Internet Technologies1 Xml Namespaces. Internet Technologies2 Notes on XML Namespaces Namespace notes taken and adapted from “XML in a Nutshellâ€‌ By Harold

  • View
    218

  • Download
    3

Embed Size (px)

Text of Internet Technologies1 Xml Namespaces. Internet Technologies2 Notes on XML Namespaces Namespace...

  • Slide 1
  • Internet Technologies1 Xml Namespaces
  • Slide 2
  • Internet Technologies2 Notes on XML Namespaces Namespace notes taken and adapted from XML in a Nutshell By Harold and Means Java examples adapted from XML and Java Namespace specification is at: http://www.w3.org/TR/REC-xml-names/
  • Slide 3
  • Internet Technologies3 Namespaces Primary purpose: To disambiguate element and attribute names. Implementation: Attach a prefix to an element or attribute name. Map the prefix to a URI. This need not be a real place. Default URIs may also be provided for those elements with no prefix. The URIs partition the elements and attributes into disjoint sets.
  • Slide 4
  • Internet Technologies4 Namespaces Each prefix is associated with one URI. Names with prefixes associated with the same URI are in the same namespace. Elements and attributes in namespaces have names with exactly one colon. The text before the colon is called the prefix. The text after the colon is called the local part. The complete name, including the colon, is called the qualified name.
  • Slide 5
  • Internet Technologies5 Namespaces Prefixes are bound to namespace URIs by attaching an xmlns:prefix attribute to the the prefixed element or one of its ancestors For example: http://www.w3.org/TR/REC-rdf-syntax# associates the prefix rdf with the namespace URI shown. The name RDF is therefore an element from this namespace.
  • Slide 6
  • Internet Technologies6 Namespaces Bindings have scope within the element in which theyre declared and its contents. http://www.w3.org/TR/REC-rdf-syntax#
  • Slide 7
  • Internet Technologies7 Namespaces The default namespace Is set using the xmlns attribute (with no prefix) Applies only to elements not attributes SomeTag and insideTag are both in the someURI namespace.
  • Slide 8
  • Internet Technologies8 Namespaces If there is no default namespace is declared then tags without Prefixes are in no namespace at all. Not even the default one. The only way an attribute belongs to a namespace is if it has a declared prefix. http://www.w3.org/TR/REC-rdf-syntax# : The about attribute is in no namespace.
  • Slide 9
  • Internet Technologies9 Declaring Namespaces xmlns:pre=someURN is fine xmlns:pre= is illegal xmlns=someURN is fine xmlns= legal and same as no namespace
  • Slide 10

Recommended

View more >