Tải bản đầy đủ (.pdf) (1,331 trang)

Addison wesley the XML schema complete reference sep 2002 ISBN 0672323745

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (7.65 MB, 1,331 trang )

XMLSchemaCompleteReference,The
ByCliffBinstock,DavePeterson,MitchellSmith,
MikeWooding,ChrisDix,ChrisGaltenberg


Publisher :AddisonWesley
PubDate :September27,2002
ISBN :0-672-32374-5
Pages :1008
WiththesuccessfulimplementationofXMLSchema,developersarelearninghowto
increaseproductivity,improvesoftwarereliability,minimizedevelopmenttime,and
decreasetimetomarket.Thisin-depthreferenceisanall-in-oneresourcedesignedto
helpdevelopersleveragethepowerandpotentialofXMLschemasbyofferinga
completeroadmaptotheircreation,design,anduse.

Thisauthoritativereferenceandtutorialisfilledwithpracticalinsightsand
detailedexamples.Thebookbeginsbyprovidingaconceptualintroductionto
XMLSchema.Fromthere,coverageshiftstotheW3CSchema
Recommendationandhowtoapplyschemastospecificbusinessgoals.The
authorsprovideinsightandinstructionthroughoutonintegratingXMLschemas
intoexistingtechnologiessuchas.NET,Java,VisualBasic,Oracle,andmore.
Thebookconcludeswithacompletecasestudydesignedtoreinforceand
illustratematerialcovered.
Additionaltopicsinclude:



Tableof

Contents


Applicationsforschemas
Simpleandcomplextypes
XMLschemaprocessingandvalidation
NamespacesinXML
UsingschemaswithDOMandSAX
XMLschemadocumentsyntax
XMLInformationSets
XMLSchemaapplicationsofXPath
Whetherdesigningaschemafromscratchorintegratingschemasinto
contemporarytechnologies,TheXMLSchemaCompleteReferenceisthemost
completeanddefinitivesourcebookavailablefortheXMLSchema
environment.


777
Copyright


Preface



TheHistory



TheBook




TheWebSite



TheValue




Acknowledgments



AbouttheAuthors



PartI:XMLSchemaOverview



Chapter1.Introduction



Section1.1.WhyXML?



Section1.2.WhyXMLSchemas?




Section1.3.TheWorldWideWebConsortium(W3C)Recommendations



Section1.4.Object-orientedConcepts



Section1.5.UnifyingTerminology



Section1.6.ThematicExamples



Section1.7.CreatinganXMLSchemaDocument



Section1.8.TypesettingConventions



Section1.9.OnlineResources





Chapter2.XMLProcessing



Section2.1.Basics



Section2.2.XMLStructureBeforeandAfterParsing



Section2.3.SchemaProcessing




Chapter3.XMLNamespaces



Section3.1.UniformResourceNamesandUniformResourceLocators



Section3.2.NamespaceComponents




Section3.3.DeclaringNamespaces



Section3.4.QualifiedNamesandQNames



Section3.5.NamespaceScoping



Section3.6.XMLSchemaandNamespaces




Chapter4.XPathandXPointer



Section4.1.XPath



Section4.2.XPointer





Chapter5.TheStructureofDocumentsandSchemas



Section5.1.XMLDocuments



Section5.2.TheXMLInformationSet




Section5.3.IntroductiontothePSVI



Section5.4.IntroductiontoSchemas



Section5.5.SchemaDocuments






PartII:CreatingXMLSchemaDocuments

Chapter6.OverviewofanXMLSchemaDocument



Section6.1.TheEnclosingschemaElement



Section6.2.Namespaces



Section6.3.Scope



Section6.4.AnnotatingElements



Section6.5.ConstrainingElements



Section6.6.ConstrainingAttributes



Section6.7.SimpleTypes




Section6.8.ComplexTypes



Section6.9.ModelGroups



Section6.10.SubstitutionGroups



Section6.11.Instantiability



Section6.12.IdentityConstraintDefinitions



Section6.13.Notations



Section6.14.ImportsandIncludes




Section6.15.LocatingXMLSchemasandXMLSchemaComponents



Section6.16.SchemaElementIDs




Chapter7.CreatinganXMLSchemaDocument



Section7.1.ASimpleXMLSchemaDocumentExample



Section7.2.AschemaElementwithEveryAttribute



