Table of Contents

Search

  1. Preface
  2. XML Concepts
  3. Using XML with PowerCenter
  4. Working with XML Sources
  5. Using the XML Editor
  6. Working with XML Targets
  7. XML Source Qualifier Transformation
  8. Midstream XML Transformations
  9. XML Datatype Reference
  10. XPath Query Functions Reference

XML Guide

XML Guide

Namespace

Namespace

A namespace contains a URI to identify schema location. A URI is a string of characters that identifies an internet resource. A URI is an abstraction of a URL. A URL locates a resource, but a URI identifies a resource. A DTD or schema file does not have to exist at the URI location.
An XML namespace identifies groups of elements. A namespace can identify elements and attributes from different XML files or distinguish meanings between elements. For example, you can distinguish meanings for the element “table” by declaring different namespaces, such as
math:table
and
furniture:table
. XML is case sensitive. The namespace
Math:table
is different from the namespace
math:table
.
You can declare a namespace at the root level of an XML file, or you can declare a namespace inside any element in an XML structure. When you declare multiple namespaces in the same XML file, you use a namespace prefix to associate an element with a namespace. A namespace declaration appears in the XML file as an attribute that starts with xmlns. Declare the namespace prefix with the xmlns attribute. You can create a prefix name of any length.
The following example shows two namespaces in an XML instance document:
<example>   
xmlns:math
= “http://www.mathtables.com”   
xmlns:furniture
= “http://www.home.com”>   <math:table>4X6</math:table>   <furniture:table>Brueners </furniture:table> </example>
One namespace has math elements, and the other namespace has furniture elements. Each namespace has an element called “table,” but the elements contain different types of data. The namespace prefix distinguishes between the math table and the furniture table.
The following text shows a common schema declaration:
<?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"    targetNamespace="http://www.w3XML.com"    xmlns="http://www.w3XML.com"    elementFormDefault="qualified">... ...</xs:schema>
The following table describes each part of the namespace declaration:
Schema Declaration
Description
xmlns:xs="http://www.w3.org/2001/XMLSchema"
Namespace that contains the native XML schema and datatypes. In this example, each schema component has the prefix of “xs.”
targetNamespace="http://www.w3XML.com"
Namespace that contains the schema.
xmlns="http://www.w3XML.com"
Default namespace declaration. All elements in the schema that have no prefix belong to the default namespace. Declare a default namespace by using an xmlns attribute with no prefix.
elementFormDefault="qualified"
Specifies that any element in the schema must have a namespace in the XML file.

0 COMMENTS

We’d like to hear from you!