TAILIEUCHUNG - Rails for Java Developers phần 9

Ruby được xem là một ngôn ngữ lập trình đa mẫu hình (multi-paradigm programming language): nó cho phép bạn lập trình dạng thủ tục (tạo ra các hàm/biến nằm ngoài phạm vi của các lớp và biến chúng thành một phần của đối tượng gốc, 'self' Object), | YAML AND XML Compared 262 XML is intended to be human-readable and self-describing. XML is human-readable because it is a text format and it is self-describing because data is described by elements such as user username elements and homepage in the preceding example. Another option for representing usernames and home pages would be XML attributes user username stu homepage http user The attribute syntax is obviously more terse. It also implies semantic differences. Attributes are unordered while elements are ordered. Attributes are also limited in the values they may contain Some char -acters are illegal and attributes cannot contain nested data elements on the other hand can nest arbitrarily deep . There is one last wrinkle to consider with this simple XML document. What happens when it travels in the wide world and encounters other elements named user To prevent confusion XML allows namespaces. These serve the same role as Java packages or Ruby modules namespaces but the syntax is different rel user xmlns rel http sample username stu homepage http rel user The namespace is http sample. That would be a lot to type in front of an element name so xmlns rel establishes rel as a prefix. Reading the previous document an XML wonk would say that user is in the http sample namespace. YAML is a response to the complexity of XML YAML stands for YAML Ain t Markup Language . YAML has many things in common with XML. Most important both YAML and XML can be used to represent and serialize complex nested data structures. What special advantages does YAML offer The YAML criticism of XML boils down to a single sentence. XML has two concepts too many There is no need for two different forms of nested data. Elements are enough. There is no need for a distinct namespace concept scoping is sufficient for namespacing. To see why attributes and namespaces are superfluous in YAML .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.