% mutate(HomeScoreDiff = `Home Points` - `Away Points`)
data <- data %>% mutate(HomeWin = ifelse(HomeScoreDiff > 0, 1, 0))
data <- data %>% mutate(HomeLoss = ifelse(HomeScoreDiff < 0, 1, 0))
# 2)
mean(data$HomeScoreDiff)
sd(data$HomeScoreDiff)
# 3)
data %>% summarise(HomeWins = sum(HomeWin), HomeLosses = sum(HomeLoss))
# 4)
data %>% mutate(HomeReboundDiff = `Home Rebounds` - `Away Rebounds`) %>%
summarise(mean = mean(HomeReboundDiff), sd = sd(HomeReboundDiff))
# PART B
# 1)
# First we have to define the teams. The unique teams are the names of the Home Teams.
teams <- unique(data$`Home Team`)
# We now have to create a data frame for each team.
# We will create an empty data frame to hold the data for each team.
team_data <- data.frame()
for (team in teams) {
# Filter the data for the team.
home_games <- data %>% filter(`Home Team` == team)
away_games <- data %>% filter(`Away Team` == team)
# Combine the home and away games.
team_games <- rbind(home_games, away_games)
# Add the team name to the data frame.
team_games$Team <- team
# Add the data to the data frame.
team_data <- rbind(team_data, team_games)
}
data <- team_data
# 2)
# Now we have to create a data frame for each team with the following columns:
# Team, HomeGames, AwayGames, HomeWins, HomeLosses, AwayWins, AwayLosses, HomePoints, AwayPoints, HomeAssists, AwayAssists, HomeRebounds, AwayRebounds
# We will create an empty data frame to hold the data for each team.
team_summary <- data.frame()
for (team in teams) {
# Filter the data for the team.
home_games <- data %>% filter(`Home Team` == team)
away_games <- data %>% filter(`Away Team` == team)
# Count the number of home and away games.
home_games_count <- nrow(home_games)
away_games_count <- nrow(away_games)
# Count the number of home wins and losses.
home_wins <- sum(home_games$HomeWin)
home_losses <- sum(home_games$HomeLoss)
# Count the number of away wins and losses.
away_wins <- sum(away_games$HomeLoss)
away_losses <- sum(away_games$HomeWin)
# Calculate the total points, assists, and rebounds for home and away games.
home_points <- sum(home_games$`Home Points`)
away_points <- sum(away_games$`Away Points`)
home_assists <- sum(home_games$`Home Assists`)
away_assists <- sum(away_games$`Away Assists`)
home_rebounds <- sum(home_games$`Home Rebounds`)
away_rebounds <- sum(away_games$`Away Rebounds`)
# Create a data frame for the team.
team_summary <- rbind(team_summary, data.frame(Team = team, HomeGames = home_games_count, AwayGames = away_games_count,
HomeWins = home_wins, HomeLosses = home_losses, AwayWins = away_wins, AwayLosses = away_losses,
HomePoints = home_points, AwayPoints = away_points, HomeAssists = home_assists, AwayAssists = away_assists,
HomeRebounds = home_rebounds, AwayRebounds = away_rebounds))
}
team_summary <- as_tibble(team_summary)
# PART C
# 1)
# We will now create a new column in the team_summary data frame for the total number of games.
team_summary <- team_summary %>% mutate(TotalGames = HomeGames + AwayGames)
# 2)
# We will now create a new column in the team_summary data frame for the total number of wins.
team_summary <- team_summary %>% mutate(TotalWins = HomeWins + AwayWins)
# 3)
# We will now create a new column in the team_summary data frame for the win percentage.
team_summary <- team_summary %>% mutate(WinPercentage = TotalWins / TotalGames)
# 4)
# We will now create a new column in the team_summary data frame for the total number of points.
team_summary <- team_summary %>% mutate(TotalPoints = HomePoints + Away
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved.
Printed in the United States of America. Except as permitted under the United States
Copyright Act of 1976, no part of this publication may be reproduced or distributed
in any form or by any means, or stored in a database or retrieval system, without the
prior written permission of the publisher.
1 2 3 4 5 6 7 8 9 0 DOC/DOC 0 9 8 7 6
ISBN 0-07-145806-0
This publication is designed to provide accurate and authoritative information in
regard to the subject matter covered. It is sold with the understanding that the
publisher is not engaged in rendering legal, accounting, or other professional service.
If legal advice or other expert assistance is required, the services of a competent
professional person should be sought.
—From a Declaration of Principles jointly adopted by a Committee of the
American Bar Association and a Committee of Publishers
McGraw-Hill books are available at special quantity discounts to use as premiums
and sales promotions, or for use in corporate training programs. For more informa-
tion, please write to the Director of Special Sales, Professional Publishing,
McGraw-Hill, Two Penn Plaza, New York, NY 10121-2298. Or contact your local
bookstore.
This book is printed on acid-free paper.
Contents
Preface ix
Acknowledgments xiii
Introduction xv
Part 1 Getting Started with XML 1
Chapter 1 Understanding XML: The Language of Content 3
Introducing XML: What Is It? 4
XML: A Brief History 4
XML and HTML: How They Differ 7
XML: A Simple Example 8
XML and Other Technologies 10
XML: The Big Picture 13
Summary 17
Chapter 2 XML Uses: The Scope of XML 19
Document Publishing 20
Web Services 25
Content Management 28
Application Development 30
Summary 34
Chapter 3 XML Document Analysis: The Critical First Step 35
Why Document Analysis Is Important 36
The Process of Document Analysis 36
Document Analysis Tools 49
Summary 52
vi Contents
Part 2 XML Markup 55
Chapter 4 XML Syntax: The Basic Components 57
XML Document Structure 58
Elements 59
Attributes 67
Entities 71
Comments 76
Processing Instructions 77
Summary 78
Chapter 5 XML Structure: Organizing Data 81
Choosing When to Use Elements and Attributes 82
Nesting Elements 91
Grouping Elements 94
Naming Rules 97
Summary 99
Chapter 6 XML Namespaces: The Name Game 101
Namespace Basics 102
Multiple Namespaces 105
Default Namespaces 108
Summary 110
Chapter 7 XML Schemas: Creating Data Models 111
Schema Basics 112
Element and Attribute Declarations 114
Simple and Complex Types 117
Named Types 121
Content Models 125
Advanced Features 128
Summary 131
Chapter 8 XML DTDs: The Original Schema 133
DTD Basics 134
Element Declarations 137
Attribute Declarations 141
Entities 144
Limitations of DTDs 147
Schemas vs. DTDs 148
Summary 149
Part 3 Presenting and Using XML 151
Chapter 9 XML and Cascading Style Sheets (CSS): The Presentation Layer 153
CSS Basics 154
CSS and XML 157
CSS Properties 161
Example: A CSS Stylesheet 164
Summary 168
Contents vii
Chapter 10 XSLT: Transforming XML 169
XSLT Basics 170
XSLT Templates 174
XPath 179
Example: An XSLT Stylesheet 185
Summary 189
Chapter 11 XPath and XPointer: Finding Your Way 191
The XPath Data Model 192
XPath Expressions 195
XPath Functions 200
XPath Axes 202
XPointer 206
Summary 209
Chapter 12 XLink: Linking in XML 211
Link Basics 212
Extended Links 217
Summary 220
Chapter 13 XHTML: The Next Generation of HTML 221
What Is XHTML? 222
Converting HTML to XHTML 226
XHTML Modularization 234
Summary 236
Chapter 14 XForms: The Next Generation of Web Forms 237
What Are XForms? 238
XForms Processors 239
XForms Documents 240
XForms Elements 242
Summary 251
Part 4 XML Applications 253
Chapter 15 XML and Web Services: The Future of the Web 255
Web Services Basics 256
SOAP 259
WSDL 263
UDDI 268
Summary 270
Chapter 16 XML and Content Management: The Information Lifecycle 271
What Is Content? 272
Content Management Basics 273
Content Management Systems 278
XML and Content Management 280
Summary 284
viii Contents
Chapter 17 XML and Databases: Storing and Retrieving Information 285
Structured and Unstructured Data 286
XML and Relational Databases 287
XML-Enabled Databases 291
Native XML Databases 293
Summary 297
Chapter 18 XML and Applications: The Big Picture 299
Application Development 300
XML Development Tools 304
XML and Programming Languages 307
XML and Java 307
XML and .NET 312
Summary 316
Appendix A XML Resources 317
XML Resources on the Web 317
XML Tools 319
XML Books 320
Appendix B XML Glossary 323
Index 331
# Preface
This book is about XML, the eXtensible Markup Language. As a markup language, it allows you to create your own “tags” to describe the content of a document. As an extensible language, it allows you to define your own set of tags, and you are not limited by a fixed set of tags like HTML.
XML is a powerful technology. It is a simple and flexible text format that is playing an increasingly important role in the exchange of a wide variety of data on the Web and elsewhere. XML is a key technology in the development of the next generation of Web applications.
XML is also a very complex technology. It is a family of technologies, including XML itself, XML Schema, XSLT, XPath, XLink, XPointer, and others. It is also a foundation technology for a wide range of applications, including Web services, content management, and application development.
This book is designed to help you understand XML and how it works. It is intended for anyone who wants to learn about XML, whether you are a Web developer, a content manager, an application developer, or just someone who wants to understand what XML is all about.
This book is not a reference book. It is a tutorial that will teach you the basics of XML and how to use it. It is not a book about a specific XML application, such as Web services or content management. Instead, it is a book about XML itself, and how it can be used in a wide range of applications.
This book is divided into four parts:
- Part 1: Getting Started with XML
- Part 2: XML Markup
ix
X Preface
• Part 3: Presenting and Using XML
• Part 4: XML Applications
Part 1 introduces XML and explains what it is and how it is used. It also covers the important topic of document analysis, which is the first step in creating any XML document.
Part 2 covers the basics of XML markup, including elements, attributes, and entities. It also covers XML structure, namespaces, and schemas.
Part 3 covers the presentation and use of XML, including CSS, XSLT, XPath, XPointer, XLink,
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved.
Printed in the United States of America. Except as permitted under the United States
Copyright Act of 1976, no part of this publication may be reproduced or distributed
in any form or by any means, or stored in a database or retrieval system, without the
prior written permission of the publisher.
1 2 3 4 5 6 7 8 9 0 DOC/DOC 0 9 8 7 6
ISBN 0-07-145806-0
This publication is designed to provide accurate and authoritative information in
regard to the subject matter covered. It is sold with the understanding that the
publisher is not engaged in rendering legal, accounting, or other professional
service. If legal advice or other expert assistance is required, the services of a competent
professional person should be sought.
—From a Declaration of Principles jointly adopted by a Committee of the
American Bar Association and a Committee of Publishers
McGraw-Hill books are available at special quantity discounts to use as premiums
and sales promotions, or for use in corporate training programs. For more
information, please write to the Director of Special Sales, Professional Publishing,
McGraw-Hill, Two Penn Plaza, New York, NY 10121-2298. Or contact your local
bookstore.
This book is printed on acid-free paper.
Contents
Preface ix
Acknowledgments xiii
Introduction xv
Part 1 Getting Started with XML 1
Chapter 1 Understanding XML: The Language of Content 3
Introducing XML: What Is It? 4
XML: A Brief History 4
XML and HTML: How They Differ 7
XML: A Simple Example 8
XML and Other Technologies 10
XML: The Big Picture 13
Summary 17
Chapter 2 XML Uses: The Scope of XML 19
Document Publishing 20
Web Services 25
Content Management 28
Application Development 30
Summary 34
Chapter 3 XML Document Analysis: The Critical First Step 35
Why Document Analysis Is Important 36
The Process of Document Analysis 36
Document Analysis Tools 49
Summary 52
Part 2 XML Markup 55
Chapter 4 XML Syntax: The Basic Components 57
XML Document Structure 58
Elements 59
Attributes 67
Entities 71
Comments 76
Processing Instructions 77
Summary 78
Chapter 5 XML Structure: Organizing Data 81
Choosing When to Use Elements and Attributes 82
Nesting Elements 91
Grouping Elements 94
Naming Rules 97
Summary 99
Chapter 6 XML Namespaces: The Name Game 101
Namespace Basics 102
Multiple Namespaces 105
Default Namespaces 108
Summary 110
Chapter 7 XML Schemas: Creating Data Models 111
Schema Basics 112
Element and Attribute Declarations 114
Simple and Complex Types 117
Named Types 121
Content Models 125
Advanced Features 128
Summary 131
Chapter 8 XML DTDs: The Original Schema 133
DTD Basics 134
Element Declarations 137
Attribute Declarations 141
Entities 144
Limitations of DTDs 147
Schemas vs. DTDs 148
Summary 149
Part 3 Presenting and Using XML 151
Chapter 9 XML and Cascading Style Sheets (CSS): The Presentation Layer 153
CSS Basics 154
CSS and XML 157
CSS Properties 161
Example: A CSS Stylesheet 164
Summary 168
Chapter 10 XSLT: Transforming XML 169
XSLT Basics 170
XSLT Templates 174
XPath 179
Example: An XSLT Stylesheet 185
Summary 189
Chapter 11 XPath and XPointer: Finding Your Way 191
The XPath Data Model 192
XPath Expressions 195
XPath Functions 200
XPath Axes 202
XPointer 206
Summary 209
Chapter 12 XLink: Linking in XML 211
Link Basics 212
Extended Links 217
Summary 220
Chapter 13 XHTML: The Next Generation of HTML 221
What Is XHTML? 222
Converting HTML to XHTML 226
XHTML Modularization 234
Summary 236
Chapter 14 XForms: The Next Generation of Web Forms 237
What Are XForms? 238
XForms Processors 239
XForms Documents 240
XForms Elements 242
Summary 251
Part 4 XML Applications 253
Chapter 15 XML and Web Services: The Future of the
2026-05-11 07:51:08
♋ Cancer Man
The Cancer man is ruled by the Moon, making him deeply intuitive, nurturing, and sensitive. He values emotional security, home, and family above all else.
His protective shell hides a warm, loyal heart. In love, he is devoted and seeks a profound, soulful connection.
Nurturing and empathetic
Seeks emotional depth and security
Loyal and fiercely protective
Can be moody and introspective
Expresses love through care and memory
♈ Aries Woman
The Aries woman, ruled by Mars, is a born pioneer. She is fearless, independent, and radiates dynamic energy. She loves challenges and lives in the moment.
Her direct and passionate nature can be both inspiring and overwhelming. She desires a partner who respects her autonomy and matches her zest for life.
Bold, courageous, and independent
Natural leader and initiator
Enthusiastic and optimistically direct
Impulsive and loves a good challenge
Protective of those she loves
Cosmic Connection
This pairing is a fascinating blend of Water and Fire . The Cancer man offers the Aries woman the emotional sanctuary and unwavering loyalty she often secretly craves. In return, her fiery spirit pulls him out of his shell, adding excitement and spontaneity to his life.
Challenges may arise from their differing paces: Aries charges ahead, while Cancer reflects and feels. Yet, if they learn to communicate—her with a touch more sensitivity, him with a bit more boldness —they can build a relationship where her flame warms his waters, and his depth gives her fire a lasting hearth.
2026-05-11 07:51:08
♈︎
Symbol & Element
The Ram embodies initiative, courage, and a head-first approach to life.
Element: Fire – Passionate, energetic, and spontaneous.
Key Personality Traits
Courageous & Adventurous
Confident & Enthusiastic
Honest & Direct
Competitive & Energetic
Impulsive & Short-tempered
💖 Love & Compatibility
Aries men are passionate and straightforward partners. They love the chase and admire independence. Best matches are often with fellow fire signs Leo and Sagittarius , or the air sign Gemini .
💼 Career & Goals
Natural leaders and entrepreneurs. They thrive in competitive fields, startups, or any role where they can take initiative and see immediate results. Boredom is their biggest enemy.
✨ Strengths & Spirit
Their strength lies in their incredible drive and optimism. They are the initiators of the zodiac, unafraid to start new projects or defend what they believe in with fiery passion.
"The Aries man doesn't wait for opportunity. He charges at it, head-on."
2026-05-11 07:51:08