11 Mayıs 2016 Çarşamba

XML ve Namespace

Giriş
Tipik bir XML dokümanı şuna benzer.
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
       http://www.springframework.org/schema/aop
       http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
xmlns nedir
Açıklaması şöyle
XML namespaces provide a simple method for qualifying element and attribute names used in Extensible Markup Language documents by associating them with namespaces identified by URI references.
Aynen kodda olduğu gibi isim alanlarını kullanabilmemizi sağlar. xmlns ilk düğüme yazılır. İlk düğüm dışında başka bir yere yazılması doğru değildir.

xsi
Şöyle yazılır. XML'in devam eden satırlarında nil yapılabilir.
<Instrument_Root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Instrument_ID>123</Instrument_ID>
  <Deal_number xsi:nil="true"/>
</Instrument_Root>
xsi:schemaLocation
Açıklaması şöyle. XML'i doğrulamak için bu adreste belirtilen xsd belgeleri kullanılır.
can be used in a document to provide hints as to the physical location of schema documents which may be used for assessment.





Hiç yorum yok:

Yorum Gönder