الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

استفسار حول مشروع xml ?

بدأه ameer09 في 7 يونيو 2010 · 4 رد · 3,457 مشاهدة · في XML و تطبيقاتها
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم

[

b]عايز اعمل مشروع بسيطة على xml عبارة عن مدرسة عادية

الحين انا متحير اي الملفات المطلوبة بالضبط عشان يعرض لي صفحة نت في ملف xml معرفه انا

هل المطلوب بالضبط

اولا ملف example .xml

ثانيا ملف لتعريف اللغة نفسها example .dtd

ثالثا ملف اخر example .schema

وملف رابع css لعرض محتويات الملف الاصلي example .xml على ويب براوسر

ياريت اي حدا له خبرة في كيفية العمل يفيدنا لانو انا مش عارف ابدا كويس باللضبط

ومشكورين جدااا

#2

إن كنت قد فهمتك بشكل صحيح، فإن ما ستحتاجه هو ملف XML وملف XSLT وملف CSS إن استدعت الضرورة.

XSLT هي اختصار XSL Transformations

XSL هي اختصار EXtensible Stylesheet Language

XSLT هو الملف الذي سيعالج محتويات ملف XML ويعرضه للمستخدم كصفحة ويب كما هو الحال مع HTML.

لننظر مثال، ليكن لدينا ملف catalog.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<catalog>
	<cd>
		<title>Empire Burlesque</title>
		<artist>Bob Dylan</artist>
		<country>USA</country>
		<company>Columbia</company>
		<price>10.90</price>
		<year>1985</year>
	</cd>
	<cd>
		<title>Hide your heart</title>
		<artist>Bonnie Tyler</artist>
		<country>UK</country>
		<company>CBS Records</company>
		<price>9.90</price>
		<year>1988</year>
	</cd>
	<cd>
		<title>Greatest Hits</title>
		<artist>Dolly Parton</artist>
		<country>USA</country>
		<company>RCA</company>
		<price>9.90</price>
		<year>1982</year>
	</cd>
	<cd>
		<title>Still got the blues</title>
		<artist>Gary Moore</artist>
		<country>UK</country>
		<company>Virgin records</company>
		<price>10.20</price>
		<year>1990</year>
	</cd>
	<cd>
		<title>Eros</title>
		<artist>Eros Ramazzotti</artist>
		<country>EU</country>
		<company>BMG</company>
		<price>9.90</price>
		<year>1997</year>
	</cd>
	<cd>
		<title>One night only</title>
		<artist>Bee Gees</artist>
		<country>UK</country>
		<company>Polydor</company>
		<price>10.90</price>
		<year>1998</year>
	</cd>
	<cd>
		<title>Sylvias Mother</title>
		<artist>Dr.Hook</artist>
		<country>UK</country>
		<company>CBS</company>
		<price>8.10</price>
		<year>1973</year>
	</cd>
	<cd>
		<title>Maggie May</title>
		<artist>Rod Stewart</artist>
		<country>UK</country>
		<company>Pickwick</company>
		<price>8.50</price>
		<year>1990</year>
	</cd>
	<cd>
		<title>Romanza</title>
		<artist>Andrea Bocelli</artist>
		<country>EU</country>
		<company>Polydor</company>
		<price>10.80</price>
		<year>1996</year>
	</cd>
	<cd>
		<title>When a man loves a woman</title>
		<artist>Percy Sledge</artist>
		<country>USA</country>
		<company>Atlantic</company>
		<price>8.70</price>
		<year>1987</year>
	</cd>
	<cd>
		<title>Black angel</title>
		<artist>Savage Rose</artist>
		<country>EU</country>
		<company>Mega</company>
		<price>10.90</price>
		<year>1995</year>
	</cd>
	<cd>
		<title>1999 Grammy Nominees</title>
		<artist>Many</artist>
		<country>USA</country>
		<company>Grammy</company>
		<price>10.20</price>
		<year>1999</year>
	</cd>
	<cd>
		<title>For the good times</title>
		<artist>Kenny Rogers</artist>
		<country>UK</country>
		<company>Mucik Master</company>
		<price>8.70</price>
		<year>1995</year>
	</cd>
	<cd>
		<title>Big Willie style</title>
		<artist>Will Smith</artist>
		<country>USA</country>
		<company>Columbia</company>
		<price>9.90</price>
		<year>1997</year>
	</cd>
	<cd>
		<title>Tupelo Honey</title>
		<artist>Van Morrison</artist>
		<country>UK</country>
		<company>Polydor</company>
		<price>8.20</price>
		<year>1971</year>
	</cd>
	<cd>
		<title>Soulsville</title>
		<artist>Jorn Hoel</artist>
		<country>Norway</country>
		<company>WEA</company>
		<price>7.90</price>
		<year>1996</year>
	</cd>
	<cd>
		<title>The very best of</title>
		<artist>Cat Stevens</artist>
		<country>UK</country>
		<company>Island</company>
		<price>8.90</price>
		<year>1990</year>
	</cd>
	<cd>
		<title>Stop</title>
		<artist>Sam Brown</artist>
		<country>UK</country>
		<company>A and M</company>
		<price>8.90</price>
		<year>1988</year>
	</cd>
	<cd>
		<title>Bridge of Spies</title>
		<artist>T`Pau</artist>
		<country>UK</country>
		<company>Siren</company>
		<price>7.90</price>
		<year>1987</year>
	</cd>
	<cd>
		<title>Private Dancer</title>
		<artist>Tina Turner</artist>
		<country>UK</country>
		<company>Capitol</company>
		<price>8.90</price>
		<year>1983</year>
	</cd>
	<cd>
		<title>Midt om natten</title>
		<artist>Kim Larsen</artist>
		<country>EU</country>
		<company>Medley</company>
		<price>7.80</price>
		<year>1983</year>
	</cd>
	<cd>
		<title>Pavarotti Gala Concert</title>
		<artist>Luciano Pavarotti</artist>
		<country>UK</country>
		<company>DECCA</company>
		<price>9.90</price>
		<year>1991</year>
	</cd>
	<cd>
		<title>The dock of the bay</title>
		<artist>Otis Redding</artist>
		<country>USA</country>
		<company>Atlantic</company>
		<price>7.90</price>
		<year>1987</year>
	</cd>
	<cd>
		<title>Picture book</title>
		<artist>Simply Red</artist>
		<country>EU</country>
		<company>Elektra</company>
		<price>7.20</price>
		<year>1985</year>
	</cd>
	<cd>
		<title>Red</title>
		<artist>The Communards</artist>
		<country>UK</country>
		<company>London</company>
		<price>7.80</price>
		<year>1987</year>
	</cd>
	<cd>
		<title>Unchain my heart</title>
		<artist>Joe Cocker</artist>
		<country>USA</country>
		<company>EMI</company>
		<price>8.20</price>
		<year>1987</year>
	</cd>
</catalog>

وليكن لدينا ملف catalog.xslt (لا يشترط الاسم نفسه)

<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
 <html>
 <body>
 <h2>My CD Collection</h2>
	<table border="1">
 	<tr bgcolor="#9acd32">
 	<th>Title</th>
 	<th>Artist</th>
 	</tr>
 	<xsl:for-each select="catalog/cd">
 	<tr>
 	<td><xsl:value-of select="title"/></td>
 	<td><xsl:value-of select="artist"/></td>
 	</tr>
 	</xsl:for-each>
	</table>
 </body>
 </html>
</xsl:template>
</xsl:stylesheet>

لاحظ أن محتوى ملف catalog.xslt يشبه كثيراً محتويات أي ملف HTML إلا في بعض التعابير الخاصة بـ XSL والتي تسمح بتفسير ومعالجة ملفات XML.

سيتطلب الأمر أيضاً استخدام ملف HTML خفيف يحوي بداخله على كود JS ليقوم بقراءة الملفات المطلوبة وتنفيذ XML DOM عليها.

النتيجة ستكون على الصفحة التالية: http://www.w3schools.com/xsl/tryxslt_result.asp?xmlfile=cdcatalog&xsltfile=cdcatalog

إن كان هذا ما تطلبه، وضعت لك المثال في مجموعة ملفات مضغوطة ليتسنى لك تحميلها والاطلاع عليها محلّياً.

3

Do as I say, not as I do

We are Anonymous. We are Legion. We don't forgive. We don't forget

#3

مشكور جدا ع الشرح

لكن انا مش عايز اعرض ع ملف xslt انا عايز اعرف ملف xml مربوط بملف dtd خاص به واعتقد انو في ملف schema عشان يقدر يعرف tag اللي موجود بملف الxml

لانو عندك بلمف الxml اللي في المثال من وين هو بعرف اشي اسمع title لازم تكون معرفه من نوع معين عشان يقدر يتعرف عليه

الخلاصة اني مش عارف من وين ابدا باي ملف عشان اكون ماشي صح

فقط

#4

ربما تود الإطلاع على الرابط التالي:

http://www.brics.dk/~amoeller/XML/schemas/

1

Do as I say, not as I do

We are Anonymous. We are Legion. We don't forgive. We don't forget

#5

مرحباً

شرح رائع ومثال واضح في المشاركة الأولى

Xacker.Rating = Xacker.Rating + 1

:lol:

مؤسس شبكة مواقع إجابتي أول شبكة مواقع عربية للأسئلة والأجوبة

مواضيع مشابهة