XML Namespaces

  • View
    32

  • Download
    0

Embed Size (px)

DESCRIPTION

Source: XML Bible 2 nd edition Elliotte Rusty Harold ISBN:0-7645-4760-7. The Complete Reference XML,Heather Williamson ISBN:0-07-212734-1 http://www.w3.org/TR/1999/REC-xml-names-19990114/#ns-breakdown. XML Namespaces. by Navin Kumar Vedagiri. XML Namespaces. What is Namespace? - PowerPoint PPT Presentation

Text of XML Namespaces

  • XML Namespaces

    Source: XML Bible 2nd edition Elliotte Rusty Harold ISBN:0-7645-4760-7. The Complete Reference XML,Heather Williamson ISBN:0-07-212734-1 http://www.w3.org/TR/1999/REC-xml-names-19990114/#ns-breakdown

    byNavin Kumar Vedagiri

  • XML NamespacesWhat is Namespace?A namespace defines a new scope. Provide a way to avoid name collisions.

    What is XML Namespace?To give multiple elements of same name within the same document

  • XML NamespaceXML allows users to create own markup language for their own projectsOne such example is MathML (Mathematics Markup Language)MathML is derivative of XMLMathML is used for displaying complex equationsXML documents containing MathML tags in one single document.This is where XML Namespaces comes in

  • Example

    aaaaa

    aaaaa A,B,C are sides of triangle

    If a train

  • Conflicts In NameBase element name in MathML is If any of element name in XML code uses Compiler should know which of the object should be treated to MathML instructions and which should be interpreted as XML markupThis clearly shows Why we wanted Namespace and how scope of the name can be defined.

  • Using Namespaces In C++Declaring Namespace in C++namespace direct { class Arrow { public: Arrow(int dir); void setDirection(int dir); private: int direction; } // ...... other stuff } Using Namespaceusing namespace direct; Direct.Arrow a = new Arrow();

  • Declaring Namespace In XMLSyntax for declaring a namespace

    Namespace applied for MathML

  • Explanation Of Using NamespacePrefix is used to identify that is associated with the element or attributeIn XSL, either element name or attribute name after namespace prefix can be used to identifyNamespace prefix is used with xmlns prefix to identify source of DTD used to identify universal attribute family

  • Example

    Solve the following..

    a+b=c

    Where A,B,C

  • Explanation Of Using Namespace & elements are using namespace declarations refers to ww.catsback.com/MathNamespace for child elements need not be declared separatelyNamespace will be automatically applied to child elements and its attributes

  • URI Uniform Resource IdentifierAbstraction of URLURL locates a resource, URI identifies a resourceURI doesnt have to point at any particular fileURI defines a namespaceGroups and disambiguate element & attribute nameDocument need not exist at the URI specified

  • Qualified NameCombination of prefix and local part nameeg., or Prefix is used as a placeholder for namespace nameIf the document scope extends past the current document then full URL should be usedExample serv:Address Address

  • Qualified AttributeApplies prefix directly to name of the element or attribute within the markupOpening and closing tags must have prefix appliedIf qualifying within an element, apply prefix to name of the attribute

  • Default NamespacesApplied to an element where it is declaredURL is left blank in xmlns: declarationChildren goes to default namespace without explicit declarationDo not apply to attributesProcessed faster than namespace prefixes

  • Example of Default Namespace

    Solve the following..

  • Adding Namespace To DTDsIncorporating Namespace to DTDs is beneficial and problematicSince xmlns:prefix declaration is treated as an attribute, must be defined within the DTDAll the element name must refer to their namespace

  • Adding Namespace To DTDsBook DTD

    Sonnet DTD

    Play DTD

  • .

    ......

  • Namespace ScopingTo the element where it is specified and to all elements within the content of that elementIf overridden by another namespace declaration with the same NSAttName partMultiple Namespace scope CheaperbytheDozen 1568491379

  • Stylesheet - XML Namespace example

  • ConstraintsEntity names, Processing Instruction TargetsOverriding default namespace abcd

  • Namespace scope for an elementExample 1:

    abcd Example 2: abcd

  • Mapping Qualified NamesExample 1: abcd Example 2: abcd

  • Declaring at Root DVS1 Wilhelminenstr. 7 Darmstadt

    OurWebServer 123.45.67.8

  • Validation of XML-NamespaceValidity is a concept defined in XML XML namespaces are layered on top of XMLXML namespaces recommendation does not redefine validityxmlns attributes are treated as attributes, not XML namespace declarations.Qualified names are treated like other names.

  • SummaryNamespaces distinguis between elements and attributesIdentifies, which belong to XML and to other markup Declared by xmlns attributePrefix is attached to element and attributesNo prefix Default namespaceDTDs using namespaces should be designed carefully

    kiolpolkiolpk

Recommended

View more >