XML Fundamentals, Namespaces Data Warehousing Lab. 박유림.
-
Upload
dennis-clark -
Category
Documents
-
view
221 -
download
4
Transcript of XML Fundamentals, Namespaces Data Warehousing Lab. 박유림.
![Page 1: XML Fundamentals, Namespaces Data Warehousing Lab. 박유림.](https://reader036.fdocuments.net/reader036/viewer/2022082517/56649edb5503460f94bebac6/html5/thumbnails/1.jpg)
XML Fundamentals , Namespaces
Data Warehousing Lab.Data Warehousing Lab.
박유림박유림
![Page 2: XML Fundamentals, Namespaces Data Warehousing Lab. 박유림.](https://reader036.fdocuments.net/reader036/viewer/2022082517/56649edb5503460f94bebac6/html5/thumbnails/2.jpg)
2Data Warehousing
Lab.DW
XML Fundamentals
1.1. HTML vs XML HTML vs XML
1. Html: limited to about a hundred predefined tags
2. XML : you can create as many tags as you need
2.2. XML is looser than HTML in regards to which tags it XML is looser than HTML in regards to which tags it allows, it is much stricter about where those tags allows, it is much stricter about where those tags are placed and how they’re written.are placed and how they’re written.
3.3. Easy & Flexibility Easy & Flexibility
![Page 3: XML Fundamentals, Namespaces Data Warehousing Lab. 박유림.](https://reader036.fdocuments.net/reader036/viewer/2022082517/56649edb5503460f94bebac6/html5/thumbnails/3.jpg)
3Data Warehousing
Lab.DW
XML Documents and XML Files
1.1. XML document contains text, never binary data.XML document contains text, never binary data.
1. Ex)file name: person.xml
<person> <person>
Alan Turing Alan Turing
</person></person>
2.2. Your operating system may or may not like these Your operating system may or may not like these names, but an XML parser won’t care.names, but an XML parser won’t care.
![Page 4: XML Fundamentals, Namespaces Data Warehousing Lab. 박유림.](https://reader036.fdocuments.net/reader036/viewer/2022082517/56649edb5503460f94bebac6/html5/thumbnails/4.jpg)
4Data Warehousing
Lab.DW
Elements, Tags, and Character Data
1.1. Element’s content, Markup, Character dataElement’s content, Markup, Character data<<person>person>
Alan TuringAlan Turing
</person></person>
1. Everything between the start-tag and the end-tag of the element : element’s content
2. Markup
3. Character data
2.2. Tag Syntax Tag Syntax
1. Empty elements : ex) <br><hr></hr></br>1. Empty elements : ex) <br><hr></hr></br>
2. Case sensitivity : <PERSON> <person>
![Page 5: XML Fundamentals, Namespaces Data Warehousing Lab. 박유림.](https://reader036.fdocuments.net/reader036/viewer/2022082517/56649edb5503460f94bebac6/html5/thumbnails/5.jpg)
5Data Warehousing
Lab.DW
XML Trees
<person><person>
<name><name>
<first_name>Alan</first_name><first_name>Alan</first_name>
<first_name>Turing</last_name><first_name>Turing</last_name>
</name></name>
<profession>computer scientist</profession><profession>computer scientist</profession>
<profession>mathematician</profession><profession>mathematician</profession>
<profession>cryptographer</profession><profession>cryptographer</profession>
</person></person>
Parents and children : one parent elementParents and children : one parent element The root element : contains all other elementsThe root element : contains all other elements
![Page 6: XML Fundamentals, Namespaces Data Warehousing Lab. 박유림.](https://reader036.fdocuments.net/reader036/viewer/2022082517/56649edb5503460f94bebac6/html5/thumbnails/6.jpg)
6Data Warehousing
Lab.DW
XML Name & Entity References… I
1.1. XML name XML name
2.2. Entity ReferencesEntity References
3.3. CDATA SectionsCDATA Sections
1. <!CDATA[ and ]]>
4.4. CommentsComments
1. <!-- This is comment text -->
2. -- should not appear anywhere inside the comment until the closing
![Page 7: XML Fundamentals, Namespaces Data Warehousing Lab. 박유림.](https://reader036.fdocuments.net/reader036/viewer/2022082517/56649edb5503460f94bebac6/html5/thumbnails/7.jpg)
7Data Warehousing
Lab.DW
XML Name & Entity References… II
1.1. Processing Instructions.Processing Instructions.
1. Processing instruction as an alternative means of passing information to particular applications that may read the document
2. <?xml-stylesheet href=“person.css” type=“text/css”?>
<<person>person>
Alan turingAlan turing
</person></person>
2.2. XML DeclarationXML Declaration
1. XML declaration looks like a processing instruction with the name xml and version, standalone, and encoding attributes.
![Page 8: XML Fundamentals, Namespaces Data Warehousing Lab. 박유림.](https://reader036.fdocuments.net/reader036/viewer/2022082517/56649edb5503460f94bebac6/html5/thumbnails/8.jpg)
8Data Warehousing
Lab.DW
XML Name & Entity References… III
1.1. XML DeclarationXML Declaration
<? xml version=“1.0” encoding=“ASCII” standalone=“yes”?>
<person>
Alan turingAlan turing
</person></person>
<?xml-stylesheet href=“person.css” type=“text/css”?>
<<person>person>
Alan turingAlan turing
</person></person>
![Page 9: XML Fundamentals, Namespaces Data Warehousing Lab. 박유림.](https://reader036.fdocuments.net/reader036/viewer/2022082517/56649edb5503460f94bebac6/html5/thumbnails/9.jpg)
9Data Warehousing
Lab.DW
Checking Documents for Well-Formedness
1.1. Every start-tag must have a matching end-tagEvery start-tag must have a matching end-tag
2.2. Elements may nest, but may not overlapElements may nest, but may not overlap
3.3. There must be exactly one root elementThere must be exactly one root element
4.4. Attribute values must be quotedAttribute values must be quoted
5.5. An element may not have two attributes with the An element may not have two attributes with the same namesame name
6.6. Comments and processing instructions may not Comments and processing instructions may not appear inside tagsappear inside tags
7.7. No unescaped < or & signs may occur in the No unescaped < or & signs may occur in the character data of an element or attributecharacter data of an element or attribute
![Page 10: XML Fundamentals, Namespaces Data Warehousing Lab. 박유림.](https://reader036.fdocuments.net/reader036/viewer/2022082517/56649edb5503460f94bebac6/html5/thumbnails/10.jpg)
10Data Warehousing
Lab.DW
Namespaces
1.1. Purpose in XMLPurpose in XML
1. To distinguish between elements and attributes from different vocabularies with different meanings and that happen to share the same name
2. To group all the related elements and attributes from a single XML application together so that software can easily recognize them.
3. <a:title> vs <b:title>
2.2. Namespace SyntaxNamespace Syntax
1. Qualified Names, Prefixes, and Local Parts
1.1. Ex) rdf : descriptionEx) rdf : description
xlink : type
![Page 11: XML Fundamentals, Namespaces Data Warehousing Lab. 박유림.](https://reader036.fdocuments.net/reader036/viewer/2022082517/56649edb5503460f94bebac6/html5/thumbnails/11.jpg)
11Data Warehousing
Lab.DW
Binding Prefixes to URI
1.1. Binding prefixes to uriBinding prefixes to uri
1. Each prefix in a qualified name must be associated with a URI.
2. Ex)
<rdf:Description xmlns:dc=“http://purl.org/dc/” <rdf:Description xmlns:dc=“http://purl.org/dc/”
about=“http://www.cafeconleche.org/examples/about=“http://www.cafeconleche.org/examples/impressionists.xml”> impressionists.xml”>
![Page 12: XML Fundamentals, Namespaces Data Warehousing Lab. 박유림.](https://reader036.fdocuments.net/reader036/viewer/2022082517/56649edb5503460f94bebac6/html5/thumbnails/12.jpg)
12Data Warehousing
Lab.DW
Namespaces and DTDs
A document can have a DTD but not use A document can have a DTD but not use namespaces or use namespaces but not namespaces or use namespaces but not have a DTD.have a DTD.
The name of the element in the The name of the element in the document must exactly match the name document must exactly match the name of the element in the DTD including the of the element in the DTD including the prefix.prefix.
![Page 13: XML Fundamentals, Namespaces Data Warehousing Lab. 박유림.](https://reader036.fdocuments.net/reader036/viewer/2022082517/56649edb5503460f94bebac6/html5/thumbnails/13.jpg)
13Data Warehousing
Lab.DW
Namespace
1.1. PurposesPurposes
1. 둘 이상의 소스로부터 문서들을 조합해 낼 수 있으며 , 여러 소스들이 섞인다고 해도 특성 요소나 어떤 소스로부터 왔는지를 식별해낼 수 있습니다 .
2. 사용자 에이전트가 DTD 나 기타요소 , 특성 안에 대한 명세 등의 추가적인 자료들을 사용하도록 만드는 것이 가능합니다 .
2.2. XMLXML 문서에서 요소나 특성의 이름으로 쓰일 수 있는 이름들의 문서에서 요소나 특성의 이름으로 쓰일 수 있는 이름들의 집합입니다집합입니다 ..