Section7.3.ConceptsandObservations



Section7.4.TheschemaElement



Section7.5.TheannotationElement




Section7.6.TheappinfoElement



Section7.7.ThedocumentationElement



Section7.8.TheincludeElement



Section7.9.TheimportElement



Section7.10.ThenotationElement



Section7.11.TheredefineElement




Chapter8.ElementTypes




Section8.1.AnExampleofaTrivialElementType



Section8.2.ConceptsandObservations




Section8.3.TheelementElement



Section8.4.TheanyElement




Chapter9.AttributeTypes



Section9.1.AnExampleofanAttributeType



Section9.2.AnExampleofaNamedAttribute-useGroup




Section9.3.AnExampleofanyAttribute



Section9.4.ConceptsandObservationsRegardingAttributeTypes



Section9.5.TheattributeElement



Section9.6.TheattributeGroupElement



Section9.7.TheanyAttributeElement







Section10.1.AnExampleofaSimpleTypeDerivedfromtheBuilt-in

tokenDatatype





Chapter10.SimpleTypes



Section10.2.AnExampleofaPattern-constrainedSimpleType
Section10.3.AnExampleofaSimpleTypeDerivedfromaUser-derived
SimpleType



Section10.4.ConceptsandObservations



Section10.5.ThesimpleTypeElement



Section10.6.TherestrictionElement



Section10.7.ThelistElement



Section10.8.TheunionElement








Chapter11.ComplexTypes
Section11.1.AnExampleofaComplexTypeSpecifyingEmptyContent



Section11.2.AnExampleofaComplexTypeThatAddsAttributestoa
SimpleType



Section11.3.AnExampleofaComplexTypeSpecifyingNestedElement
Types



Section11.4.AnExampleofaComplexTypeSpecifyingMixedContent



Section11.5.ConceptsandObservations




Section11.6.ThecomplexTypeElement



Section11.7.ThesimpleContentElement



Section11.8.ThecomplexContentElement



Section11.9.TheextensionElement



Section11.10.TherestrictionElement






Section11.11.TheallElement




Section11.12.ThechoiceElement




Section11.13.ThesequenceElement



Section11.14.ThegroupElement




Chapter12.Built-inDatatypes



Section12.1.NumericDatatypes



Section12.2.Date,Time,andDurationDatatypes



Section12.3.StringDatatypes



Section12.4.OddballDatatypes





Chapter13.IdentityConstraints



Section13.1.IdentityConstraintExample



Section13.2.ConceptsandObservations



Section13.3.TheuniqueElement



Section13.4.ThekeyElement



Section13.5.ThekeyrefElement



Section13.6.TheselectorElement




Section13.7.ThefieldElement




Chapter14.RegularExpressions



Section14.1.ConceptsandObservations



Section14.2.RegularExpressionSyntax



Section14.3.ConstrainingSimpleContent





PartIII:Validation



Chapter15.XMLSchemaComponentDetail




Section15.1.Schemas:TheBasicIdea



Section15.2.Schema(SchemaSchemaComponent)



Section15.3.AttributeTypes



Section15.4.ElementTypes



Section15.5.Annotation(AnnotationSchemaComponent)



Section15.6.Notation(NotationDeclarationSchemaComponent)




Chapter16.PSVIDetail




Section16.1.SchemaValidationandSchemaProcessing



Section16.2.ThePSVI








Chapter17.JavaandtheApacheXMLProject



Section17.1.ApacheBackground



Section17.2.JavaXercesonYourComputer



Section17.3."HelloApache"



Section17.4.CriticalXercesPackages




Section17.5.XercesJavaDOMIn-depth



Section17.6.JavaXercesSAXIn-depth




Chapter18.MSXMLandtheSchemaObjectModel(SOM)



Section18.1.IntroducingMSXML



Section18.2.ConceptsandObservations



Section18.3.XMLSchemaExamples



Section18.4.MSXMLFundamentals




Section18.5.SchemaObjectModel(SOM)



Section18.6.Validation



Section18.7.Example:XMLSchemaTree






PartIV:Result-orientedSchemas
Chapter19.Object-orientedSchemas



Section19.1.ConceptsandObservations



Section19.2.Object-orientedConcepts




Section19.3.XMLSchemasandObjects



Section19.4.MappingXMLSchemastoObject-orientedLanguages



