Download presentation
Presentation is loading. Please wait.
Published byDennis Clark Modified over 9 years ago
1
XML Fundamentals, Namespaces Data Warehousing Lab. 박유림
2
2 DW XML Fundamentals 1. HTML vs XML 1. Html: limited to about a hundred predefined tags 2. XML : you can create as many tags as you need 2. XML is looser than HTML in regards to which tags it allows, it is much stricter about where those tags are placed and how they ’ re written. 3. Easy & Flexibility
3
3 Data Warehousing Lab. DW XML Documents and XML Files 1. XML document contains text, never binary data. 1. Ex)file name: person.xml<person> Alan Turing </person> 2. Your operating system may or may not like these names, but an XML parser won ’ t care.
4
4 Data Warehousing Lab. DW Elements, Tags, and Character Data 1. Element ’ s content, Markup, Character data Alan Turing Alan Turing</person> 1. Everything between the start-tag and the end-tag of the element : element ’ s content 2. Markup 3. Character data 2. Tag Syntax 1. Empty elements : ex) 1. Empty elements : ex) 2. Case sensitivity :
5
5 Data Warehousing Lab. DW XML Trees <person><name><first_name>Alan</first_name><first_name>Turing</last_name></name> computer scientist computer scientist <profession>mathematician</profession><profession>cryptographer</profession></person> Parents and children : one parent element Parents and children : one parent element The root element : contains all other elements The root element : contains all other elements
6
6 Data Warehousing Lab. DW XML Name & Entity References … I 1. XML name 2. Entity References 3. CDATA Sections 1. 4. Comments 1. 2. -- should not appear anywhere inside the comment until the closing
7
7 Data Warehousing Lab. DW XML Name & Entity References … II 1. Processing Instructions. 1. Processing instruction as an alternative means of passing information to particular applications that may read the document 2. Alan turing </person> 2. XML Declaration 1. XML declaration looks like a processing instruction with the name xml and version, standalone, and encoding attributes.
8
8 Data Warehousing Lab. DW XML Name & Entity References … III 1. XML Declaration Alan turing </person> Alan turing </person>
9
9 Data Warehousing Lab. DW Checking Documents for Well- Formedness 1. Every start-tag must have a matching end-tag 2. Elements may nest, but may not overlap 3. There must be exactly one root element 4. Attribute values must be quoted 5. An element may not have two attributes with the same name 6. Comments and processing instructions may not appear inside tags 7. No unescaped < or & signs may occur in the character data of an element or attribute
10
10 Data Warehousing Lab. DW Namespaces 1. Purpose 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. vs 2. Namespace Syntax 1. Qualified Names, Prefixes, and Local Parts 1. Ex) rdf : description xlink : type
11
11 Data Warehousing Lab. DW Binding Prefixes to URI 1. Binding 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/ ” about= “ http://www.cafeconleche.org/examples/impressionists.xml ” >
12
12 Data Warehousing Lab. DW Namespaces and DTDs A document can have a DTD but not use namespaces or use namespaces but not have a DTD. A document can have a DTD but not use namespaces or use namespaces but not have a DTD. The name of the element in the document must exactly match the name of the element in the DTD including the prefix. The name of the element in the document must exactly match the name of the element in the DTD including the prefix.
13
13 Data Warehousing Lab. DW Namespace 1. Purposes 1. 둘 이상의 소스로부터 문서들을 조합해 낼 수 있으며, 여러 소스들이 섞인다고 해도 특성 요소나 어떤 소스로부터 왔는지를 식별해낼 수 있습니다. 2. 사용자 에이전트가 DTD 나 기타요소, 특성 안에 대한 명세 등의 추가적인 자료들을 사용하도록 만드는 것이 가능합니다. 2. XML 문서에서 요소나 특성의 이름으로 쓰일 수 있는 이름들의 집합입니다.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.