xml 相关问题

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

从 tibble 中取消嵌套同名列表:数据被删除

我在使用unnest_wider(来自tidyr)时遇到了麻烦。 我有一个嵌套的 XML 文档,我正在尝试将其转换为数据框/tibble。我遵循此处介绍的工作流程,该工作流程建议您...

回答 1 投票 0

windowBackground 上的对话框自定义状态?

是否可以让我的 android:windowBackground 可绘制对象接收我添加的自定义属性? 对于背景,我有自定义视图,我可以覆盖 onCreateDrawableState。对于对话框来说,那是...

回答 1 投票 0

ODOO 在现场使用隐形属性 |条件:如果数字是0.0

在 Odoo 中,当您有 xpath 时,您可以在满足条件时将“attrs”添加到不可见的字段中。这很好用。 我有一个字段“折扣”,我只想在发票/报价报告上显示该字段...

回答 2 投票 0

odoo.tools.convert.重启odoo-bin时出现ParseError

我正在这里学习开发者教程。 我已将两个操作按钮添加到树视图中。 一切工作正常,直到我将按钮标签添加到 XML 视图后重新启动服务器。我...

回答 2 投票 0

如何在 SELECT ... FOR XML 中创建连接记录作为嵌入式 XML 元素?

从 SQL select 生成 XML 文档 (IDOC) 时我遇到了困难。 XML 应如下所示: ....一些主要元素... ...第一个...

回答 1 投票 0

出现错误:android.widget.LinearLayout 无法转换为 android.widget.TextView

错误: 无法启动活动 ComponentInfo{com.example.app/com.example.app.MainPermission}:java.lang.ClassCastException:android.widget.LinearLayout 无法转换为 android.widget.TextView 我

回答 1 投票 0

使用 Python xmptools 从 PDF 文件中检索 XMP 元数据

我想使用Python来检索PDF文件中存储的元数据。我正在尝试使用 Python xmptools,但发现无法提取所有元数据。例如,本文有 PDF 版本

回答 1 投票 0

如何从 Javascript 检索 xml 数据[重复]

可能的重复: 如何使用 Javascript 从 XML 文档中提取值 我的 demo.xml 文件包含以下数据: 可能重复: 如何使用 Javascript 从 XML 文档中提取值 我的 demo.xml 文件包含以下数据: <?xml version="1.0"?> <user> <details> <name>abc</name> <class>xyz</class> <city>pqr</city> </details> <info> <id>123</id> <code>456</code> </info> </user> 我想使用 Javascript 将文件 demo.xml 中的所有这些数据提取到我的代码中。我怎样才能得到这个?有什么解决办法吗?谢谢.... 这是一个可以为您指明正确方向的示例: var request = new XMLHttpRequest(); request.open("GET", "/path/demo.xml", true); request.send(); var xml = request.responseXML; var users = xml.getElementsByTagName("user"); for(var i = 0; i < users.length; i++) { var user = users[i]; var names = user.getElementsByTagName("name"); for(var j = 0; j < names.length; j++) { alert(names[j].childNodes[0].nodeValue); } }

回答 1 投票 0


有人看到这个吗?你能帮我吗?错误:- android.widget.LinearLayout 无法转换为 android.widget.TextView -

XML设计代码: 无法启动 Activity ComponentInfo{com.example.app/com.example.app.MainPermission}:java.lang.ClassCastException:android.widget.LinearLayout 无法转换为 android.widget。

回答 1 投票 0

如何在 Odoo 16 中向发票门户视图添加按钮

我一直在尝试添加一个按钮来向 Odoo 中发票的门户视图添加签名,我怀疑问题出在我正在使用的外部 ID 上(或者可能是版权问题?),但我已经尝试过

回答 2 投票 0

BPMN 到 Petri 网转换器或任何其他验证工具

我的目标是将 BPMN 模型转移到任何允许我验证它的工作流工具。我了解了 Petri 网,所以我希望能够转换创建 BPMN 后获得的 XML 文件...

回答 1 投票 0

需要什么 XSLT 来提取和转换这个特定的 XHTML?

我正在尝试从较大的文件中提取一些 HTML 的子集,然后对结果执行一些转换。我已经取得了一些进展,但我缺少一两部分来使这项工作成为设计......

回答 1 投票 0

使用已知元素查找父元素的属性

不确定标题是否清楚,但基本上我有一些如下所示的XML: 测试1 不确定标题是否清楚,但基本上我有一些如下所示的 XML: <details> <result id=1234567890> <name>Test1</name> </result> <result id=5345345433> <name>Test2</name> </result> <result id=9572385354> <name>Test3</name> </result> 我想要完成的是找到使用已知值的 id 属性 即测试1 > 1234567890,测试2 > 5345345433,测试3 > 9572385354 最好使用 xmllint,但 xmlstarlet 也是一个选项。 输入 首先,您的 XML 无效。你的id属性需要被qouted,并且详细信息没有关闭。这是修改后的输入: <details> <result id="1234567890"> <name>Test1</name> </result> <result id="5345345433"> <name>Test2</name> </result> <result id="9572385354"> <name>Test3</name> </result> </details> 结果 下面将使用 xmlstarlet 提取给定 name 属性的特定 id。 xmlstarlet sel -t -c "/details/result[name='Test1']" test.xml | grep -Po "(?<=id=\")[\d]*" 这会回来 1234567890 您也可以将命令中的 Test1 替换为变量。 var=Test1 xmlstarlet sel -t -c "/details/result[name='$var']" test.xml | grep -Po "(?<=id=\")[\d]*" 故障 xmlstarlet sel -t -c "/details/result[name='$var']" test.xml 选择结果中与 $var 匹配的所有名称标签。 | grep -Po "(?<=id=\")[\d]*" 使用 Perl Regex 将输出通过管道传输到 grep 以查找 id 属性并打印所有包含的数字。 您还可以使用xmllint: xmllint --xpath "string(/details/result[name='Test1']/@id)" yourfile.xml --xpath:告诉 xmllint 使用 xpath 语法进行选择。 xpath选择器的详细信息: string(/details/result[name='Test1']/@id) string():制作字符串 /details/result:选择result元素的details子元素 [name='Test1']:包含一个name节点,其值为Test1 /@id:id属性值(result元素) 也许一个简单的 grep 和 awk 解决方案适合您。 grep -B1 Test1 sample.xml | awk '/id=/{gsub(/[^0-9]+/, "", $0); print $0 }' 完整回答OP的问题, #/bin/bash # # how to use xmllint to get information from specific elements # REQUIRES libxml2 (sorry Snow Leopard!) mytestxml=' <details> <result id="1234567890"> <name>Test1</name> </result> <result id="5345345433"> <name>Test2</name> </result> <result id="9572385354"> <name>Test3</name> </result> </details> ' echo Test Document is :"$mytestxml" echo Get the contents of the \''id'\' attribute of a specific \''result'\' element query=\''string(/details/result[3]/@id)'\' echo xpath query is "$query" myresult=$(echo "$mytestxml" | xmllint --xpath 'string(/details/result[3]/@id)' - ) echo info returned is "$myresult" echo "" echo Get the specific \''result'\' node whose \''name'\' element is \"Test1\" query=\''/details/result[name="Test1"]'\' echo xpath query is "$query" myresult=$(echo "$mytestxml" | xmllint --xpath '/details/result[name="Test1"]' - ) echo info returned is "$myresult" echo "" echo Get the \''id'\' attribute of the specific \''result'\' node whose \''name'\' element is \"Test1\" query=\''string(/details/result[name="Test1"]/@id)'\' echo combined xpath query is "$query" myresult=$(echo "$mytestxml" | xmllint --xpath 'string(/details/result[name="Test1"]/@id)' - ) echo info returned is "$myresult" 获取特定“result”元素的“id”属性的内容。 xpath 查询是: 'string(/details/result[3]/@id)' 返回的信息是:9572385354 获取'name'元素为“Test1”的特定'result'节点 xpath 查询是: '/details/result[name="Test1"]' 返回的信息是: <result id="1234567890"> <name>Test1</name> </result> 获取'name'元素为“Test1”的特定'result'节点的'id'属性 组合的 xpath 查询是: 'string(/details/result[name="Test1"]/@id)' 返回的信息是1234567890 希望这对找到此页面的其他人有用。 :o) 这样的东西应该与 xmlstarlet 一起使用(对我有用): xmlstarlet sel --template --match "/details/result[name='Test1']" --value-of "@id" test.xml