Section19.5.SampleSchema:party.xsd



Section19.6.DesignPatterns



Section19.7.LanguageExamples




Chapter20.Document-orientedSchemas



Section20.1.WhyUseXMLforDocuments?



Section20.2.CreatingaSchemaforaSetofDocuments:DocumentAnalysis




Section20.3.ImplementingDocumentProcessing




Chapter21.Application-orientedSchemas



Section21.1.XMLApplications



Section21.2.RoleofXMLSchemas



Section21.3.DescribingApplications



Section21.4.ApplicationStructure



Section21.5.TransportingXML




Section21.6.DescribingApplications




Section21.7.ExampleApplication







PartV:Data-orientedSchemas


Chapter22.Data-orientedSchemas:Datatypes



Section22.1.XMLSchemaDesignConsiderations



Section22.2.GeneralDiscussionofFacetRestrictions




Section22.3.CheckConstraintsversusTriggers



Section22.4.Datatypes




Chapter23.Data-orientedSchemas:SimpleTypes



Section23.1.XMLSchemaDesignConsiderations



Section23.2.AnExampleofaSimpleTypeMappingtoaDatabaseSchema



Section23.3.ConceptsandObservations



Section23.4.ThelistElement



Section23.5.TheunionElement





Chapter24.Data-orientedSchemas:ComplexTypes



Section24.1.XMLSchemaDesignConsiderations



Section24.2.AnExampleofaComplexTypeMappingtoaDatabaseSchema





Section24.3.AnExampleofaComplexTypeMappingSupportingMixed
ContenttoaDatabaseSchema



Section24.4.ConceptsandObservations



Section24.5.complexTypeElement




Section24.6.allElement



Section24.7.annotationElement



Section24.8.anyElement



Section24.9.anyAttributeElement



Section24.10.attributeGroupElement



Section24.11.choiceElement



Section24.12.complexContentElement



Section24.13.groupElement




Section24.14.sequenceElement



Section24.15.simpleContentElement








Section24.16.restrictionElement

Section24.17.extensionElement



PartVI:ACaseStudy:TheCampusResourceandSchedulingSystem(CRSS)




Chapter25.TheBusinessCase




Section25.1.BasicCRSSFlow



Section25.2.CRSSRequirements



Section25.3.SystemUsers



Section25.4.ExtensibleStyleLanguageTransform(XSLT)



Section25.5.SQL2000XMLCapabilities



Section25.6.CRSSTechnicalArchitecture



Section25.7.Summary





Chapter26.TheArchitecture



Section26.1.SystemArchitecture



Section26.2.CreatingHTMLPagesbyUsingXSLT



Section26.3.SendingFormData



Section26.4.Summary




Chapter27.TheServerTier



Section27.1.DatabaseDesignwithXMLSchemas



Section27.2.SQLIISConfiguration




Section27.3.CRSSApplicationRequirements



Section27.4.Updategrams



Section27.5.Summary




Chapter28.TheIntegratedSolution



Section28.1.CRSSDesignReview



Section28.2.WebTierConstruction



Section28.3.UIBrokerComponentConstruction




Section28.4.SecurityBrokerComponentConstruction



Section28.5.CRSSBrokerComponentConstruction



Section28.6.TemplateQuery



Section28.7.CRSSReview





PartVII:Appendixes




AppendixA.XMLSchemaQuickReference



AppendixB.XMLSchemaRegularExpressionGrammar




AppendixC.TheThematicCatalogXMLSchema



AppendixD.Data-orientedSchemas:Oracle8iDatatypes



SectionD.1.GeneralOverview



SectionD.2.DiscussionoftheConsequences




AppendixE.Glossary



SectionE.1.Objects,Classes,andInstances



SectionE.2.Markup




SectionE.3.XMLDocuments



SectionE.4.XMLDTDsandSchemas



SectionE.5.SelectedDatatypesUsedinSchemaDocuments



SectionE.6.Miscellaneous


