Spaces:
Sleeping
Sleeping
Update server.js
Browse files
server.js
CHANGED
@@ -28,7 +28,12 @@ app.post('/to_json', (req, res) => {
|
|
28 |
if (!xmlInput) {
|
29 |
return res.status(400).json({ error: 'Отсутствует параметр input в теле запроса.' });
|
30 |
}
|
31 |
-
const parser = new xml2js.Parser({
|
|
|
|
|
|
|
|
|
|
|
32 |
parser.parseString(xmlInput, (err, result) => {
|
33 |
if (err) {
|
34 |
throw err;
|
|
|
28 |
if (!xmlInput) {
|
29 |
return res.status(400).json({ error: 'Отсутствует параметр input в теле запроса.' });
|
30 |
}
|
31 |
+
const parser = new xml2js.Parser({
|
32 |
+
explicitArray: false,
|
33 |
+
ignoreAttrs: true, // игнорируем атрибуты
|
34 |
+
trim: true, // обрезаем пробелы в тексте
|
35 |
+
charkey: 'value', // переименовываем ключ для текстового содержимого
|
36 |
+
});
|
37 |
parser.parseString(xmlInput, (err, result) => {
|
38 |
if (err) {
|
39 |
throw err;
|