回答 5 投票 0

使用 JSXB 将 xml 通用映射到 java bean

我已将 xml 内容映射到 java bean。我正在使用 JAXB 将其转换为我的 bean 类。 这很好用。但为此我需要事先知道xml的内容。如果添加一些新元素...

回答 1 投票 0

TextInput 在小屏幕手机上显示太窄

在以下 xml 中,“message_entry”在小屏幕 (240 x 320) 上显示太窄,但在较大屏幕 (480 x 640) 上显示良好。 在以下 xml 中,“message_entry”在小屏幕 (240 x 320) 上显示太窄,但在较大屏幕 (480 x 640) 上显示良好。 <androidx.cardview.widget.CardView android:id="@+id/reply_bar_card" android:layout_width="match_parent" android:layout_height="wrap_content" app:cardBackgroundColor="@color/replyBarCard" app:cardCornerRadius="24dp" app:cardElevation="5dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:paddingBottom="24dp"> <ProgressBar android:id="@+id/send_progress" style="@style/Widget.AppCompat.ProgressBar.Horizontal" android:layout_width="match_parent" android:layout_height="3dp" android:indeterminate="true" android:visibility="invisible" /> <HorizontalScrollView android:id="@+id/attached_image_scroller" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="@dimen/message_list_padding" android:layout_marginEnd="@dimen/message_list_padding" android:paddingTop="8dp" android:paddingBottom="8dp" android:scrollbars="none" android:visibility="gone"> <LinearLayout android:id="@+id/attached_image_holder" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="12dp" android:layout_marginEnd="12dp" android:orientation="horizontal" /> </HorizontalScrollView> <LinearLayout android:id="@+id/smart_reply_container" android:layout_width="match_parent" android:layout_height="56dp" android:layout_marginStart="@dimen/message_list_padding" android:layout_marginEnd="@dimen/message_list_padding" android:gravity="end" android:orientation="horizontal" android:visibility="gone"> <ImageButton android:id="@+id/close_smart_replies" android:layout_width="32dp" android:layout_height="48dp" android:layout_gravity="center_vertical" android:layout_marginStart="8dp" android:background="?selectableItemBackgroundBorderless" android:clickable="true" android:contentDescription="@string/use_smart_replies" android:src="@drawable/ic_cancel" android:tint="@color/secondaryText" /> <LinearLayout android:id="@+id/smart_reply_suggestions_container" android:layout_width="0dp" android:layout_height="match_parent" android:layout_marginEnd="12dp" android:layout_weight="1" android:gravity="end" android:orientation="horizontal" /> </LinearLayout> <LinearLayout android:id="@+id/send_bar" android:layout_width="match_parent" android:layout_height="50dp" android:layout_marginStart="@dimen/message_list_padding" android:layout_marginEnd="@dimen/message_list_padding" android:alpha="0" android:clipToPadding="false" android:gravity="center_vertical|start" android:orientation="horizontal" android:padding="8dp" android:translationY="-32dp"> <ImageButton android:id="@+id/select_sim" android:layout_width="32dp" android:layout_height="48dp" android:background="?selectableItemBackgroundBorderless" android:clickable="true" android:contentDescription="@string/select_sim" android:src="@drawable/ic_sim" android:tint="@color/secondaryText" android:visibility="gone" /> <ImageButton android:id="@+id/view_scheduled_messages" android:layout_width="32dp" android:layout_height="match_parent" android:background="?selectableItemBackgroundBorderless" android:clickable="true" android:contentDescription="@string/view_scheduled_messages" android:src="@drawable/ic_schedule_small" android:tint="@color/secondaryText" android:visibility="gone" /> <FrameLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_marginEnd="8dp"> <ImageButton android:id="@+id/attach" android:layout_width="32dp" android:layout_height="48dp" android:layout_gravity="center_vertical|start" android:background="?selectableItemBackgroundBorderless" android:clickable="true" android:contentDescription="@string/attach" android:src="@drawable/ic_attach" android:tint="@color/secondaryText" /> <TextView android:id="@+id/text_counter" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom|center_horizontal" android:layout_marginBottom="2dp" android:gravity="center_horizontal" android:textColor="@color/secondaryText" android:textSize="12sp" /> </FrameLayout> <com.google.android.material.textfield.TextInputEditText android:id="@+id/message_entry" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:background="@null" android:backgroundTint="@color/drawerBackground" android:hint="@string/type_message_to" android:imeOptions="actionSend|flagNoExtractUi" android:inputType="textCapSentences|textAutoCorrect|textMultiLine" android:maxLines="@integer/message_list_fragment_line_entry_count" android:minHeight="40dp" android:padding="8dp" android:paddingStart="8dp" android:paddingEnd="18dp" android:scrollHorizontally="false" android:textSize="16sp" /> <com.google.android.material.floatingactionbutton.FloatingActionButton android:id="@+id/send" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="8dp" android:layout_marginEnd="8dp" android:contentDescription="@string/send_message" android:src="@drawable/ic_send" app:elevation="0dp" app:fabSize="mini" app:rippleColor="@android:color/white" /> </LinearLayout> <ViewStub android:id="@+id/attach_stub" android:layout_width="match_parent" android:layout_height="@dimen/attach_menu_height" android:layout="@layout/view_attach_menu" /> </LinearLayout> </androidx.cardview.widget.CardView> 小屏幕:(添加红框用于说明) 大屏幕:(添加红框作为说明) 预期的行为就像大屏幕,其中“message_entry”尽可能宽。为什么“message_entry”在小屏幕上那么窄?我该如何解决它? 原来是因为dimens.xml文件夹下有多个res文件造成的。这用于支持多种屏幕尺寸,在较小屏幕的 dimens.xml 中,有 <dimen name="message_list_padding">96dp</dimen>。一旦更改为0dp,布局就如预期的那样。 有关多个 dimens.xml 文件的更多信息,请参阅此答案中的#2。