Copyright
Manyofthedesignationsusedbymanufacturersandsellerstodistinguishtheir
productsareclaimedastrademarks.Wherethosedesignationsappearinthis
book,andAddison-Wesleywasawareofatrademarkclaim,thedesignations
havebeenprintedwithinitialcapitallettersorinallcapitals.
Theauthorsandpublisherhavetakencareinthepreparationofthisbook,but
makenoexpressedorimpliedwarrantyofanykindandassumenoresponsibility
forerrorsoromissions.Noliabilityisassumedforincidentalorconsequential
damagesinconnectionwithorarisingoutoftheuseoftheinformationor
programscontainedherein.
Thepublisheroffersdiscountsonthisbookwhenorderedinquantityforbulk
purchasesandspecialsales.Formoreinformation,pleasecontact:
U.S.CorporateandGovernmentSales

(800)382-3419

ForsalesoutsideoftheU.S.,pleasecontact:
InternationalSales
(317)581-3793

VisitAddison-WesleyontheWeb:www.awprofessional.com
LibraryofCongressCataloging-in-PublicationData
TheXMLschemacompletereference/CliffBinstock...[etal.]
p.cm


Includesindex
1.XML(Documentmarkuplanguage)2.Databasemanagement.
I.Binstock,Cliff.
QA76.76.H94X45492003
005.7'2—dc212002074383
Copyright©2003byPearsonEducation,Inc.
Allrightsreserved.Nopartofthispublicationmaybereproduced,storedina
retrievalsystem,ortransmitted,inanyform,orbyanymeans,electronic,
mechanical,photocopying,recording,orotherwise,withoutthepriorconsentof
thepublisher.PrintedintheUnitedStatesofAmerica.Publishedsimultaneously
inCanada.
Forinformationonobtainingpermissionforuseofmaterialfromthiswork,
pleasesubmitawrittenrequestto:
PearsonEducation,Inc.
RightsandContractsDepartment
75ArlingtonStreet,Suite300
Boston,MA02116
Fax:(617)848-7047

Textprintedonrecycledpaper
12345678910—CRS—0605040302
Firstprinting,September2002

Dedication


CliffBinstock
ToAmyLynn,mytruelove,mybestfriend,mylifepartner,mywife
DavePeterson
To"Helga"
MitchellSmith
ToRickforinspiringmeinsomanyways,DanforbringingmetoArrayand
yourheartfulness,Jonathanforfinallyhiringme(andsomuchmore),Shanti,
Eliyahu,andAmyforbeingwhoyouare,andtoYehudisforteachingmesowell.
Finally,tomywifeBarbarawhoneverceasestoamazeme.Thanksforyour
patience,thetimetowritethisbook,andyourunderstanding.
MikeWooding
IwouldliketothankmybeautifulwifeLindaforallofhersupportonthisand
everyproject.Withouthersupport,Icouldnotdisappearforthemanylong
hoursthatarerequiredtowrite.
ChrisDix
ToMicah
ChristopherGaltenberg
ToLavinia,mylifeblood


Preface
Theauthoringandeditorialteamsforthisbookhaveworkedhardtobringyou
thecleanest,clearest,andmostcompleteXMLschemareferencesourceonthe

market.Endlesssweat,researchhours,codetesting,techanddefinitionreviews
andcounterexplanations,e-mailqueries,dialogue,anddebatespassedbefore
thisbookcametofruition.Earnestefforts,stress-filledmoments,andwriting
deadlineshavefinallygottenustopresstime.Hereiswhatthisbookmeansto
us.

TheHistory
Therearealwaysnewandhottechnologiestowriteabout(C++,Java,SQL,
.NET,XMLSchema,andmuchmore).Therearequalifiedwriterseagertowrite
aclearandconcisebest-sellerforyourbookshelf.Therearemillionsofsoftware
developerseagertolearn.Therearemorethanafewpublisherstochoosefrom.
Ultimatelythereareseveraltechnicalbooksonthemarketwithinmonthsofany
newproduct,platform,service,tool,orlanguage'sreleasethatseektodescribe,
explain,clarify,andelaborateonagiventechnology'simportance,utility,and
implementation.However,thereareveryfewreallygoodbooksonthe"whyand
when"thatwillactuallyteachdevelopersemergingtechnologies.Infact,the
hardesttypesofbookstowritediscussemergingtechnologies,becausethere
reallyarenotmanygoodexamples.Furthermore,eventhe"experts"frequently
disagreeonwhatis"right."
Wespentmanymonths—fulltime—writingthisbook.Wecollectivelyhave
somethinglike80yearsofexperience.SomeofusareontheW3CSchema
WorkingGroup.Webelievethatthiscombinedexperience,aswellasthe
determinationwritingthisbook,resultsinoneofthefew"reallygoodbooks"
previouslymentioned.Ittakestherightcombinationoftechnology,authors,
publishers,andreaderstopulloffabook.

