Skip to Content
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
Explore Skills
Cloud Computing
Microsoft Azure
Amazon Web Services (AWS)
Google Cloud
Cloud Migration
Cloud Deployment
Cloud Platforms
Data Engineering
Data Warehouse
SQL
Apache Spark
Microsoft SQL Server
MySQL
Kafka
Data Lake
Streaming & Messaging
NoSQL Databases
Relational Databases
Data Science
Pandas
R
MATLAB
SAS
D3
Power BI
Tableau
Statistics
Exploratory Data Analysis
Data Visualization
AI & ML
Generative AI
Machine Learning
Artificial Intelligence (AI)
Deep Learning
Reinforcement Learning
Natural Language Processing
TensorFlow
Scikit-Learn
Hyperparameter Tuning
MLOps
Programming Languages
Java
JavaScript
Spring
Python
Go
C#
C++
C
Swift
Rust
Functional Programming
Software Architecture
Object-Oriented
Distributed Systems
Domain-Driven Design
Architectural Patterns
IT/Ops
Kubernetes
Docker
GitHub
Terraform
Continuous Delivery
Continuous Integration
Database Administration
Computer Networking
Operating Systems
IT Certifications
Security
Network Security
Application Security
Incident Response
Zero Trust Model
Disaster Recovery
Penetration Testing / Ethical Hacking
Governance
Malware
Security Architecture
Security Engineering
Security Certifications
Design
Web Design
Graphic Design
Interaction Design
Film & Video
User Experience (UX)
Design Process
Design Tools
Business
Agile
Project Management
Product Management
Marketing
Human Resources
Finance
Team Management
Business Strategy
Digital Transformation
Organizational Leadership
Soft Skills
Professional Communication
Emotional Intelligence
Presentation Skills
Innovation
Critical Thinking
Public Speaking
Collaboration
Personal Productivity
Confidence / Motivation
Features
All features
Verifiable skills
AI Academy
Courses
Certifications
Interactive learning
Live events
Superstreams
Answers
Insights reporting
Radar Blog
Buy Courses
Plans
Sign In
Try Now
O'Reilly Platform
book
可编程网络自动化
by
Jason Edelman
,
Scott S. Lowe
,
Matt Oswalt
January 2023
Intermediate to advanced
458 pages
14h 16m
Chinese
Posts & Telecom Press
Content preview from
可编程网络自动化
数据格式与数据模型
|
125
据时,希望它是一个字符串,但实际上得到的是布尔值,这很有可能造成软件产生错误的
结果,甚至是崩溃。
数据模型是定义以某种数据格式(如
Y
AML
)存储的数据的结构和内容的一种方式。使用
数据模型,我们可以明确声明
Y
AML
文档中的数据必须是“键
–
值”列表,并且每个值都
必须是字符串。
遗憾的是,
Y
AML
并没有提供任何内建机制来描述或强制数据模型。不过好在还有第三方
工具(
Kwalify
就是其中之一)
。这就是
YAML
非常适合人机交互,但不一定适合机器与机
器交互的原因之一。
YAML
被视为
JSON
的超集,本章稍后会讨论
JSON
这种格式。从理论上
讲,这意味着用于验证
JSON
模式(
JSON
文档的数据模型)的工具也可以
验证
YAML
文档。
接下来要介绍的另一种数据格式
XML
所提供的一些特性和功能使其更适合于机器与机器
的交互。
5.3
XML
如上一节所述,虽然
YAML
适合于人机交互,但是当软件元素之间需要相互通信时,诸如
XML
和
JSON
之类的其他格式往往会受到青睐
,作为数据描述之选。本节将介绍
XML
及
其为何适合此类用例。
XML
在各种工具和语言中享有广泛的支持,比如
Python
的
LXML
库。事实
上,
XML
定义本身也伴随着模式约束、转换和高级查询等各种相关的定义。
因此,本节只涉及
XML
。你可以自己去尝试一些相关的工具和格式。
5.3.1
XML
基础
XML
与
YAML
有一些相似之处。例如,二者都有内在的层次结构。我们可以非常容易地
将数据嵌入一个父结构中。
<device>
<vendor>
Cisco ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial
You might also like
Python和NLTK实现自然语言处理
Posts & Telecom Press, Nitin Hardeniya
Go程序设计语言
艾伦A. A.多诺万, 布莱恩W. 柯尼汉
弱监督学习实用指南
Wee Hyong Tok, Amit Bahree, Senja Filipi
Python实用技能学习指南
Posts & Telecom Press, Robert Smallshire, Austin Bingham
Publisher Resources
ISBN: 9787115606181