Rooni commited on
Commit
c26c406
·
verified ·
1 Parent(s): b394476

Update server.js

Browse files
Files changed (1) hide show
  1. server.js +6 -1
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({ explicitArray: false });
 
 
 
 
 
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;