XML Example PowerPoint PPT Presentation

presentation player overlay
About This Presentation
Transcript and Presenter's Notes

Title: XML Example


1
XML Example
lt?xml version"1.1" ?gt ltcd sernum"99999"gt
       lttitlegtPlaylt/titlegt       
ltartistgtMobylt/artistgt         ltcover
photo"/covers/play.gif" /gt         lttrack
no"6"gtBodyrocklt/trackgt lt/cdgt
2
XML Schema Example
  • ltxsdschema xmlnsxsd"http//www.w3.org//2000/10/
    XMLSchema"gtltxsdelement name"movie"gt   
    ltxsdcomplexTypegt                lt!-- b/c it has
    children --gt        ltxsdsequencegt           
    ltxsdelement name"title" type"xsdstring"
    /gt            ltxsdelement name"director"gt     
              ltxsdcomplexTypegt                   
    ltxsdsequencegt                       
    ltxsdelement name"title" type"xsdstring"
    minOccurs"0" /gt                       
    ltxsdelement name"fname" type"xsdstring"
    /gt                        ltxsdelement
    name"lname" type"xsdstring" /gt                
        lt/xsdsequencegt              
    lt/xsdcomplexTypegt            
    lt/xsdelementgt            ltxsdelement
    name"actor" minOccurs"0" maxOcurs"unbounded"
    gt                    ...          
    lt/xsdelementgt        lt/xsdsequencegt       
    ltxsdattribute name"gross" type"xsddecimal"
    /gt   lt/xsdcomplexTypegtlt/xsdelementgt
  • lt/xsdschemagt

3
Name Conflicts?
  • Elements about people title, fname, lname
  • Elements about movies title, director, actor
  • ltmoviegt lttitlegtStar Warslt/titlegt
    ltdirectorgt ltfnamegtGeorgelt/fnamegt ltlnamegtLuca
    slt/lnamegt lt/directorgt ltactorgt lttitlegtSirlt/tit
    legt ltfnamegtAleclt/fnamegt ltlnamegtGuinesslt/lname
    gt lt/actorgt lt/moviegt

4
XML Namespaces
  • ltmmovie xmlnsm"http//www.hollywood.org/movies"
    xmlnsp"http//www.standards.org/people"gt
    ltmtitlegtStar Warslt/mtitlegt ltmdirectorgt ltp
    fnamegtGeorgelt/pfnamegt ltplnamegtLucaslt/plnamegt
    lt/mdirectorgt ltmactorgt ltptitlegtSirlt/ptitlegt
    ltpfnamegtAleclt/pfnamegt ltplnamegtGuinesslt/pl
    namegt lt/mactorgt lt/mmoviegt

5
XSLT Example
Original Document
An XSLT Stylesheet
  • ltbookgt     lttitlegtThe Fellowship of the
    Ringlt/titlegt     ltauthorgtJ.R.R. Tolkienlt/authorgt
        ltpublishedgt1963lt/publishedgt lt/bookgt
  • ltxslstylesheet version1.0 xmlnsxslhttp//w
    ww.w3.org/1999/gt
  • ltxsltemplate match"/"gt lthtmlgt ltbodygt ltxslapp
    ly-templates select"book /gt lt/bodygt lt/htmlgtltx
    sltemplategt
  • ltxsltemplate match"book"gt   
    ltpgt ltbgtltxslvalue-of select"title" /gtlt/bgt    
    by ltxslvalue-of select"author /gt .
    ltxslvalue-of select"published
    /gtlt/pgtlt/xsltemplategt
  • lt/xslstylesheetgt

Transformed Document
lthtmlgtltbodygt     ltpgt ltbgtThe Fellowship of the
Ringlt/bgt     by J.R.R. Tolkien. 1963 lt/pgt
lt/bodygt lt/htmlgt
Write a Comment
User Comments (0)
About PowerShow.com