使用JSON对象定制的xml

时间:2014-09-09 04:34:10

标签: javascript xml json node.js

我试图在JSON对象的帮助下创建一个自定义的xml。以下是我的数据。

var data = {
  "title": {
    "type": "object",
    "properties": {
      "firstName": {
        "type": "string"
      },
      "lastName": {
        "type": "string"
      },
      "age": {
        "description": "Age in years",
        "type": "integer",
        "minimum": 0
      }
    },
    "required": {
      details: {
        Questions: [
          {
            othersTitle: "mr",
            title: "aa",
            firstName: "xyz"
          },
          {
            othersTitle: "mrs",
            title: "bb",
            firstName: "abc"
          }
        ]
      }
    }
  }
}
var dataPath = data.required.details.Questions[].title;
  

由于数组中有两个数据,如何创建两个xml标记。

var xmlPath = userDetails[0].custInfo[].userList.title;

我已经添加了一小部分逻辑JSFIDDLE,介绍了如何使用一个JSON数组数据创建单个xml标记。如何让我的调用recurisve为serval数组数据创建多个xml。 任何有关这方面的帮助都会非常有用。

0 个答案:

没有答案