TheBook


Thereareseveral,andprobablysoontobelots,ofbooksonthemarketthat

pertaintoXMLSchema.Despitethisinflux,westronglybelievethatthisbook
providesdetailsthatfew,ifany,otherbooksprovide.Specifically,the
overarchinggoaldrivingthisbookistoprovidedetailedexamplesofeveryXML
Schemacomponent.Inordertodetaileachcomponent,thisbookcontainsan
exampleofthecorrespondingSchemadocumentelement,andallofthe
associatedattributes.Manyofthebooksonthemarkettodayprovidesurface
detailsaboutSchemacomponents.However,thisbookprovidesdetailed
scenarios.NotonlyaretheremanypagesandexamplesofeachSchemaelement,
thereisatleastoneexampleofeverysingleattributeofeverysingleXML
schemadocumentelement.Havingaccomplishedthatcolossaltask,weadded
exampleafterexampleintegratingwithmanylanguagesandtechnologieson
manyplatforms.Afterall,whatgoodisanXMLschemabyitself?

Audience
TheprimarygoalofthisbookistoprovidedetailedinformationaboutXML
Schema.Thebookopenswithadiscussiononthebackgroundandsupporting
RecommendationsforXMLSchema.ThebookaddresseshowtocreateXML
schemadocuments.Additionally,someofthechaptersinthisbookcover
integratingXMLschemasintootherexistingtechnologiessuchasJava,Visual
Basic,andOracle.Theaudienceofthisbookissoftwaredeveloperswhoneedto
createanXMLschemaorperhapsintegrateoneintoanapplication.Thisbook
doesnotsufficientlycoveraspectsoftheSchemaRecommendationthatpertain
towritinganXMLschemavalidator.

Prerequisites
MostofthetextinthisbookrequiresfamiliaritywithXML.Fordiscussionsthat
applytovarioustechnologies,suchasOracle,thetextrequiresfamiliaritywith
thepertinenttechnology.Ontheotherhand,thebookexplainsthestandardsthat
provideafoundationforXMLSchemaandevenXML,suchastheXMLInfoset,
XMLNamespace,andXPath.Object-orientedprinciplesapplytoXMLSchema;

thebookrequiresthatyouhaveageneralunderstandingofobjectsand
inheritance.


OrganizationofThisBook
ThepurposeofthisbookistodetailhowtocreateanXMLschema.
Furthermore,varioussectionsofthisbookdiscusshowandwhyyouwoulduse
suchaschema.Thisbookisdividedintosevenparts:
PartI,XMLSchemaOverview
PartII,CreatingXMLSchemaDocuments
PartIII,Validation
PartIV,Result-orientedSchemas
PartV,Data-orientedSchemas
PartVI,ACaseStudy:TheCampusResourceandSchedulingSystem
(CRSS)
PartVII,Appendixes
PartIofthisbookopenswithabriefdiscussionofXMLandthebasisfor
needingXMLSchema.Theoverviewencompassesreasonstouse—ornottouse
—aschema.PartIalsocoverssomegeneralconceptsthatprovideafoundation
forthisbook.Inaddition,PartIbrieflydiscussesthepracticalaspectsofcreating
anXMLschemadocumentandvalidatinganXMLinstanceagainsttheschema
representedbythatschemadocument.AnXMLdocumentisacharacterstring
conformingtothegrammaroftheXMLRecommendation(seeSection1.3);it
mightbeintheformofaninputstream,abuffer,adiskfile,oranyotherform.
AnXMLinstanceisanXMLdocument—orpotentiallyevenpartofadocument
—whosevalidityisbeingdetermined.Specifically,thevalidityofthisdocument
dependsonexamininganXMLschemaspecifiedbytheXMLinstance,or
possiblyadifferentschemaselectedusinginformationnotinthedocument.
Note
ThetermXMLinstanceasusedinthisbookisnotgeneric:XMLisnotaclassof



whichthesecharacterstringsareinstances.AnXMLdocument(orafragmentof
one)iscalledan"XMLinstance"onlywhenitisintendedtocarrythe
connotationofacandidateforvalidationinthecontextwherethetermisused.

