Spaces:
Sleeping
Sleeping
Update server.js
Browse files
server.js
CHANGED
|
@@ -30,13 +30,13 @@ app.post('/to_json', (req, res) => {
|
|
| 30 |
}
|
| 31 |
const parser = new xml2js.Parser({
|
| 32 |
explicitArray: false,
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
});
|
| 37 |
parser.parseString(xmlInput, (err, result) => {
|
| 38 |
if (err) {
|
| 39 |
-
|
| 40 |
}
|
| 41 |
res.json(result);
|
| 42 |
});
|
|
|
|
| 30 |
}
|
| 31 |
const parser = new xml2js.Parser({
|
| 32 |
explicitArray: false,
|
| 33 |
+
charkey: 'value',
|
| 34 |
+
attrkey: 'attributes',
|
| 35 |
+
trim: true,
|
| 36 |
});
|
| 37 |
parser.parseString(xmlInput, (err, result) => {
|
| 38 |
if (err) {
|
| 39 |
+
return res.status(500).json({ error: 'Произошла ошибка при разборе XML.' });
|
| 40 |
}
|
| 41 |
res.json(result);
|
| 42 |
});
|