如何使用Javascript删除HTML代码?

如何使用Javascript删除HTML代码?,javascript,html,node.js,Javascript,Html,Node.js,在本例中,content对象包含我不想保存的html代码。如何将此json文件中的内容对象保存为文本?我想用node.js保存在documentdb中 { "title": "Azure IoT Suite adds device management capability updates", "content": "<p>While the most successful enterprise IoT solutions include a strategy

在本例中,content对象包含我不想保存的html代码。如何将此json文件中的内容对象保存为文本?我想用node.js保存在documentdb中

{
      "title": "Azure IoT Suite adds device management capability updates",
      "content": "<p>While the most successful enterprise IoT solutions include a strategy for operators to handle ongoing management of device collection in a simple and reliable manner, it can be a hurdle for companies getting started with IoT. To help with that challenge, we recently <a href=\"https://azure.microsoft.com/en-us/blog/enhancements-abound-in-general-availability-of-azure-iot-hub-device-management/\">introduced</a> device management capabilities in Azure IoT Hub.</p> <p>Today, we&rsquo;ve added these device management features to the <a href=\"https://azure.microsoft.com/en-us/blog/microsoft-azure-iot-suite-connecting-your-things-to-the-cloud/\">Azure IoT Suite</a> remote monitoring preconfigured solution. The Azure IoT Suite simplifies deploying and orchestrating advanced services to give businesses a complete IoT solution from proof of concept to broader deployment.</p> <p>With new device management functionality in Azure IoT Suite, developers will be able to quickly move beyond telemetry processing, rule management, and visualization to customize their device overview, queries and device lists. These enhancements include:</p> <ul> <li>Synchronizing settings and metadata between the cloud and devices using <strong>device twins</strong>.</li> <li>Performing an action on a connected device through the cloud using <strong>direct methods</strong>.</li> <li>Broadcasting and orchestrating operations on multiple devices at a planned time through <strong>jobs</strong>.</li> <li>Attesting the status and health for on or offline device collections using real-time, dynamic <strong>queries</strong> across device twins and jobs.</li> </ul> <p><a href=\"https://azurecomcdn.azureedge.net/mediahandler/acomblog/media/Default/blog/2eff2e8f-2e3c-47d0-a504-f3482a1f87ef.png\"><img alt=\"Contoso MD-1 Devices\" border=\"0\" height=\"134\" src=\"https://azurecomcdn.azureedge.net/mediahandler/acomblog/media/Default/blog/f007d7e1-909d-4831-af81-f5f12ce33ef6.png\" style=\"border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;\" title=\"Contoso MD-1 Devices\" width=\"480\"></a></p> <ul> <li>Customizing device information overview by using <strong>Column Editor</strong> to provide a dynamic report for devices you want to monitor right now.</li> </ul> <p><a href=\"https://azurecomcdn.azureedge.net/mediahandler/acomblog/media/Default/blog/a8e182e4-e16d-42ad-8e0b-2791e121e096.png\"><img alt=\"Costoso MD-1 Devices Edit Columns\" border=\"0\" height=\"239\" src=\"https://azurecomcdn.azureedge.net/mediahandler/acomblog/media/Default/blog/a7ce0f2b-d1c2-4afb-a9e5-25d2f7bcd55f.png\" style=\"border-image: none; padding-top: 0px; padding-right: 0px; padding-left: 0px; margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;\" title=\"Costoso MD-1 Devices Edit Columns\" width=\"480\"></a></p> <p>The Azure IoT Suite remote monitoring preconfigured solution is also <a href=\"https://github.com/Azure/azure-iot-remote-monitoring\">open source</a>, which gives developers the flexibility to customize it to their needs as the business evolves. We are excited to see developers achieve even more through the new device management features.</p> <p>Learn more about today&rsquo;s enhancements by reviewing our two step-by-step guides: <a href=\"https://docs.microsoft.com/azure/iot-suite/iot-suite-getstarted-preconfigured-solutions\">Get started with the preconfigured solutions</a> and <a href=\"https://docs.microsoft.com/azure/iot-suite/iot-suite-remote-monitoring-sample-walkthrough\">Remote monitoring preconfigured solution walkthrough</a>. You can also provision your IoT solution with your Azure subscription today by visiting <a href=\"http://www.azureiotsuite.com/\">www.azureiotsuite.com</a>.</p>",
      "published": "2017-02-28T11:00:06.000Z",
      "author": "Sam George",
      "link": "https://azure.microsoft.com/blog/azure-iot-suite-adds-device-management-capability-updates/",
      "feed": {
        "source": "https://azure.microsoft.com/en-us/blog/feed/",
        "link": "https://azure.microsoft.com/blog/",
        "name": "Microsoft Azure Blog"
      },
      "id": "ae8e3449-7d07-bd0b-1156-43cfe4a0a75a"
    }
{
“标题”:“Azure IoT套件添加设备管理功能更新”,
“内容”:"虽然最成功的企业物联网解决方案包括运营商以简单可靠的方式处理设备收集的持续管理的策略,但这可能是公司开始使用物联网的一个障碍。为了帮助应对这一挑战,我们最近在Azure物联网中心增加了设备管理功能。

今天,我们添加了将这些设备管理功能添加到远程监控预配置解决方案中。Azure IoT套件简化了高级服务的部署和编排,为企业提供了从概念验证到更广泛部署的完整IoT解决方案。

借助Azure IoT套件中的新设备管理功能,开发者将能够ckly超越遥测处理、规则管理和可视化,定制其设备概览、查询和设备列表。这些增强功能包括:

  • 使用设备双胞胎在云和设备之间同步设置和元数据
  • 通过云在连接的设备上执行操作使用直接方法
  • 在计划时间通过作业在多台设备上广播和编排操作
  • 使用跨设备双胞胎和作业的实时动态查询来验证在线或离线设备收集的状态和运行状况。
  • 列编辑器为您现在要监控的设备提供动态报告。
Azure IoT Suite远程监控预配置解决方案也是如此,它使开发人员能够灵活地根据业务发展的需要对其进行定制。我们非常激动d希望看到开发人员通过新的设备管理功能取得更大的成就。

通过查看我们的两个分步指南,了解更多关于今天的增强功能的信息:和。您也可以通过访问今天的Azure订阅为您的物联网解决方案提供物联网解决方案。

“, “已发布”:“2017-02-28811:00:06.000Z”, “作者”:“山姆·乔治”, “链接”:https://azure.microsoft.com/blog/azure-iot-suite-adds-device-management-capability-updates/", “提要”:{ “来源”:https://azure.microsoft.com/en-us/blog/feed/", “链接”:https://azure.microsoft.com/blog/", “名称”:“Microsoft Azure博客” }, “id”:“ae8e3449-7d07-bd0b-1156-43cfe4a0a75a” }
有了这段代码,我可以摆脱html标记,但是有太多的html代码,比如“we&rsquo”

articles.forEach(函数(元素){
element.content=element.content.replace(/{1}/g,“”);
});

有没有办法在没有html代码和标记的情况下保存此内容?

创建一个元素,将html设置为内容,并将内容设置为生成的innerText:

articles.forEach(v => {
  let tmp = document.createElement('div');
  tmp.innerHTML = v.content;
  v.content = tmp.innerText;
});
var文章=[{
“标题”:“Azure IoT套件添加设备管理功能更新”,
“内容”:虽然最成功的企业物联网解决方案包括运营商以简单可靠的方式处理设备收集的持续管理的策略,但这可能是公司开始使用物联网的一个障碍。为了帮助应对这一挑战,我们最近在Azure物联网中心增加了设备管理功能。

今天,我们添加了将这些设备管理功能添加到远程监控预配置解决方案中。Azure IoT套件简化了高级服务的部署和编排,为企业提供了从概念验证到更广泛部署的完整IoT解决方案。

借助Azure IoT套件中的新设备管理功能,开发者将能够ckly超越遥测处理、规则管理和可视化,定制其设备概览、查询和设备列表。这些增强功能包括:

  • 使用设备双胞胎在云和设备之间同步设置和元数据
  • 通过云在连接的设备上执行操作使用直接方法
  • 在计划时间通过作业在多台设备上广播和编排操作
  • 使用跨设备双胞胎和作业的实时动态查询来验证在线或离线设备收集的状态和运行状况。
  • 列编辑器为您现在要监控的设备提供动态报告。
Azure IoT Suite远程监控预配置解决方案也是如此,它使开发人员能够灵活地根据业务发展的需要对其进行定制。我们非常激动d希望看到开发人员通过新的设备管理功能取得更大的成就。

通过查看我们的两个分步指南,了解更多关于今天的增强功能的信息:和。您也可以通过访问今天的Azure订阅为您的物联网解决方案提供物联网解决方案。

“, “已发布”:“2017-02-28811:00:06.000Z”, “作者”:“山姆·乔治”, “链接”:https://azure.microsoft.com/blog/azure-iot-suite-adds-device-management-capability-updates/", “提要”:{ “来源”:https://azure.microsoft.com/en-us/blog/feed/", “链接”:https://azure.microsoft.com/blog/", “名称”:“Microsoft Azure博客” }, “id”:“ae8e3449-7d07-bd0b-1156-43cfe4a0a75a” }]; articles.forEach(v=>{ 设tmp=document.createElement('div'); tmp.innerHTML=v.content; v、 content=tmp.innerText; });
console.log(articles);
这可能会有所帮助:不太清楚为什么要在客户端上尝试这样做
articles.forEach(v => {
  let tmp = document.createElement('div');
  tmp.innerHTML = v.content;
  v.content = tmp.innerText;
});