PartIIcoverstheW3CXMLSchemaRecommendation,XMLSchema,indetail.
Inparticular,PartIIdetailseveryXMLschemaelementtypeandallofthe
correspondingattributes.Examplesthroughoutthispartofthebookdemonstrate
nearlyeveryfeatureofXMLSchema.PartIIservesasatutorialorareference
manual.
PartIIIencompassesvalidationofXMLschemas.SomeofthechaptersinPart
IIIarebackgroundinformation,suchasanin-depthdiscussionofpostschemavalidationinfoset(PSVI).Otherchaptersaremoreconcrete,containingcode
examplesthatdemonstratehowtovalidateXMLagainstanXMLschema.
PartIVcovershowtoapplyanXMLschematoachieveaparticularbusiness
goal.Inparticular,thispartofthebookaddressesthetargetofanXMLinstance,
suchasadocumentoranapplication.Inotherwords,PartIVdiscusseshowto
createanXMLschemasuchthattheschemaandcorrespondingXMLinstances
arehelpfulinprovidingthedesiredsolution.
PartVdiscusseshowtomirroranXMLschemawithanSQLschema.The
chaptersinthispartofthebookuseOracleasthetargetdatabase.Manyofthe
issuescoveredaregenerictoSQLschemageneration.Oracle9iisthespecific
targetofPartV.NotethatAppendixDaddressesthedifferencesbetween
Oracle8iandOracle9ipertainingtoXMLschemas.
PartVIisacompletecasestudy.Thiscasestudy,theCampusResourceand
SchedulingSystem(CRSS),integratesXMLschemaswithMicrosoft
technology:SQL2000,the.NETFramework,VisualBasiccode,andmore.
PartVIIprovidesgrammars,codeexamples,andaglossaryforquickreviews.

TheWebSite

TheWebsitecorrespondsdirectlyto


thisbook.ThesolepurposeofthisWebsiteistoprovideanonlinereferencefor
developerswritingXMLschemas.Nominally,theWebsiteprovidesaplaceto
downloadallofthefilescreatedwhilewritingthisbook.Thesefilesincludenot
onlytheXMLschemasandthesourcecodeinvariouslanguages,butalsoallof
thetestcasesforeventheone-linecodesnippets:Allofthecodeinthisbookis
tested!
TheWebsiteismuchmoreextensivethanjustacollectionoffiles,however.In
additiontothetraditionallyavailabledownloads,
haslotssimpleonlineexamplesof
everyschemadocumentelement.Therearetablesforeachelementthatindicate
whatattributesarepossible,aswellasabriefdescription.AlthoughthisWebsite
isnotatutorial,itisafantasticquickreferenceforthosewhoalreadyunderstand
XMLSchemaingeneral,butmightforgetthespecificsyntax.Itisourhopethat
theWebsite,likethebook,becomesrealreferencematerialforlotsof
developers.

TheValue
OurgoalistomakeiteasytocreateanXMLschema—whetheryouneeda
tutorialtowriteyourfirstschemadocument,oryoujustneedareferencebookto
writeyour5,000th.Havingcreatedaschema,thisbookalsogivesyouthesame
levelsofassistancetoincorporateanXMLschemaintoyourapplication.This
bookprovidesasmuchsupportasyouneed,withoutevergettingintheway.
HavefunworkingwithXMLschemas—wedo!
WeinviteyounowtotakeatourthroughtheworldofXMLschema
components,beginningwiththeintroductionprovidedforyouinChapter1.We
welcomeyourstories,additions,codesamples,questions,feedback,and
insights.

CliffBinstock

MikeWooding





DavePeterson

ChrisDix






MitchellSmith

ChrisGaltenberg






Acknowledgments
CliffBinstock:Manythankstomywife,Amy,forputtingupwithmonthsof
workonthisbook:days,nights,andweekends.ManythankstocoauthorDave
Peterson.Dave'sunflagginge-mailsandediting,aswellashisparticipationin

