xml 相关问题

可扩展标记语言(XML)是一种灵活的结构化文档格式,用于定义人类和机器可读的编码规则。

尝试在 Ebay 中发布列表时出现问题

关于 我正在尝试在 Ebay 交易 API 中发布列表。我们可以看到,这里的 Ebay API 文档提到了品牌信息:https://developer.ebay.com/devzone/xml/docs/Reference...

回答 1 投票 0

从xml获取属性并打印错误

我正在尝试使用 C# 和 linq 从 xml 中检索属性值。打印时属性数据为空。任何帮助将不胜感激。除了检索属性值...

回答 1 投票 0

我无法滚动到页面末尾。安卓工作室

我无法滚动到页面末尾。 这是我的 xml 代码: 我无法滚动到页面末尾。 这是我的 xml 代码: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".UploadActivity"> <ImageButton android:id="@+id/uploadButton_close" android:layout_width="25dp" android:layout_height="26dp" android:layout_marginStart="20dp" android:layout_marginBottom="84dp" android:layout_marginTop="10dp" android:background="@android:color/transparent" android:scaleType="fitCenter" app:srcCompat="@drawable/close_icon" /> <ScrollView android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <androidx.cardview.widget.CardView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="50dp" android:layout_marginEnd="20dp" android:layout_marginStart="20dp" app:cardCornerRadius="30dp" app:cardElevation="20dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:layout_gravity="center_horizontal" android:padding="20dp" android:background="@drawable/lavender_border"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Завантажте дані" android:textSize="30sp" android:textAlignment="center" android:textColor="@color/purple" /> <ImageView android:id="@+id/uploadImage" android:layout_width="match_parent" android:layout_height="200dp" android:scaleType="fitCenter" android:src="@drawable/baseline_image_search_24" android:layout_marginTop="10dp" /> <EditText android:layout_width="match_parent" android:layout_height="60dp" android:id="@+id/uploadTitle" android:textSize="16sp" android:textStyle="bold" android:background="@drawable/lavender_border" android:hint="Введіть заголовок" android:layout_marginTop="20dp" android:padding="16dp" android:layout_gravity="start|center_vertical" android:textColor="@color/purple"/> <EditText android:layout_width="match_parent" android:layout_height="60dp" android:id="@+id/uploadCaption" android:textSize="14sp" android:background="@drawable/lavender_border" android:hint="Введіть короткий опис" android:layout_marginTop="20dp" android:padding="16dp" android:layout_gravity="start|center_vertical" android:textColor="@color/purple"/> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/uploadText" android:background="@drawable/lavender_border" android:hint="Введіть текст" android:textSize="14sp" android:layout_marginTop="20dp" android:padding="16dp" android:layout_gravity="start|center_vertical" android:textColor="@color/purple" android:inputType="textMultiLine" android:minLines="12" android:gravity="top" /> <EditText android:layout_width="match_parent" android:layout_height="60dp" android:id="@+id/uploadLink" android:textSize="14sp" android:background="@drawable/lavender_border" android:hint="Посилання" android:layout_marginTop="20dp" android:padding="16dp" android:layout_gravity="start|center_vertical" android:textColor="@color/purple"/> <AutoCompleteTextView android:id="@+id/uploadTheme" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="start|center_vertical" android:layout_marginTop="20dp" android:background="@drawable/lavender_border" android:hint="Оберіть тему" android:inputType="none" android:padding="16dp" android:textColor="@color/purple" android:textSize="14sp" tools:ignore="SpeakableTextPresentCheck" android:drawableEnd="@drawable/baseline_arrow_drop_down_24"/> <Button android:layout_width="match_parent" android:layout_height="60dp" android:text="Зберегти" android:id="@+id/uploadButton_save" android:textSize="18sp" android:layout_marginTop="10dp" /> </LinearLayout> </androidx.cardview.widget.CardView> </ScrollView> </RelativeLayout> 如何解决?感谢您的回复。 我尝试添加更多 margin_bottom 但它不起作用,我也删除了它,尝试添加填充等。 如果我将 margin_bottom 添加到 LinearLayout,CardView 会超越 如果我将 margin_bottom 添加到 CardView,则不会发生任何事情。我还尝试更改 match_parent/wrap_content 的布局高度,但没有任何帮助。 从 LinearLayout 中删除内边距,按钮将不再在底部被切断。删除这个:android:padding="20dp" 您正在用所有其他视图的高度填充屏幕,没有空间进行填充。

回答 1 投票 0

OpenTimelineIO FCP XML 导入无法找到剪辑

我在 Final Cut Pro 和 Adobe Premiere 中有几个视频项目想要转换为 Kdenlive。我找到了 OpenTimelineIO,并通过反复试验并感谢 StackOverflow,得到了以下代码:

回答 1 投票 0

XPath - 如何从子节点中排除文本

我想要这个输出(示例): 我要这个 我正在处理 XML/TEI 文档,我需要使用 XPath 表达式,并且我希望将 div/u 中的文本作为输出,但没有节点 e 内的文本...

回答 2 投票 0

根据文件.XLM上的参数批量重命名.pdf

