Commit | Line | Data |
---|---|---|
bb901ead | 1 | /* |
4b2b86f2 | 2 | * Copyright (C) 2021 EfficiOS Inc. |
bb901ead JR |
3 | * |
4 | * SPDX-License-Identifier: GPL-2.0-only | |
5 | * | |
6 | */ | |
7 | ||
8 | /* | |
9 | * Prettyfi a xml input from stdin to stddout. | |
10 | * This allows a more human friendly format for xml testing when problems occur. | |
11 | */ | |
12 | ||
13 | #include <libxml/parser.h> | |
14 | ||
f46376a1 | 15 | int main(void) |
bb901ead JR |
16 | { |
17 | xmlDocPtr doc = NULL; | |
18 | ||
19 | /* Init libxml. */ | |
20 | xmlInitParser(); | |
21 | xmlKeepBlanksDefault(0); | |
22 | ||
23 | /* Parse the XML document from stdin. */ | |
24 | doc = xmlParseFile("-"); | |
25 | if (!doc) { | |
26 | fprintf(stderr, "ERR parsing: xml input invalid"); | |
27 | return -1; | |
28 | } | |
29 | ||
30 | xmlDocFormatDump(stdout, doc, 1); | |
31 | ||
32 | xmlFreeDoc(doc); | |
33 | /* Shutdown libxml. */ | |
34 | xmlCleanupParser(); | |
35 | ||
36 | return 0; | |
37 | } |