theW3CXMLSchemaWorkingGroup,madethisbookasaccurateashumanly
possible.ThankstoShelleyKronzek,executiveeditor,forprovidingthe
opportunitytosharesomeofmyknowledgewithyou.ThankstoAnneMarie
Walker,thedevelopmenteditor,forteachingmehowtowriteabook(which,by
theway,isverydifferentfromallthetechnicaldocumentsIhavewrittenover
theyears).Mostly,thankstoyou,thereader,formakingthislongjourney
worthwhile.Ireallyhopethatthisbookmakesyourcurrentandfutureprojects
mucheasier.
DavePeterson:Iwanttothankmywife,Greta,forputtingupwithmelivingin
anotherworldfortoomanymonthswhilethisbookhasbeengestating.Cliff,it's
beenfun.AndthankstoTyrrellAlbaughforrepeatedlysavingoursanity
towardstheend.
MitchellSmith:IwouldliketothankmyfriendCliffforgettingmeinvolved,
ShelleyandAnneMarieforalloftheirworkonthisbook,andDaveBuehmann
andDavidSchraderforteachingmetheexpressivenessofSQLandthe
capabilitiesofOracle.
MikeWooding:MyeffortsonthisbookwerepossiblebecauseIhadthe
fantasticsupportofmywonderfulwifeLindaandmytwodaughters,Andreaand
Jessica.Thanksforallowingmetodisappearintomy"cave"tocompletethis.
ChrisDix:IwouldliketothankmywifeJenniferandmysonsAlexanderand
Calvin;youaremyfavorites.ThankstoCliff,Shelley,andthefolksatAddisonWesleyforthisopportunity.
ChrisGaltenberg:AllmylovetomyLadyLavinia...andmanythanksto
"TheYear2001,"themostbrutalandevolutionaryperiodofmylife.


AbouttheAuthors

CliffBinstockhasmorethantwentyyearsofsoftwaredevelopmentexperience.
Hiscurrentrolesrangefromhands-onarchitectureandcodedevelopmentto
mentoringandmanaginglargegroupsofdevelopers.Cliff'sobject-oriented

experiencebeganwithrelativelyunknownlanguagesinthe1980sand
culminatedinyearsofdevelopmentintheextremelypopularC++andJava
languages.CliffhasalsospentmanyyearsworkingwithmultipleSQL
databases.In2000and2001,Cliffhelpeddelivershrink-wrapsoftwarefora
biotechfirm.ThesoftwareusedmultipleXMLschemastoprovidethesoftware
contractsforvariousmodules.XML,alongwithappropriatesupportingXML
schemas,providedaprogrammaticpipeline.Thepipelinearchitecturenotonly
supplantedmanylinesofJava,butitturnedmany"codechanges"intotrivial
XMLedits.Theexpertiseacquiredduringthisdevelopmenteffortledtothe
writingofthisbook.CliffistheowneroftheconsultingfirmRobustSoftware.

DavePetersonisprincipalconsultantwithhisownfirm,SGMLWorks!,
providingSGMLandXMLsolutionsforpublishinganddatabasesystems
worldwide.DavehasbeenworkingwithSGMLsincebeforetheISOStandard
waspublishedin1986,andwithXMLsinceitwasjustagleaminafewpeople's
eyes.He'sbeenprogrammingandarchitectingsystemsprofessionallysince
1967.Hehelpeddesignthesystemthatproducesandprocessesthelargest
SGMLdocumentintheworld—morethanthreebillioncharacters,markup,and
textinonedocument(notcountinggraphics).Heranthedocumentanalysisthat
ultimatelydefinedthedocumentstructureusedbytheNewZealandParliament


forlegalpublications,andhasdonethesameforotherlegalandpharmaceutical
publishers,aswellasforpublishersofjournalsandmilitaryandcivilian
technicaldocuments.Dave'sfirstjobwithSGMLin1986involvedusingSGML
(XMLwasnotaroundyet)totransferdatafromonedatabasetoanother.Hehas
designedandprogrammednumerousSGMLandXMLprocessingsystems.Dave
servedontheISOcommitteethatoversawthecontinuingdevelopmentfrom
1990through1998.Sincethen,hehasservedontheW3CSchemaWorking
Group,whichproducedtheXMLSchemaRecommendationin2001andisnow

workingonthe1.1version.Hehasgivennumerouspresentationsandtutorialsat
SGMLandXMLconferences,andhaswrittenaboutfortyarticlesonvarious
SGMLandXMLtopics.HewasontheeditorialboardofthejournalMarkup
Languages:TheoryandPractice.

