DCSIMG
What is new in IE9 - XML Namespace - שלמה גולדברג (הרב דוטנט)

שלמה גולדברג (הרב דוטנט)

מרצה בסלע ויועץ בעולם ה - net.

What is new in IE9 - XML Namespace

 

כיצד Internet Explorer מציג XML לפי תקן CSS3

 
התקן מגדיר שאפשר להגדיר ב - CSS עיצוב לקבצי XML בעזרת הגדרה של Namespace.
 
 
כדוגמא נקח את קוד ה - XML הבא
 

<?xml version="1.0" standalone="no"?>

<?xml-stylesheet href="namespace.css" type="text/css"?>

 

<Syllabuses xmlns="http://www.contoso.com/Syllabuses">

  <Syllabus>

    <CourseCode>50150</CourseCode>

    <Title>C# 3.0 Programming in the .NET Framework </Title>

    <Description>

      This six-day instructor-led course provides students with

      the knowledge and skills to develop applications in the

      .NET Framework 3.5 using the C# 3.0 programming language.

      C# is one of the most popular programming languages in existence,

      and the C# 3.0 revision introduces new productivity, performance,

      functional programming and convenience features into the language.

      This course features an overview of all language-related features,

      as well as an introduction to general .NET Framework features such as garbage collection,

      assembly loading, Reflection, Language-Integrated Query (LINQ) and many others.

    </Description>

    <Topics>

      <Description>Module 1: Introduction to the .NET Framework </Description>

      <Description>Module 2: Introduction to C# 3.0 </Description>

      <Description>Module 3: The .NET Type System </Description>

      <Description>Module 4: C# Classes </Description>

      <Description>Module 5: Garbage Collection </Description>

    </Topics>

  </Syllabus>

  <Syllabus>

    <CourseCode>ASP 35</CourseCode>

    <Title>Developing Web Applications using ASP 3.5</Title>

    <Description>

      In this course we will learn how to build advanced web application using ASP.NET 3.5;

      describe the changes in relation to ASP.NET 2.0.; cover all the new features ASP.NET 3.5 introduce.

      We will see how to use VS 2008 with ASP.NET 3.5 ; understand the internals of the framework ;

      describe how ASP.NET 3.5 connects with other .NET technologies like ADO.NET, WCF, WS, .Net Security etc

    </Description>

    <Topics>

      <Description>Introduction to the web</Description>

      <Description>Introduction To ASP.NET</Description>

      <Description>Programming Asp.Net </Description>

      <Description>Deployment</Description>

      <Description>Validation</Description>

    </Topics>

  </Syllabus>

</Syllabuses>

 

 

 
יש לשים לב שחייבים להכיל קובץ CSS בעזרת xml-stylesheet.
 
נראה את קובץ ה - CSS
 

@namespace Syllabuses "http://www.contoso.com/Syllabuses";

 

Syllabuses

{

    font-family: Arial;

    font-size: 12pt;

}

 

Syllabuses|Syllabus

{

    border-left: 2px solid #555;

    border-right: 2px solid #555;

    display: block;

    padding: 10px;

}

 

Syllabuses|Syllabus:hover

{

    background-color: #ffc;

}

 

Syllabuses|CourseCode

{

    display: block;

    font-weight: bold;

    text-align: left;

    color: White;

    background-color: Black;

    font-size: 10pt;

    line-height: 200%;

    padding-left: 10px;

}

 

Syllabuses|Title

{

    display: block;

    font-style: italic;

    margin-left: 16px;

    color: #3b6ead;

    font-size: 14pt;

    font-weight: bold;

    text-align: center;

    padding: 10px;

}

 

Syllabuses|Description

{

    display: block;

    color: #707070;

    font-size: 11pt;

    background-color: rgb(240, 238, 239);

    line-height: 150%;

    padding: 10px;

}

 

Syllabuses|Topics

{

    padding-top: 10px;

    display: block;

    background-color: White;

}

 

Syllabuses|Topics Description

{

    display: block;

    background-color: White;

    line-height: 140%;

    padding: 3px;

    color: Black;

}

 
 
בהתחלה יש ייבוא של ה - namespace שעליו אנחנו מדברים, וכל אלמנט בקובץ ה - CSS מתייחס לאותו namespace בעזרת הסימן | מתייחסים לאלמנטים פנימיים, במקרה שיש בכמה רמות את אותו שם כמו Description של Syllabus ו - Description של Topic כותבים בצורה הבאה
 
Syllabus|Topics Descripton
 
 
כעת מה שנשאר זה להציג את ה - XML בדפדפן (על ידי גלישה ישירה או או לכלול אותו בדף html בעזרת iframe) בדוגמא שלנו נקבל את התוצאה הבאה:
 
xml
 
 
הדבר היחיד ש - IE9 שכח לתמוך הוא - בהצגה של XML רגיל - כלומר ללא הגדרה של CSS, בגרסאות הקודמות הדפדפן הצג את ה - XML בצורה ידידותית בגרסה הנוכחית (IE9 Beta) הוא מציג טקסט נקי.


תוכן התגובה

What is new in IE9 - XML Namespace - ???????? ?????????????? (?????? ??????????) כתב/ה:

Pingback from  What is new in IE9 - XML Namespace - ???????? ?????????????? (?????? ??????????)

# November 2, 2010 5:38 PM
שלח תגובה

(שדה חובה)  

(שדה חובה)  

(אופציונלי)

(שדה חובה) 

Please add 4 and 2 and type the answer here:


Enter the numbers above: