docs(10_Wiki): W3Schools 위키화 — HTML/CSS/JavaScript(core)

W3Schools 튜토리얼을 P-Reinforce v3.1 포맷으로 위키화(영어 본문, 한/영 섹션 헤더).
- Topic_HTML: 59문서 (튜토리얼+예제, 레퍼런스/메타 제외)
- Topic_CSS: 190문서 (메인 + Advanced/Flexbox/Grid/RWD 전체)
- Topic_JavaScript: 120문서 (코어 언어; Temporal/DOM상세/BOM/WebAPI/AJAX/jQuery/Graphics 등은 후속)
각 폴더 00_INDEX.md(MOC) 포함. 코드 verbatim, 미확인분은 "Not found in source" 표기.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-23 19:21:18 +09:00
parent 8957890d13
commit 9609c04755
379 changed files with 54618 additions and 6 deletions
@@ -0,0 +1,134 @@
---
id: json-vs-xml
title: "JSON vs XML"
category: "Frontend"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["JSON vs XML", "JSON XML comparison", "JSON or XML", "data format comparison", "XML alternative"]
duplicate_of: ""
source_trust_level: "B"
confidence_score: 0.88
created_at: 2026-06-23
updated_at: 2026-06-23
review_reason: ""
merge_history: []
tags: ["javascript", "js", "web", "frontend", "w3schools", "json", "xml"]
raw_sources: ["https://www.w3schools.com/js/js_json_xml.asp"]
applied_in: []
github_commit: ""
---
# [[JSON vs XML]]
## 🎯 한 줄 통찰 (One-line insight)
JSON and XML are both self-describing, hierarchical, language-portable data formats, but JSON is shorter, uses no end tags, supports arrays, and can be parsed by a standard JavaScript function into a ready-to-use object — whereas XML needs an XML parser. [S1]
## 🧠 핵심 개념 (Core concepts)
- **Both formats serve the same role** — representing the same hierarchical data (e.g. an `employees` list) in text. [S1]
- **JSON is like XML** — both are self-describing (human readable), both are hierarchical (values within values), both can be parsed and used by lots of programming languages, and both can be fetched with an `XMLHttpRequest`. [S1]
- **JSON is unlike XML** — JSON doesn't use end tags, JSON is shorter, JSON is quicker to read and write, and JSON can use arrays. [S1]
- **Parsing is the key difference** — XML has to be parsed with an XML parser; JSON can be parsed by a standard JavaScript function. [S1]
- **Why JSON is better than XML** — XML is much more difficult to parse than JSON; JSON is parsed into a ready-to-use JavaScript object. [S1]
## 🧩 추출된 패턴 (Extracted patterns)
- **Same data, two encodings** — compare the JSON array-of-objects against the equivalent nested XML element tree. [S1]
- **Parse-to-object pattern (JSON)** — fetch a JSON string, then `JSON.parse` it. [S1]
- **Parse-and-walk pattern (XML)** — fetch an XML document, loop through it with the XML DOM, extract values, and store them in variables. [S1]
## 📖 세부 내용 (Details)
The following examples both define an employees object/structure with 3 employees. [S1]
**JSON example:** [S1]
```json
{"employees":[
{ "firstName":"John", "lastName":"Doe" },
{ "firstName":"Anna", "lastName":"Smith" },
{ "firstName":"Peter", "lastName":"Jones" }
]}
```
**XML example:** [S1]
```xml
<employees>
<employee>
<firstName>John</firstName> <lastName>Doe</lastName>
</employee>
<employee>
<firstName>Anna</firstName> <lastName>Smith</lastName>
</employee>
<employee>
<firstName>Peter</firstName> <lastName>Jones</lastName>
</employee>
</employees>
```
**JSON is like XML because** [S1]
- Both JSON and XML are "self describing" (human readable).
- Both JSON and XML are hierarchical (values within values).
- Both JSON and XML can be parsed and used by lots of programming languages.
- Both JSON and XML can be fetched with an `XMLHttpRequest`.
**JSON is unlike XML because** [S1]
- JSON doesn't use end tag.
- JSON is shorter.
- JSON is quicker to read and write.
- JSON can use arrays.
The biggest difference is: XML has to be parsed with an XML parser. JSON can be parsed by a standard JavaScript function. [S1]
**Why JSON is better than XML**
XML is much more difficult to parse than JSON. JSON is parsed into a ready-to-use JavaScript object. [S1]
Using XML: fetch an XML document, use the XML DOM to loop through the document, extract values and store them in variables. [S1]
Using JSON: fetch a JSON string, then `JSON.Parse` the JSON string. [S1]
## 🛠️ 적용 사례 (Applied in summary)
The page contrasts two real workflows: the XML path (fetch document → walk the XML DOM → extract into variables) versus the JSON path (fetch string → `JSON.parse`). No external project/commit applications found in the source.
## 💻 코드 패턴 (Code patterns)
The JSON encoding of the comparison data set:
```json
{"employees":[
{ "firstName":"John", "lastName":"Doe" },
{ "firstName":"Anna", "lastName":"Smith" },
{ "firstName":"Peter", "lastName":"Jones" }
]}
```
The equivalent XML encoding:
```xml
<employees>
<employee>
<firstName>John</firstName> <lastName>Doe</lastName>
</employee>
</employees>
```
## ⚖️ 비교 및 선택 기준 (Comparison & decision criteria)
JSON vs XML, per the source: [S1]
- **Similarities** — both self-describing/human readable, hierarchical, multi-language parseable, and fetchable via `XMLHttpRequest`.
- **JSON advantages** — no end tags, shorter, quicker to read and write, supports arrays, and parses directly into a ready-to-use JavaScript object with a standard JS function.
- **XML cost** — must be parsed with an XML parser, then walked via the XML DOM to extract values into variables — "much more difficult to parse than JSON."
- **Decision** — the page recommends JSON because it is parsed into a ready-to-use JavaScript object, making it the lower-effort choice for JavaScript-driven web pages.
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
No contradictions found in the source.
## ✅ 검증 상태 및 신뢰도
- **상태:** draft
- **검증 단계:** conceptual (실제 적용 사례 발견 시 applied/validated로 승격 가능)
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
- **신뢰 점수:** 0.88
- **중복 검사 결과:** 신규 생성 (New discovery)
## 🔗 지식 그래프 (Knowledge Graph)
- **상위/루트:** [[JavaScript Tutorial]]
- **관련 개념:** [[JavaScript JSON]], [[JavaScript JSON Syntax]], [[JavaScript JSON Parse]], [[JavaScript JSON Arrays]]
- **참조 맥락:** Referenced when choosing a data interchange format for a web application or API.
## 📚 출처 (Sources)
- [S1] W3Schools — JSON vs XML — https://www.w3schools.com/js/js_json_xml.asp
## 📝 변경 이력 (Change history)
- 2026-06-23: Initial draft synthesized from the W3Schools "JSON vs XML" page (Astra wiki-curation, P-Reinforce v3.1 format).