MitchellSmithisChiefSoftwareArchitectatArrayBioPharmaInc.,in
Boulder,Colorado.Hehasseventeenyearsofexperiencedevelopingsoftware
solutionsandhasbeenworkingwithrelationaldatabasesformorethantwelve
years.Heiscurrentlydevelopingrapidsoftwaresolutionstointegratechemists'
processes,integratinghardware/softwareproductswiththeexistingchemoinfomaticsinfrastructure,andassistingchemists(inasmallway)toproduce
breakthroughdrugcandidates.PriortojoiningArrayBioPharmaInc.,Mitch
workedforRationalSoftwareCorporation,whereheco-architectedanextgenerationrequirementsmanagementsystemusingJ2EEandXML
technologies.MitchholdsanA.B.fromHarvardCollegeandanM.S.in
computersciencefromtheUniversityofColorado,Boulder.Mitchisamember
oftheACMandseniormemberoftheIEEE.HevotesonIEEEsoftware
standardsandiscurrentlysecretaryoftheIEEEDenver/BoulderComputer
Societychapter.Mitchisaco-inventoronpatentnumber6,199,047,entitled
"Apparatusandmethodforaneventratingengine."Outsidework,Mitchisan
avidyear-roundmountainbiker;healsoenjoyscampingandoverseasvacations.


MikeWoodinghasbeeninthecomputerindustryfortwentyyears.Hehas
authoredseveralcoursesforLearningTreeInternational,includingEnterprise
ActiveServerPagesandMicrosoftTransactionServer.Hewasinvolvedwiththe
ActiveServerPages.comsiteandspeaksregularlyatindustryconferences.Asa
partneratKieferConsulting,Mikefocusesondeliveringadvancedarchitectures
usingInternetstandardsandleveragingMicrosoft's.NETFrameworkusing
manytools,includingCOM+,.NET,VisualStudio.NET,and.NETWeb
Services.PriortojoiningKieferConsulting,MikedevelopedproductswithIntel,
BaxterHealthcare,andseveralsmallerSiliconValleystart-upcompanies.Mike

holdstwopatentsforworkinroboticsandDNAprobeanalysis.Inhisspare
time,Mikeenjoyssnowskiing,windsurfing,basketball,andautomatinghis
housewithacombinationofcustomandoff-the-shelfhardware.

ChrisDixhasbeendevelopingsoftwareforfunsincehewastenyearsold,and
doingitforalivingforthepasteightyears.Chrisrecentlymadethetransition
fromC++andCOMtoC#and.NETandisfindinghelikesitbetterthanhe
expected.He'swrittenmagazinearticlesonSOAPandWindowsdevelopment,
andhehascontributedtotwobooksonXMLandWebServices.Chrisislead
developerforNavtrak,wherehedesignsanddevelopsproductsformobiledata
accessandassettracking.


ChrisGaltenbergisawriter,inventor,andmethodologist.Hisinterestsliein
therealmsofextendinghumanintelligencethroughphilosophyandsoftware.
Galtenbergpoetry,whichexploresthisphilosophy,canbefoundat
.


PartI:XMLSchemaOverview
PartIprovidesdetailonthefoundationoftheW3CXMLSchema
Recommendation.Thisfoundationincludes,amongothertopics,theW3C
recommendationsthatsupporttheW3CXMLSchemaRecommendation.
Chapter1providesanoverviewofthevariousW3Crecommendations
thatarethefoundationfortheXMLSchemaRecommendation.The
terminologyandconceptsfromthevariousrecommendationscoalesce
intoadiscretesetofterms,whichprovideahandlewithwhichtoread
theremainderofthisbook.
Chapter2providesahigh-leveloverviewofhowanXMLparser
validatesXML.Thisoverviewalsocoverstheparserextensions

requiredtovalidateXMLagainstanXMLschema.
Chapter3isanoverviewofnamespaces.Thisoverviewincludesa
discussionoftheW3CXMLNamespaceRecommendation.
NamespacesareoneofthefirstconsiderationswhencreatinganXML
schemadocument.
Chapter4coversabasicdescriptionoftherespectivegrammars.
XPathlocateselementsandattributesforIdentityConstraints.
XPointerlocateselementsforinclusioninanXMLschemadocument.
Chapter5coverstheabstractrepresentationofbothXMLdocuments
andXMLschemas.ThischapteralsointroducesXMLinfosets,which
aretheabstractversionsofdocumentsonwhichanXMLschema
processoroperates.


CONTENTS


×