xsd - Some questions about name spaces on xml? -


  1. is namespace tag, says schema-validator element behaves "so" , behave "same" long tagged namespace?

  2. what default namespaces?

  3. in case belove,

    <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema" targetnamespace="http://www.w3schools.com" xmlns="http://www.w3schools.com" elementformdefault="qualified">

does xmlns:xs mean http://www.w3.org/2001/xmlschema namespace presented xs , elements, not tagged xs, coming namespace http://www.w3schools.com?

is namespace tag, says schema-validator element behaves "so" , behave "same" long tagged namespace?

no, xml namespace not tag @ all. namespace in programming language: largely abstract context within names exist , unique. inasmuch given name may exist , have different meanings in different namespaces, correct interpretation of unqualified name depends on knowing or guessing correct namespace (including if has no namespace).

xml namespaces identified characteristic uris, it's best think of concrete handles, not namespaces themselves. akin distinction between name , you, yourself. distinct namespace uris identify distinct namespaces.

there tons of analogies, both in , out of technical arenas. example, in united states, 1 can pretty rely on no 2 cities in same state having same name, different cities in different states can , have same name. states serve, in small part, namespaces city names. thus, if ask go springfield, may able guess whether mean 1 in missouri, 1 in illinois, 1 in massachusetts, or 1 of others, unless somehow tell one, can't sure.

what default namespaces?

it's tedious , bit ugly express xml elements qualified names. xml document can instead declare default namespace, in case unqualified element names interpreted relative namespace, instead of being interpreted having no namespace. (attribute names not directly impacted default namespace.)

it's if part of small, illinois-based company, such default, interpreted city names illinois city names. then if asked go springfield without saying one, justified in interpreting me mean springfield, illinois. if wanted go springfield, missouri instead obligated specifically.

does xmlns:xs mean [...]?

all above theoretical. you're asking how theoretical concepts expressed in xml.

xml uses namespace prefixes associate local names namespaces. result qualified name of form prefix:local. example, start tag presented in question element qualified name xs:schema; element has local name "schema" , namespace prefix "xs". it's bit u.s. post office assigning "mo" abbreviation of "missouri", can address mail "springfield, mo" , know mean.

of course, begs question of how namespace prefixes associated specific namespaces.

first, there 2 pre-defined namespace prefixes, "xml" , "xmlns", bound namespaces identified http://www.w3.org/xml/1998/namespace , http://www.w3.org/2000/xmlns/, respectively. other prefixes must not bound namespaces, namespaces may not assigned default namespace, , bindings must not removed, therefore xml processors can recognize names in namespaces prefixes alone, without performing other namespace processing.

second, attribute names namespace prefix "xmlns" defined describe association between namespace prefixes , namespaces element on appear , descendants (subject override within descendants). local part of such attribute name namespace prefix being bound, , value of attribute namespace uri namespace associated prefix.

xml provides default namespaces. attribute name xmlns defined declare default namespace element on appears , descendants (subject override within descendants). value of attribute namespace uri of default namespace. such default namespace declaration in scope, unqualified element names interpreted belonging default namespace.

thus, taking example start tag:

<xs:schema 

the element has local name "schema" , associated yet-to-be-specified namespace bound prefix "xs".

xmlns:xs="http://www.w3.org/2001/xmlschema" 

the namespace prefix "xs" bound namespace identified uri http://www.w3.org/2001/xmlschema in element , descendants, including in element's own name.

targetnamespace="http://www.w3schools.com" 

the attribute targetnamespace of element declared have value "http://www.w3schools.com". significance of specific element type (in case declares namespace uri of elements , attributes defined schema represented element).

xmlns="http://www.w3schools.com" 

the default namespace element , descendants 1 identified uri http://www.w3schools.com.

elementformdefault="qualified" 

another attribute specific element type.

> 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -