Você está na página 1de 4

XML = Extensible Markup Language Markup language specifies the structure and content of a document XML is subset of SGML

(Standard Generalized Markup Language) from !"#s XML is easier than SGML but more robust than $%ML XML primary goals Easil& usable 'ia internet Supporting of (ide 'ariet& of applications) compatible (ith SGML eas& to (rite programs for (programs that support XML) *eep optional features to minimum) ideall& zero Should be clear to understand b& nonprogrammers Should be prepared +uickl& Must be exact and concise Should be eas& to create %erseness (bre'it&) is of minimum importance XML ,ocument is well-formed if it has no s&ntax errors and valid if it satisfies rules set in ,%, or schema DTDs (document data definitions) and Sc emas contain rules for ho( XML data should be structured and are attached to the doc containing the data XML doc must satisf& rules in schema to be 'alid XML doc parts!rolog . XML declaration and ,ocument t&pe declaration) optional comments or instructions "ody . contains content and hierarchical tree structure #pilog . optional) contains comments and instructions ,eclaration - /0xml 'ersion =1 2#1 encoding=13%45"1 standalone =1&es106 $omments- /755comment text556 #lements- /element8name69ontent/:element8name6 #mpty element- /element:6 (EX- /hr:6) /br:6) /img:6 %ested #lements (called c ild elements) all elements must be nested (ithin a single root element) /tracks6 /track6So ;hat (-<<)/:track6

/track6=lue in Green (>-?@)/:track6 /:tracks6 9harting- Ao s&mbol on bar . contains single occurrence of child 0 . child occurs once or zero times BC1 . %he child occurs an& number of times BD1 . %he child occurs at least once &ttri'ute- /element8name attribute=1'alue16 /:element8name6 EX/9,6 /title6kind of blue/:title6 /artist6Miles ,a'is/:artist6 /tracks6 /track length=1>->@16M& 4unn& Ealentine/:track6 /track length =1!-?<16=lues b& 4i'e/:track6 /:tracks6 /:9,6 $ aracter reference( FGampH = ampersand EX/price63*- FG I?H>2>!/:price6

$Data- J large portion of text EX/7K9,J%JKLour text goes here MM6

Style s eets/0xml5st&lesheet t&pe=1st&le1 href=1sheet106 Style is the t&pe of st&le sheet and sheet is the location in the form of a url2

$SS Styles eet/0xml5st&lesheet t&pe =1text:css1 href=1cd8catalog2css106 $ompound Document . combines se'eral 'ocabularies &ttri'utes and elements . attributes cannot contain multiple 'alues (child elements can) Jttributes are characteristics of elements in the form of text strings in single or double +uotes attributes are not easil& expandable attributes cannot describe structures (child elements can) &ttri'ute- simple t&pe) s&ntax/xs-attribute name=1name1 t&pe=1t&pe1 default=1default fixed=1fixed1:6 (default=default 'alue) fixed=fixed 'alue) ) en to use attri'utesNnfo re+uires default or fixed 'alue info re+uires data that is metadata for existing element attributes take up fe(er b&tes simpleType 's comple*Type . $omple* types are element definitions that include other elements) attributes) and groups2 9an include elements and attributes declared as simple or complex t&pe2 Simple types are either user defined ( deri'ed from (?c built in t&pes b& appl&ing user5defined 'alues to items called facets) or built in (defined from (?c XML schema specification . for example) string) boolean) and float) includes both primiti'e and deri'ed t&pes) Xpat . follo(s from root element to specific element2 Aotation - in'entor&:drink:soda:price ,rink is child of in'entor&) soda is child of drink) price is child of soda2 Sc ema 5 2xsd document that is referenced b& the instance document2 ,eclaration-

/xs- schema xmlns-xs =Bhttp-::(((2(?2org:<## :XMLSchema16 schema content /:xs-schema6 remo'e Bxs-1 if document doesnOt use namespaces2 %amespacePA namespace can be declared in the prolog or as an element attribute. The syntax for an attribute used to declare a namespace in the prolog is: P xmlns:prefix=BURI1

. PWhere URI is a Uniform Resource Identifier that assigns a unique name to the namespace, and prefix is a string of letters that associates each element or attribute in the document with the declared namespace.

Declaring a DTD an internal subset is declarations placed in the same file as the content, an external declaration is located in a separate file %he ,Q9%LRE declaration for an internal subset isP /7,Q9%LRE root K declarations M6 P;here root is the name of the documentSs root element) and declarations are the statements that comprise the ,%,2 Declaring Document Elements: %he element declaration s&ntax is/7ELEMEA% element content-model6 P;here element is the element name and content-model specifies (hat t&pe of content the element contains2

Você também pode gostar