1. Trang chủ
  2. » Công Nghệ Thông Tin

OReilly learning XML 2nd edition sep 2003 ISBN 0596004206

691 56 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 691
Dung lượng 4,03 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

area model authoring character escaping CSS describing documents media DTDs flow linked objects metadata transformation default rules elements executing formatting

Trang 1

[ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [J] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ]

Java, SAX (Simple API for XML) 2nd

JDOM (Java DOM)

[ Team LiB ]

Trang 2

Like the book? Buy it!

Trang 3

[A] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ]

Trang 4

[ A ] [B] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ]

Trang 5

[ A ] [ B ] [C] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ]

Trang 7

cross references

CSS (Cascading Style Sheets) 2nd box model

Trang 8

[ A ] [ B ] [ C ] [D] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ]

Trang 9

area model

authoring

character escaping CSS

describing documents media

DTDs

flow

linked objects metadata

transformation

default rules elements

executing

formatting

history of

matching nodes modularity

types of nodes viewing

Trang 10

DTD [See Document Type Definition] [ Team LiB ]

Trang 11

[ A ] [ B ] [ C ] [ D ] [E] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ]

Trang 12

external references

external subsets 2nd

[ Team LiB ]

Trang 13

[ A ] [ B ] [ C ] [ D ] [ E ] [F] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ]

Trang 14

[ Team LiB ]

Trang 15

[ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [G] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ]

Trang 16

[ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [H] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ]

Trang 17

[ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [I] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ]

Trang 18

[ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [K] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ]

Konquerer

[ Team LiB ]

Trang 19

[ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [L] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ]

Trang 20

[ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [M] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ]

Trang 22

[ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [N] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ]

Trang 23

none

nonelement content descriptors notations

PYX

number expressions 2nd numbered character references numeric references

numeric text, formatting

numeric values, counters [ Team LiB ]

Trang 24

[ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [O] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ]

Trang 25

[ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [P] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ]

Trang 27

PSVI (Post Schema Validation Infoset) PUBLIC identifier

Trang 28

[ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [Q] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ]

Trang 29

[ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [R] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ]

Trang 30

RGB (red, green, and blue) roles

Trang 31

[ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [S] [ T ] [ U ] [ V ] [ W ] [ X ]

Trang 34

[ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [T] [ U ] [ V ] [ W ] [ X ]

Trang 36

[ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [U] [ V ] [ W ] [ X ]

Trang 37

[ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [V] [ W ] [ X ]

Trang 38

[ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [W] [ X ]

Trang 39

[ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [X]

Trang 40

TEI-XML

XSLT (Extensible Stylesheet Language Transformation) 2nd 3rd elements

Trang 41

The Simple API for XML (SAX) is one of the first and currentlythe most popular method for working with XML data It evolvedfrom discussions on the XML-DEV mailing list and, shepherded

"SAX."

SAX was originally developed in Java in a package called

org.xml.sax As a consequence, most of the literature aboutSAX is Java-centric and assumes that is the environment youwill be working in Furthermore, there is no formal specificationfor SAX in any programming language but Java Analogs inother languages exist, such as XML::SAX in Perl, but they arenot bound by the official SAX description Really they are justwhatever their developer community thinks they should be

David Megginson has made SAX public domain and has allowed anyone

to use the name An unfortunate consequence is that many implementations are really just "flavors" of SAX and do not match in every detail This is especially true for SAX in other programming languages where the notion of strict compliance would not even make sense This is kind of like the plethora of Unix flavors out today; they seem much alike, but have some big differences under the surface.

Trang 42

Figure 10-1 ParserFactory

The workhorse of SAX is the SAX driver A SAX driver is any program that implements the SAX2 XMLReader interface It

may include a parser that reads XML directly, or it may just be awrapper for another parser to adapt it to the interface It mayeven be a converter, transmuting data of one kind (say, SQLqueries) into XML From your program's point of view, the

source doesn't matter, because it is all packaged in the sameway

The SAX driver calls subroutines that you supply to handle

various events These call-backs fall into four categories,

usually grouped into objects:

Document handler

Trang 43

DTD handler

Error handler

To use a SAX driver, you need to create some or all of thesehandler classes and pass them to the driver so it can call theircall-back routines The document handler is the minimal

requirement, providing methods that deal with element tags,attributes, processing instructions, and character data Theothers override default behavior of the core API To ensure thatyour handler classes are written correctly, the Java version of

SAX includes interfaces, program constructs that describe

methods to be implemented in a class

The characters method of the content handler may be called multiple times for the same text node, as SAX drivers are allowed to split text into smaller pieces Your code will need to anticipate this and stitch text together if necessary.

The entity resolver overrides the default method for resolvingexternal entity references Ordinarily, it is assumed that youjust want all external entity references resolved automatically,and the driver tries to comply, but in some cases, entity

resolution has to be handled specially For example, a resourcelocated in a database would require that you write a routine toextract the data, since it is an application-specific process

The core API doesn't create events for lexical structures likeCDATA sections, comments, and DOCTYPE declarations If yourenvironment provides the DTD handling extension, you canwrite a handler for that If not, then you should just assumethat the CDATA sections are treated as regular character data,comments are stripped out, and DOCTYPE declarations are out

Trang 44

}

Trang 48

structures, which brings us to the next topic, the tree

processing API known as DOM

Trang 49

SAX (Simple API for XML)

An event-driven application programming interface for

manipulating XML documents with Java The API describes aflat document model (no object hierarchy or inheritance)that then allows for quick document processing

scheme

A prefix to a URL that establishes the address pattern andprotocol to be used For example, the prefix http specifiesthat the hypertext transfer protocol is to be used, as in thefollowing URL:

Trang 50

simple link

The simplest form of a link, consisting of an element in adocument (the local resource) that specifies a target or the

of a document There are several standards for stylesheets,including CSS, XSLT, and XSL-FO

SYSTEM identifier

A local, system-dependent identifier for a document, DTD,

or external entity In XML, a system identifier must be a

Trang 51

URI.

Trang 52

As XML has spread, more and more people have had creative(and often useful) ideas about how to process it

10.10.1 XPath as API

The XPath language provides a convenient method to specifywhich nodes to return in a tree context A parser written as ahybrid will only need to return a list of nodes that match an

XPath expression A stream parser efficiently searches throughthe document to find the nodes, then passes the locations to atree builder that assembles them into object trees XPath's

advantage is that it is has a very rich language for specifyingnodes, giving the developer a lot of control and flexibility Theparsers libxml2 and MSXML are two that come with XPath

interfaces

10.10.2 JDOM

Despite the name, JDOM is not merely a Java implementation ofDOM Rather, it is an alternative to SAX and DOM that is

described by its developers as "lightweight and fast

optimized for the Java programmer." It doesn't actually replaceother parsers, but uses them to build object representations ofdocuments with an interface that is easy to manipulate It isdesigned to integrate with SAX and DOM, supplying a simpleand useful interface layer on top

The proponents of JDOM say it is needed to reduce the

complexity of the factory-based specifications for SAX and DOM.For that reason, the JDOM specification itself is defined with

Trang 53

10.10.3 Hybrids

If streams and trees are the two extremes on a spectrum ofXML processing techniques, then the middle ground is home to

10.10.4 Data Binding

Some developers don't need direct access to XML documentstructuresthey just want to work with objects or other data

structures Data binding approaches minimize the amount ofinteraction between the developer and the XML itself Instead ofcreating XML directly, an API takes an object and serializes it.Instead of reading an XML document and interpreting its parts,

an API takes an XML document and presents it as an object

Data binding processing tends to focus on schemas, which are

Trang 54

technologies for using XML to send information over a networkbetween programs

There are a variety of data binding implementations available,largely for the Java and NET platforms

Trang 55

absolute location term

A term that completely identifies the location of a resourcevia XPointer A unique ID attribute assigned to an element

signal from a human

application

This word has different meanings in different contexts Inthe context of XML, an application is usually a specific

markup language based on XML rules DocBook is one

example of an XML application

Trang 56

application is a high-level program for users, such as a webbrowser, word processor, or spreadsheet manipulator Inother words, it's an application of the computer system

Trang 57

also element, markup.

Trang 58

The three levels of CSS define so many properties, I can't coverthem all here There are over 120 in level 2 alone Instead, I'llcover the basic categories you are likely to encounter and leavemore exhaustive descriptions to books specializing on the topic

5.4.1 Inheritance

CSS properties can be passed down from a container element toits child This inheritance principle greatly simplifies stylesheetdesign For example, in the document element rule, you can set

a font family that will be used throughout the document

Wherever you want to use a different family, simply insert anew property for a rule and it will override the global setting

In Figure 5-9, a para inherits some properties from a section,which in turn inherits from an article The properties font-family and color are defined in the property set for article,and inherited by both section and para The property font-size is not inherited by section because section's explicit

setting overrides it para does inherit this property from

section

Figure 5-9 Element-inheriting properties

Trang 59

background-image property, which causes an image to be

loaded and displayed in the background, is not inherited Ifevery element did inherit this property, the result would be acomplete mess, with every paragraph and inline element trying

to display its own copy of the image in its rectangular area Itlooks much better if only one element has this property and itschildren don't Display type and margins are other examples

You can measure an absolute length with a ruler because theunits never change A millimeter is the same no matter whatfont you're using or which language you're speaking Absolute

Trang 60

Relative units are nonfixed, scaling values that depend on someother measurement For example, an em is defined as the size

Relative measurements can also be expressed as percentages.This type of measurement relies on another element's value ofthe same property For example:

b { font-size: 200% }

means that the b element has a font size that is twice its

parent's

In general, relative measurements are better than absolute.Relative units don't have to be rewritten when you adjust thedefault properties It's much easier to write a stylesheet formultiple scenarios when you define the base size in only oneplace, and everything else is relative

Trang 61

content preceding and following it by spacing It begins on anew line, often after some whitespace, and it has

boundaries (called margins) that keep the text in the

rectangular shape The text wraps at the margin, meaning

it stops and then restarts on the next line Blocks can

contain other, smaller blocks, as well as inlines Examples ofblocks in traditional documents are paragraphs, titles, andsections

inline

An inline is content that doesn't interrupt the flow of text in

a block It wraps at the margin of the block it resides in likeordinary character data It can set properties that don't

affect the flow, such as font-family and color, but cannothave properties related to blocks, such as text alignmentand text indentation Examples of inlines are emphasis,

keywords, and hypertext links

none

Any element defined as display: none will be skipped bythe CSS processor It's a convenient way to "turn off" largeportions of a document for faster processing It also

Trang 62

Around every block is an invisible box that shapes its contentand keeps a healthy distance from its neighbors Figure 5-10

four widths called margins.

Figure 5-10 The CSS box model

A block's boundaries hold content while separating the blockfrom sibling blocks Any background image or color is confined

Ngày đăng: 26/03/2019, 17:07

TỪ KHÓA LIÊN QUAN