- YAML – JSON Schema
- YAML – Failsafe Schema
- YAML – Block Sequences
- YAML – Flow Mappings
- YAML – Sequence Styles
- YAML – Block Styles
- YAML – Flow Styles
- YAML – Block Scalar Header
- YAML – Node Properties
- YAML – Character Streams
- YAML – Syntax Primitives
- YAML – Syntax Characters
- YAML – Information Models
- YAML – Processes
- YAML – Full Length Example
- YAML – Scalars and Tags
- YAML – Collections and Structures
- YAML – Comments
- YAML – Indentation and Separation
- YAML – Basics
- YAML – Introduction
- YAML - Home
YAML Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
YAML - Node Properties
Each presentation node includes two major characteristics called anchor and tag. Node properties may be specified with node content, omitted from the character stream.
The basic example of node representation is as follows −
%YAML 1.1 --- !!map { ? &A1 !!str "foo" : !!str "bar", ? !!str &A2 "baz" : *a1 }
Node Anchors
The anchor property represents a node for future reference. The character stream of YAML representation in node is denoted with the ampersand (&) indicator. The YAML processor need not preserve the anchor name with the representation details composed in it. The following code explains this −
%YAML 1.1 --- !!map { ? !!str "First occurence" : &A !!str "Value", ? !!str "Second occurence" : *A }
The output of YAML generated with anchor nodes is shown below −
--- !!map { ? !!str "First occurence" : !!str "Value", ? !!str "Second occurence" : !!str "Value", }
Node Tags
The tag property represents the type of native data structure which defines a node completely. A tag is represented with the (!) indicator. Tags are considered as an inherent part of the representation graph. The following example of explains node tags in detail −
%YAML 1.1 --- !!map { ? !<tag:yaml.org,2002:str> "foo" : !<!bar> "baz" }
Node Content
Node content can be represented in a flow content or block format. Block content extends to the end of pne and uses indentation to denote structure. Each collection kind can be represented in a specific single flow collection style or can be considered as a single block. The following code explains this in detail −
%YAML 1.1 --- !!map { ? !!str "foo" : !!str "bar baz" } %YAML 1.1 --- !!str "foo bar" %YAML 1.1 --- !!str "foo bar" %YAML 1.1 --- !!str "foo bar "Advertisements