回答 1 投票 0

rtf 模板中的除法公式问题 - XML Publisher

我有一个单元格(假设单元格 A)中的“bucket_3”列和另一个单元格(假设单元格 B)中的“EXPOSURE”列的总和。 我正在尝试使用以下代码计算 A 除以 B 即 A/B: 我有一个单元格(假设单元格 A)中的“bucket_3”列和另一个单元格(假设单元格 B)中的“EXPOSURE”列的总和。 我正在尝试使用以下代码计算 A 除以 B 即 A/B: <?if:sum(EXPOSURE)=0 ?> <?xdoxslt:div(sum(BUCKET_3),sum(EXPOSURE))?> <?else?> <?end if?> this gives no result. 当我尝试时 <?xdoxslt:div(sum(BUCKET_3),sum(EXPOSURE))?> 结果为 0。 请帮忙。预先感谢。 请尝试以下 xdofx 功能。这应该有效- <?xdofx: sum(BUCKET_3) div sum(EXPOSURE)?> https://docs.oracle.com/cd/E21764_01/bi.1111/e13881/T527073T558233.htm

回答 1 投票 0

如何将图像放在按钮上android studio

我有一个512x512px的齿轮png图像(用于设置),我希望它放在一个按钮上。 我试图在可绘制的目录中创建一个目录以保持事物井井有条,但这不起作用,所以我把...

回答 1 投票 0

使用冒泡排序算法进行向量排序

我是编程新手,目前正在开发一个应用程序来帮助管理我的家庭预算。所有数据都存储在 XML 文件中。为了按日期对向量进行排序,我实现了冒泡排序算法......

回答 1 投票 0

如何在 Odoo 17 中的动作锯齿内添加按钮

我在第一个红框中有一个按钮,我想把它放在锯轮图标中,我该如何编写js来做到这一点? 我在模型 hr.employee 的树视图中。

回答 1 投票 0

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