java - Spring Framework XML configuration metadata, and Namespaces -
i've been studying configuration of metadata information use spring, , realized needed delve bit xml. have doubts referral schemes in xml files. far, know (i guess...), follows:
- i read use of namespaces useful separating markup elements in xml document, avoiding conflicts in markup (source).
- the use of uris naming namespaces seen standard, not meaning file searched in web address, example (source - in "what namespace names point at?").
- the declaration of namespace made use of reserved attribute, "xmlns".
- namespaces use prefixes (also referred alias), use of prefixes not required marking various sub-elements (source - in "beautification").
things start confused when encounter following piece of markup:
<element xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.w3.org/1999/xsl/transform http://www.w3.org/1999/xsl/transform.xsd http://www.w3.org/1999/xhtml http://www.w3.org/1999/xhtml.xsd"> </element> according many sources (including this), referencing xsd schemas made using (seemingly me) namespaces, has been said, not point anything, no files or really.
it said in session 2.6 vocabularies identified , used namespace, giving me understand name "schemalocation" reserved word , used chosen prefix "xsi". know few things pertaining facts presented here:
- what name given "schemalocation", placed after prefix used? named "attribute"? if so, attribute of what?
- the spring recognizes namespaces differently, performing own logic on top of it, or possible namespaces point physical files in address?
- the use of "xsi: schemalocation" can done without declaration of use of namespace prefix "xsi"?
for example:
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:util="http://www.springframework.org/schema/util" xsi:schemalocation="..... http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd"> this snippet taken book "getting started spring framework - second edition", chapter 3, page 112.
- could author left out declaration "xmlns: xsi ..."? if did not omit, code wrong? or not necessary written?
edit
i wish if response given question, includes definition, differences, , applicability of following:
- qnames.
- expanded names.
- global attributes.
thank you.
1) name given "schemalocation", placed after prefix used? named "attribute"? if so, attribute of what? see here
in instance document, attribute xsi:schemalocation provides hints author processor regarding location of schema documents.
the schemalocation attribute value consists of 1 or more pairs of uri references, separated white space. first member of each pair namespace name, , second member of pair hint describing find appropriate schema document namespace. presence of these hints not require processor obtain or use cited schema documents, , processor free use other schemas obtained suitable means, or use no schema @ all.
2) spring recognizes namespaces differently, performing own logic on top of it, or possible namespaces point physical files in address?
spring uses
meta-inf/spring.schemas
- re-maps(*) schemalocation xsd inside library
- (abstract) re-mapped versions supported library
- the properties file called 'spring.schemas' contains mapping of xml schema locations
meta-inf/spring.handlers
- provides namespace handler classes specific namespaces
- the namespace handler class provides parser logic parse spring-batch beans, job, step, etc.
3) use of "xsi: schemalocation" can done without declaration of use of namespace prefix "xsi"?
the prefix mandatory (xml standards)
Comments
Post a Comment