xml 如何使用notepad ++从xml文件中提取数据?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10955431/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to extract data from xml file using notepad++?
提问by dotnetcoder
I have a xml response with a structure ( e.g groups > subgroups > child records ).
我有一个带有结构的 xml 响应(例如组 > 子组 > 子记录)。
I want to extract list of all childRecord.name as separate data. I was hoping i can do something quick in notepad++ and then paste the results in excel.
我想将所有 childRecord.name 的列表提取为单独的数据。我希望我可以在记事本 ++ 中快速做一些事情,然后将结果粘贴到 excel 中。
I am not sure how to go about writing a macro may be in this case that would do this for me.
我不确定在这种情况下如何编写宏可能会为我做到这一点。
<group>
<subgroup>
<childrecord name="abc">zzz</childrecord>
</subgroup>
</group>
回答by Farahmand
Open the XML file with MS Excel directly.
直接用 MS Excel 打开 XML 文件。
Update
更新
From support.office.com:
Import an XML data file as an XML table
Click Developer > Import.
If you don't see the Developer tab, see Show the Developer tab.
In the Import XML dialog box, locate and select the XML data file (.xml) you want to import, and click Import.
If the XML data file doesn't refer to a schema, Excel infers the schema from the XML data file.
In the Import Data dialog box, do one of the following:
a. Select XML table in existing worksheet to import the contents of the XML data file into an XML table in your worksheet at the specified cell location.
b. Select XML table in new worksheet to import the contents of the file into an XML table in a new worksheet starting at cell A1. The schema of the XML data file is displayed in the XML Source task pane.
If the XML data file doesn't refer to a schema, then Excel infers the schema >from the XML data file.
To control the behavior of XML data (such as data binding, format, and layout), click Properties, which displays the XML Map properties dialog box. For example, existing data in a mapped range will be overwritten when you import data by default, but you can change this.
将 XML 数据文件作为 XML 表导入
单击开发人员 > 导入。
如果您没有看到“开发人员”选项卡,请参阅显示“开发人员”选项卡。
在“导入 XML”对话框中,找到并选择要导入的 XML 数据文件 (.xml),然后单击“导入”。
如果 XML 数据文件未引用架构,Excel 将从 XML 数据文件推断架构。
在“导入数据”对话框中,执行以下操作之一:
一种。选择现有工作表中的 XML 表,将 XML 数据文件的内容导入到工作表中指定单元格位置的 XML 表中。
湾 选择新工作表中的 XML 表,将文件内容导入到新工作表中的 XML 表中,从单元格 A1 开始。XML 数据文件的架构显示在 XML 源任务窗格中。
如果 XML 数据文件未引用架构,则 Excel 会从 XML 数据文件中推断架构。
要控制 XML 数据的行为(例如数据绑定、格式和布局),请单击“属性”,这将显示“XML 映射属性”对话框。例如,默认情况下,当您导入数据时,映射范围内的现有数据将被覆盖,但您可以更改此设置。
Import XML file in LibreOffice Calc:
在 LibreOffice Calc 中导入 XML 文件:
- From the menu bar, go to
Data>XML Source... - Click on the browse button (folder icon) and choose the file from the dialog
- Select the desired node
- Fill the
Mapped cellfield for exampleA1 - Click on Importbutton.
- 从菜单栏中,转到
Data>XML Source... - 单击浏览按钮(文件夹图标)并从对话框中选择文件
- 选择所需节点
- 填写
Mapped cell字段例如A1 - 单击Import按钮。
回答by Farahmand
Simply follow these steps:
只需按照以下步骤操作:
- Open your XML file with Notepad++
- Select all text
- Use this menu: TextFX -> TextFX Convert -> Strip HTLM tags table tabs/nontabs
- 用 Notepad++ 打开你的 XML 文件
- 选择所有文本
- 使用这个菜单:TextFX -> TextFX Convert -> Strip HTLM tags table tabs/nontabs

