Zoque.Forum
»
farklı xml schema dosyalarını birleştirmek
|
| ://www Web tasarımı ve internet ile ilgili olarak karşılaştığınız problemleri ve merak ettiklerinizi burada tartışabilirsiniz. |
![]() |
|
|
LinkBack | Seçenekler |
|
|
#1 (permalink) |
|
Üyelik Tarihi: 07.10.2002
Yer: İstanbul
Yaş: 26
Mesaj: 986
|
farklı xml schema dosyalarını birleştirmek
Merhabalar
elimde 4 adet XML schema var. ve tabi doğal olarak 4 ayrı XML yapısı var. yapmam gereken 4 ayrı schemayı birleştirip tek bir schema haline getirmek. bu şekilde 4 ayrı XML yapısında da aynı kök eleman bulunacak ve bu kök elemandaki bir niteliğe göre,hangi tip döküman olduğu anlaşılacak. mesela: <root type="birinciTür"></root> <root type="ikinciTür"></root> <root type="üçüncüTür"></root> her tip dökümanda farklı tipte ve sırada elementler olacak. bu schemaları nasıl birleştireceğime dair bir ipucu verebilirseniz çok sevinirim |
|
|
|
|
|
#2 (permalink) |
|
Üyelik Tarihi: 22.06.2001
Yer: Antalya
Yaş: 38
Mesaj: 531
|
Re: farklı xml schema dosyalarını birleştirmek
yapmak istediğini tam anladım diyemem
sanırım xslt_multiple_data_sources adresindeki gibi birşeyler yapmak istiyorsun 4 adet XML dosyanı(kısa bir örnekleri) ve işlem sonucunda oluşturmak istediğin XML dosyasınıda yazabilirsen bende biraz uğraşmak isterim. Kolay gelsin. |
|
|
|
|
|
#3 (permalink) |
|
Üyelik Tarihi: 07.10.2002
Yer: İstanbul
Yaş: 26
Mesaj: 986
|
Re: farklı xml schema dosyalarını birleştirmek
yapmak istediğim şeyin xsl ile alakası yok, validation ile ilgili.
şu an 3 tanesini yazıyorum. ama bunlarda anlaşılır sanırım. Kod:
<?XML version="1.0" encoding="iso-8859-9"?> <!-- MAÇ SONUÇLARI --> <nba doc="match" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xsd\match.xsd"> <season>03-04</season> <team type="home"> <!-- ev sahibi takım verileri --> <teamName link="17">Nuggets</teamName> <score>98</score> <players> <player> <!-- normalde bu elementten en az 5 adet tanımlanmalı --> <name link="82">Yusuf Uğur Soysal</name> <point>24</point> <minute>43</minute> <fieldGoal> <made>12</made> <attempted>16</attempted> </fieldGoal> <threePoints> <made>2</made> <attempted>2</attempted> </threePoints> <freeThrow> <made>4</made> <attempted>4</attempted> </freeThrow> <rebound> <offensive>3</offensive> <defensive>6</defensive> </rebound> <assist>3</assist> <steal>3</steal> <block>1</block> <turnOver>0</turnOver> <personalFoul>2</personalFoul> </player> </players> </team> <team type="road"> <!-- diğer takım ile aynı yapıya sahip. bu ise deplasmandaki takım verileri --> </team> </nba> Kod:
<?XML version="1.0" encoding="iso-8859-9"?> <!-- BİR TAKIMIN ÖZELLİKLERİ --> <nba doc="team" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xsd\team.xsd"> <id>9</id> <teamName>Rockets</teamName> <logo src="logos/rockets.jpg"/> <players> <player num="13" link="105">Kelvin Cato</player> <player num="3" link="92">Steve Francis</player> <player num="7" link="22">Adrian Griffin</player> <player num="21" link="100">Jim Jackson</player> <player num="31" link="13">Mark Jackson</player> <player num="5" link="87">Cultino Mobley</player> <player num="9" link="214">Bostjan Nachbar</player> <player num="35" link="187">Scott Padgett</player> <player num="52" link="155">Eric Piatkowski</player> </players> <coaches> <headCoach>Jeff Van Gundy</headCoach> <assistants> <assistant>Steve Clifford</assistant> <assistant>Andy Greer</assistant> <assistant>Patrick Ewing</assistant> <assistant>Tom Thibodeau</assistant> </assistants> <trainers> <trainer>Anthony Falsone</trainer> <trainer>Keith Jones</trainer> </trainers> </coaches> </nba> Kod:
<?XML version="1.0" encoding="iso-8859-9"?> <!-- OYUNCU ÖZELLİKLERİ --> <nba doc="player" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xsd\player.xsd"> <id>82</id> <name>Yusuf Uğur Soysal</name> <dateOfBirth>12/02/82</dateOfBirth> <height>6-9</height> <weight>221</weight> <position>G</position> <playingAt link="17">Nuggets</playingAt> <highScores> <point>44</point> <minute>53</minute> <fieldGoal> <made>14</made> <attempted>24</attempted> </fieldGoal> <threePoints> <made>6</made> <attempted>13</attempted> </threePoints> <freeThrow> <made>18</made> <attempted>22</attempted> </freeThrow> <rebound> <offensive>8</offensive> <defensive>13</defensive> <total>17</total> </rebound> <assist>114</assist> <steal>8</steal> <block>4</block> </highScores> <career> <season year="03-04"> <team link="17">Nuggets</team> <game>49</game> <point>822</point> <minute>1949</minute> <fieldGoal> <made>286</made> <attempted>718</attempted> </fieldGoal> <threePoints> <made>49</made> <attempted>161</attempted> </threePoints> <freeThrow> <made>201</made> <attempted>264</attempted> </freeThrow> <rebound> <offensive>71</offensive> <defensive>194</defensive> </rebound> <assist>288</assist> <steal>68</steal> <block>25</block> <turnOver>178</turnOver> <personalFoul>150</personalFoul> </season> <season year="02-03"> <!-- aynı şekilde --> </season> <season year="01-02"> <!-- aynı şekilde --> </season> </career> </nba> Dikkat ettiyseniz üçü içinde ayrı schema dosyaları tanımlanmış. Fakat önümdeki zorunluluk şu: bu şema dosyalarını birleştirip tek bir schema dosyası oluşturmak. Böylece her dosya için aynı schema dosyasını eklemek yeterli olacak. 3 tip belgede de farklı elementler var. bunların kontrolünü ise root elementteki doc niteliği belirleyecek. neyse, aşağıya da şu anda yazılı olan schema dosyalarını ekliyorum aynı sıra ile.. team.xsd Kod:
<?XML version="1.0" encoding="UTF-8"?> <!-- edited with XMLSPY v2004 rel. 3 U (http://www.xmlspy.com) by Yusuf Soysal (itu) --> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="nba"> <xs:complexType> <xs:sequence> <xs:element name="id" type="xs:nonNegativeInteger"/> <xs:element name="teamName" type="xs:string"/> <xs:element name="logo"> <xs:complexType> <xs:attribute name="src" type="xs:string"/> </xs:complexType> </xs:element> <xs:element ref="players"/> <xs:element ref="coaches"/> </xs:sequence> <xs:attribute name="doc" type="xs:string" use="required" fixed="team"/> </xs:complexType> </xs:element> <xs:element name="players"> <xs:complexType> <xs:sequence> <xs:element name="player" minOccurs="5" maxOccurs="unbounded"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="num" type="xs:nonNegativeInteger"/> <xs:attribute name="link" type="xs:nonNegativeInteger" use="required"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="coaches"> <xs:complexType> <xs:sequence> <xs:element name="headCoach" type="xs:string"/> <xs:element name="assistants"> <xs:complexType> <xs:sequence> <xs:element name="assistant" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="trainers"> <xs:complexType> <xs:sequence> <xs:element name="trainer" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> Kod:
<?XML version="1.0" encoding="UTF-8"?> <!-- edited with XMLSPY v2004 rel. 3 U (http://www.xmlspy.com) by Yusuf Soysal (itu) --> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="nba"> <xs:complexType> <xs:sequence> <xs:element name="id" type="xs:nonNegativeInteger"/> <xs:element name="name" type="xs:string"/> <xs:element ref="dateOfBirth"/> <xs:element name="height" type="xs:string"/> <xs:element name="weight" type="xs:nonNegativeInteger"/> <xs:element name="position" type="xs:string"/> <xs:element name="playingAt"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="link" type="xs:nonNegativeInteger" use="required"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> <xs:element ref="highScores"/> <xs:element ref="career"/> </xs:sequence> <xs:attribute name="doc" type="xs:string" use="required" fixed="player"/> </xs:complexType> </xs:element> <xs:element name="dateOfBirth"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:pattern value="\d{2}/\d{2}/\d{2}"/> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="highScores"> <xs:complexType> <xs:sequence> <xs:element name="point" type="xs:nonNegativeInteger"/> <xs:element name="minute" type="xs:nonNegativeInteger"/> <xs:element ref="fieldGoal"/> <xs:element ref="threePoints"/> <xs:element ref="freeThrow"/> <xs:element name="rebound"> <xs:complexType> <xs:sequence> <xs:element name="offensive" type="xs:nonNegativeInteger"/> <xs:element name="defensive" type="xs:nonNegativeInteger"/> <xs:element name="total" type="xs:nonNegativeInteger"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="assist" type="xs:nonNegativeInteger"/> <xs:element name="steal" type="xs:nonNegativeInteger"/> <xs:element name="block" type="xs:nonNegativeInteger"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="career"> <xs:complexType> <xs:sequence> <xs:element name="season" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="team"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="link" type="xs:nonNegativeInteger" use="required"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> <xs:element name="game" type="xs:nonNegativeInteger"/> <xs:element name="point" type="xs:nonNegativeInteger"/> <xs:element name="minute" type="xs:nonNegativeInteger"/> <xs:element ref="fieldGoal"/> <xs:element ref="threePoints"/> <xs:element ref="freeThrow"/> <xs:element name="rebound"> <xs:complexType> <xs:sequence> <xs:element name="offensive" type="xs:nonNegativeInteger"/> <xs:element name="defensive" type="xs:nonNegativeInteger"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="assist" type="xs:nonNegativeInteger"/> <xs:element name="steal" type="xs:nonNegativeInteger"/> <xs:element name="block" type="xs:nonNegativeInteger"/> <xs:element name="turnOver" type="xs:nonNegativeInteger"/> <xs:element name="personalFoul" type="xs:nonNegativeInteger"/> </xs:sequence> <xs:attribute name="year"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:pattern value="\d{2}-\d{2}"/> </xs:restriction> </xs:simpleType> </xs:attribute> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="fieldGoal"> <xs:complexType> <xs:sequence> <xs:element name="made" type="xs:nonNegativeInteger"/> <xs:element name="attempted" type="xs:nonNegativeInteger"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="freeThrow"> <xs:complexType> <xs:sequence> <xs:element name="made" type="xs:nonNegativeInteger"/> <xs:element name="attempted" type="xs:nonNegativeInteger"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="threePoints"> <xs:complexType> <xs:sequence> <xs:element name="made" type="xs:nonNegativeInteger"/> <xs:element name="attempted" type="xs:nonNegativeInteger"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> Kod:
<?XML version="1.0" encoding="UTF-8"?> <!-- edited with XMLSPY v2004 rel. 3 U (http://www.xmlspy.com) by Yusuf Soysal (itu) --> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="nba"> <xs:complexType> <xs:sequence> <xs:element name="season"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:pattern value="\d{2}-\d{2}"/> </xs:restriction> </xs:simpleType> </xs:element> <xs:element ref="team" minOccurs="2" maxOccurs="2"/> </xs:sequence> <xs:attribute name="doc" type="xs:string" use="required" fixed="match"/> </xs:complexType> </xs:element> <xs:element name="team"> <xs:complexType> <xs:sequence> <xs:element ref="teamName"/> <xs:element name="score" type="xs:nonNegativeInteger"/> <xs:element ref="players"/> </xs:sequence> <xs:attribute name="type" use="required"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="home"/> <xs:enumeration value="road"/> </xs:restriction> </xs:simpleType> </xs:attribute> </xs:complexType> </xs:element> <xs:element name="teamName"> <xs:complexType mixed="true"> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="link" type="xs:nonNegativeInteger" use="required"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> <xs:element name="players"> <xs:complexType> <xs:sequence> <xs:element name="player" minOccurs="5" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element ref="name"/> <xs:element name="point" type="xs:nonNegativeInteger"/> <xs:element name="minute" type="xs:nonNegativeInteger"/> <xs:element ref="fieldGoal"/> <xs:element ref="threePoints"/> <xs:element ref="freeThrow"/> <xs:element ref="rebound"/> <xs:element name="assist" type="xs:nonNegativeInteger"/> <xs:element name="steal" type="xs:nonNegativeInteger"/> <xs:element name="block" type="xs:nonNegativeInteger"/> <xs:element name="turnOver" type="xs:nonNegativeInteger"/> <xs:element name="personalFoul" type="xs:nonNegativeInteger"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="name"> <xs:complexType mixed="true"> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="link" type="xs:nonNegativeInteger" use="required"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> <xs:element name="fieldGoal"> <xs:complexType> <xs:sequence> <xs:element name="made" type="xs:nonNegativeInteger"/> <xs:element name="attempted" type="xs:nonNegativeInteger"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="rebound"> <xs:complexType> <xs:sequence> <xs:element name="offensive" type="xs:nonNegativeInteger"/> <xs:element name="defensive" type="xs:nonNegativeInteger"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="freeThrow"> <xs:complexType> <xs:sequence> <xs:element name="made" type="xs:nonNegativeInteger"/> <xs:element name="attempted" type="xs:nonNegativeInteger"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="threePoints"> <xs:complexType> <xs:sequence> <xs:element name="made" type="xs:nonNegativeInteger"/> <xs:element name="attempted" type="xs:nonNegativeInteger"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> |
|
|
|
|
|
#4 (permalink) |
|
Üyelik Tarihi: 22.06.2001
Yer: Antalya
Yaş: 38
Mesaj: 531
|
Re: farklı xml schema dosyalarını birleştirmek
xsd lerin dtd lerin gelişmişi olduğu dışında pek bir bilgim yok
inculude veya import gibi bir özellikleri var mı eğer varsa işine yarar mı birde şöyle bişi geldi aklıma ne kadar doğru bilemem ![]() XML lerde ilk olarak <nba> satırlarını belirtmeden bu XML leri Xslt deki <xsl: output method="XML" /> ve <xsl:if test=""> yardımı ile <nba> satırını belirleyerek yeni XML ler oluşturulabilinirmi ? |
|
|
|
|
|
#5 (permalink) |
|
Üyelik Tarihi: 07.10.2002
Yer: İstanbul
Yaş: 26
Mesaj: 986
|
Re: farklı xml schema dosyalarını birleştirmek
söylediğini yanlış anlamışta olabilirim, ama anladığım şekilde yanıt vereyim.
normalde XML dosyalarını oluşturabiliyorum. yani oluşturma da bir problemim yok. validate ederken problemim var. yani xsd'leri tek dosyada birleştirme kısmında. bildiği kadarıyla xsd'de if yapısı yok. o olsa işlerim kolaylaşıyor. |
|
|
|
Zoque'a hoşgeldiniz!