我想帮助我的会计同事,他们从门户网站下载多个以一堆数字命名的.pdf文件,然后按照如下格式手动重命名:

回答 1 投票 0

如何从表中的 XML 列获取所有 XML 路径的超集

我有一个带有 XML 列的表。我没有该列的数据字典或 XML 结构的定义。大约有 150 万条记录。通过对小样本的目视检查,

回答 1 投票 0

XSLT 2.0 中的链接模板

我有一个非常简单的输入文件: ...

回答 1 投票 0

如何在 Eclipse 中设置 Maven POM 编辑器的格式设置?

当我使用 Maven POM 编辑器打开 pom.xml 并尝试使用默认快捷键 ctrl + shift + f 进行格式化时,我希望该文件被格式化为具有 Preferen 中配置的规则的任何其他 .xml...

回答 1 投票 0

使用 nodeJS 中的参数和 saxon-js 将 XSLT 重用于不同的 XML 输入

我想使用 XSLT 将未知数量的不同但非常相似的结构化输入 XML 文档转换为单个输出 XML 格式。 我的平台是node.js,因此我正在研究...

回答 1 投票 0

如何使用python脚本将xml文件转换为csv

我有一个具有特殊结构的xml文件,我需要使用脚本python将其转换为csv文件 这是我的 xml 文件的一部分: 我有一个具有特殊结构的 xml 文件,我需要使用脚本 python 将其转换为 csv 文件 这是我的 xml 文件的一部分: <?xml version="1.0" encoding="UTF-8"?> <results version="2"> <cppcheck version="2.9"/> <errors> <error identifier="redundantAssignment" errorStyle="style" msg="Variable &apos;ret&apos; is reassigned a value before the old one has been used."> <location file="D:\test\main.c" line="64" column="8" info="ret is overwritten"/> <location file="D:\test\main.c" line="62" column="8" info="ret is assigned"/> <symbol>ret</symbol> </error> <error identifier="redundantAssignment" errorStyle="style" msg="Variable &apos;ret&apos; is reassigned a value before the old one has been used."> <location file="D:\test\data.c" line="93" column="8" info="ret is overwritten"/> <location file="D:\test\data.c" line="91" column="8" info="ret is assigned"/> <symbol>ret</symbol> </error> </errors> </results> 我正在使用这个脚本,但它对我不起作用: import xml.etree.ElementTree as ET import csv # PARSE XML xml = ET.parse("./error.xml") root = xml.getElementsByTagName() # CREATE CSV FILE csvfile = open("data.csv",'w',encoding='utf-8') csvfile_writer = csv.writer(csvfile) # ADD THE HEADER TO CSV FILE csvfile_writer.writerow(["identifier","file","errorStyle","msg"]) # FOR EACH EMPLOYEE for error in root.findall("errors/error"): if(error): # EXTRACT EMPLOYEE DETAILS identifier = error.get('identifier') file = error.find('file') errorStyle = error.find("errorStyle") msg = error.find("msg") csv_line = [identifier, file.text, errorStyle.text, msg.text] # ADD A NEW ROW TO CSV FILE csvfile_writer.writerow(csv_line) csvfile.close() 请参考以下代码: import xml.etree.ElementTree as ET import csv xml_data = """<?xml version="1.0" encoding="UTF-8"?> <results version="2"> <cppcheck version="2.9"/> <errors> <error identifier="redundantAssignment" errorStyle="style" msg="Variable &apos;ret&apos; is reassigned a value before the old one has been used."> <location file="Din.c" line="64" column="8" info="ret is overwritten"/> <location file="D.c" line="62" column="8" info="ret is assigned"/> <symbol>ret</symbol> </error> <error identifier="redundantAssignment" errorStyle="style" msg="Variable &apos;ret&apos; is reassigned a value before the old one has been used."> <location file="Dta.c" line="93" column="8" info="ret is overwritten"/> <location file="Dta.c" line="91" column="8" info="ret is assigned"/> <symbol>ret</symbol> </error> </errors> </results>""" root = ET.fromstring(xml_data) csvfile = open("data.csv",'w') csvfile_writer = csv.writer(csvfile) csvfile_writer.writerow(["msg","identifier","errorStyle"]) for child in root: for item in child: csv_line = [item.attrib["msg"],item.attrib["identifier"] , item.attrib["errorStyle"]] csvfile_writer.writerow(csv_line) print item.attrib csvfile.close() 希望这有帮助,谢谢。 注意:不是原始问题的答案,而是一个有价值的示例,具体取决于 xml 结构: 我在使用 csv 和 pandas 模块强制 csv 输出为文本字段时遇到了麻烦。 (没有引号或三引号) 当您有一个相当简单的 xml,您只想将属性或子元素转换为 csv 时,我想出了一个仅包含简单文件 IO、格式化程序和生成器表达式的解决方案: import os import xml.etree.ElementTree as ET def items2csv(root, csv_path): attributes = ['name', 'gps', 'country', 'year', 'notes'] csvfile = open(csv_path, 'w') # Column headers line = '"{}", "{}", "{}", "{}", "{}"'.format(*attributes) csvfile.write(line) for parent in root: values = [(parent.get(attrib) if parent.get(attrib) != None else '') for attrib in attributes] line = '\n"{}", "{}", "{}", "{}", "{}"'.format(*values) csvfile.write(line) csvfile.close() xml_data = """<?xml version="1.0" encoding="UTF-8"?> <tree> <item name="Name1" gps="24.227191 35.573413" country="Egypt" year="2004"></item> <item name="Name2" gps="24.228596 35.573733" country="Egypt" year="2004"></item> <item name="Name3" gps="24.253222 35.539939" country="Egypt" year="2004"></item> <item name="Name4" gps="25.429583 34.694408" country="Egypt" year="2007" notes="https://www.blabla.com "></item> <item name="Name5" gps="25.309756 34.860375" country="Egypt" year="2007"></item> </tree>""" #root = ET.parse('test.xml').getroot() # from file root = ET.fromstring(xml_data) # from variable items2csv(root, os.path.dirname(__file__) + "/test_output.csv") wait = input("Press Enter to Exit.") 以及基于子元素的简单 xml 结构的示例: #!/usr/bin/python import os import xml.etree.ElementTree as ET def items2csv(root, csv_path): tags = ['name', 'gps', 'country', 'year', 'notes'] csvfile = open(csv_path, 'w') # Column headers line = '"{}", "{}", "{}", "{}", "{}"'.format(*tags) csvfile.write(line) for parent in root: values = [(parent.findtext(tag) if parent.findtext(tag) != None else '') for tag in tags] line = '\n"{}", "{}", "{}", "{}", "{}"'.format(*values) csvfile.write(line) csvfile.close() xml_data = """<?xml version="1.0" encoding="UTF-8"?> <tree> <item> <name>Name1</name> <gps>24.227191 35.573413</gps> <country>Egypt</country> <year>2004</year> </item> <item> <name>Name2</name> <gps>24.228596 35.573733</gps> <country>Egypt</country> <year>2004</year> </item> <item> <name>Name3</name> <gps>24.253222 35.539939</gps> <country>Egypt</country> <year>2004</year> </item> <item> <name>Name4</name> <gps>25.429583 34.694408</gps> <country>Egypt</country> <year>2007</year> <notes>https://www.blabla.com</notes> </item> <item> <name>Name5</name> <gps>25.309756 34.860375</gps> <country>Egypt</country> <year>2007</year> </item> </tree>""" #root = ET.parse('test.xml').getroot() # from file root = ET.fromstring(xml_data) # from variable items2csv(root, os.path.dirname(__file__) + "/test_output.csv") wait = input("Press Enter to Exit.")

回答 2 投票 0

从 VBA 编写 xml

我编写了一个 VBA 脚本,可将 Excel 工作簿中的数据插入到 xml 文件中。 要编辑的 xml 文件是从 filedialogpicker 中选择的: 公共 strFile 作为字符串 子集路径() ' 声明...

回答 1 投票 0

如何迭代XSL并获取节点

我正在就我在尝试迭代和 XSLT 转换时面临的挑战问题与您联系。我有以下 XML 结构,我正在尝试获取值 AUFNR、BDMNG、

回答 1 投票 0

我正在尝试转换数据帧列表列表中的数据帧

我的数据如下:txt格式 时间 ;来源 ;行动 年-月-日;卡生物学;阅读成功 年-月-日;学生1;初始化的 年-月-日;书 1 ;首先退房 年-月-日;...

回答 1 投票 0

如何在 odoo 版本 16 中隐藏、取消存档和导出 crm_lead 的操作存档

我尝试了很多方法,比如自定义js文件,...但是失败 如何在 odoo 版本 16 中隐藏 crm_lead 的操作存档、取消存档和导出。我尝试了很多方法,但都失败了。请帮助我,因为我...

回答 3 投票 0

Odoo 移动字段

我正在尝试移动 res.partner 下的字段。该字段是条形码,位于笔记本销售和采购下。我在表单视图中添加了一个字段,但我发现 Odoo 只允许在字段上...

回答 1 投票 0

如何使用 Selenium 在同一浏览器中同时但使用不同的实例运行多个 TestNG.XML 文件

如何使用 Selenium 在同一浏览器中同时但使用不同的实例运行多个 TestNG.XML 文件。 我的 testng.xml 文件中有大量测试类...

回答 1 投票 0

如何显示带有 XML 文件中的主/详细信息的嵌套 HTML 表格

我有这个 xml,我想使用 jQuery 读取/处理 XML 文件并将其放入嵌套表中,如下所示 学号0001 姓名五月 学科代码 说明 单位 教授 IPT...

回答 1 投票 0

OpenXML 查找替换文本

环境 Visual Studio 2017 C#(Word .docx 文件) 问题 查找/替换仅替换“{Today}” - 它无法替换“{ConsultantName}”字段。我已经检查了文档并尝试使用

回答 3 投票 0

“condition”属性无效 - 值“@contains(string, 'substring')”不在允许的值范围内

我正在编写一个 terraform 代码,我还必须添加 XML。我还想向 xml 添加条件以使用基本路径进行过滤。我的子字符串将是基本路径。我像下面的代码一样添加它

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.