android-xml-attribute 相关问题


Ansible 无法通过 XPath 读取属性(不是元素)

我尝试从 XML 文件读取 XML 属性的值,但收到此错误: Xpath /sca:composite/@revision 未引用节点! 我的 XML 文件如下所示: 我试图从 XML 文件中读取 XML 属性的值,但收到此错误: Xpath /sca:composite/@revision 未引用节点! 我的 XML 文件如下所示: <composite revision="1.0.1" xmlns="http://xmlns.oracle.com/sca/1.0"> ... </composite> 我的 Ansible 命令是: - name: 'Get revision' xml: path: 'composite.xml' xpath: '/sca:composite/@revision' content: attribute namespaces: sca: 'http://xmlns.oracle.com/sca/1.0' register: my_revision 我尝试过不少于20种XPath的排列方式,比如: /composite/@revision /composite/revision /sca:composite/@revision /sca:composite/revision /sca:composite/@sca:revision 并使用 content 作为 text 和 attribute。 我能得到的最接近的结果是用 XPath 匹配根节点:/sca:composite。 但我就是找不到该属性。 有什么建议吗? 我找到了一个做作的两步解决方法。首先,XPath 仅匹配元素。其次,导航 JSON 结果/匹配属性。 -name: 'Match XPath' xml: path: 'composite.xml' xpath: '/sca:composite/@revision' content: attribute namespaces: sca: 'http://xmlns.oracle.com/sca/1.0' register: xpath_match -name: 'Get revision' set_fact: my_revision: '{{xpath_match.matches[0]["{http://xmlns.oracle.com/sca/1.0}composite"].revision}}' 注意:XPath 匹配返回一个 JSON 对象,例如: { "matches": [ { "{http://xmlns.oracle.com/sca/1.0}composite": { "revision": "1.0.1" } } ] } 不要对 "composite" 的 JSON 字段名称感到困惑。它的语法是"{xmlnamespace}composite"


Android:在文本视图周围添加边框

如何使用 xml 布局在文本周围添加边框,如图所示 我尝试在布局中添加边框,但它与文本重叠。


Android Drawable:在 XML 文件中以百分比形式指定形状宽度?

我正在尝试创建一个简单的 Drawable,我想将其设置为视图的背景(使用 setBackgroundDrawable)。我只是想将可绘制的背景分成 2 个相等的矩形...


欢迎任何有关如何在 Android 开发中使用 XML 和 Compose 创建以下视图的帮助

如何根据上图做设计代码!!! 这里,当订单阶段为 1 时,订单阶段 2 和 3 的视图显示为灰色,因此根据订单阶段,视图支持...


反应本机项目中的 AndroidMennifest.xml 中未显示包名称

此 XML 文件似乎没有任何与之关联的样式信息。文档树如下所示。 此 XML 文件似乎没有任何与之关联的样式信息。文档树如下所示。 我到处都找到了,但找不到解决方案。请帮助我,因为这个问题我无法将我的应用程序连接到 firebase 你可以在 android > app > build.gradle 中找到它


Pydantic.BaseModel.model_dump() 通过 AttributeError

我正在尝试使用 Pydantic.BaseModel.model_dump() 但当我调用它时 AttributeError: type object 'BaseModel' has no attribute 'model_dump' 引发。还尝试实例化 BaseModel 类。


android 高度隐藏布局的所有视图

我的布局如下面的屏幕截图所示。 我的代码如下。 我的布局如下面的屏幕截图所示。 我的代码如下。 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/white" > <LinearLayout android:id="@+id/ll_main" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="@dimen/margin_smallxx" android:layout_marginTop="@dimen/margin_normalxx" android:layout_marginEnd="@dimen/margin_smallxx" android:orientation="vertical"> ....... 现在我想为盒子添加阴影,如下所示。 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/white" > <TextView style="@style/shadowStyle" android:elevation="20dp" android:layout_alignTop="@id/ll_main" android:layout_alignBottom="@id/ll_main" android:layout_alignStart="@id/ll_main" android:layout_alignEnd="@id/ll_main" /> <LinearLayout android:id="@+id/ll_main" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="@dimen/margin_smallxx" android:layout_marginTop="@dimen/margin_normalxx" android:layout_marginEnd="@dimen/margin_smallxx" android:orientation="vertical"> shadowStyle如下。 <style name="shadowStyle" parent="@android:style/TextAppearance"> <item name="android:layout_width">match_parent</item> <item name="android:layout_height">match_parent</item> <item name="android:text"></item> <item name="android:background">@drawable/myrect</item> <item name="android:outlineSpotShadowColor">@color/shadow_color</item> </style> 和myrect.xml形状如下。 <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="#FFFFFF" /> <corners android:radius="20dp" /> </shape> 当我添加此内容时,下面的所有视图都会被隐藏,这很奇怪。 应用程序截图如下。 我将 shadow_color 表示为 #FF00FF 仅用于测试目的。 知道如何使其正确吗?我是不是错过了什么... 以下是我根据mãĴď评论所做的事情 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" android:background="@color/white"> <androidx.cardview.widget.CardView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="@dimen/margin_smallxx" android:layout_marginTop="@dimen/margin_normalxx" android:layout_marginEnd="@dimen/margin_smallxx" app:cardCornerRadius="10dp" app:cardElevation="20dp" android:outlineSpotShadowColor="@color/shadow_color" > <LinearLayout android:id="@+id/ll_main" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> ........ </LinearLayout> </CardView> </RelativeLayout> 这意味着我们将拥有卡片视图并将整个布局放入其中......


如何获取所有具有指定href属性的元素

假设我有一些带有 href=/href_value/attribute 的元素。如何获取所有元素,使其 href 属性具有 href_value 值?


Python:“Doc2Vec”对象没有属性“dv”

感谢您的建议,我已经编辑了问题 我遇到这个: AttributeError: 'Doc2Vec' object has no attribute 'dv' 错误来自 回溯(最近一次调用最后一次): 文件“F:\Projects\项目代码\


AnimationSet 未按预期执行顺序动画

如果我手动执行多个连续动画。它按预期工作。这是我的可行代码 扩展.xml 如果我手动执行多个连续动画。它按预期工作。这是我的可行代码 scale_up.xml <?xml version="1.0" encoding="utf-8"?> <scale xmlns:android="http://schemas.android.com/apk/res/android" android:fromXScale="1.0" android:fromYScale="1.0" android:toXScale="1.1" android:toYScale="1.1" android:pivotX="50%" android:pivotY="50%" android:fillAfter="true" android:interpolator="@android:anim/decelerate_interpolator" android:duration="@android:integer/config_shortAnimTime" /> scale_down.xml <?xml version="1.0" encoding="utf-8"?> <scale xmlns:android="http://schemas.android.com/apk/res/android" android:fromXScale="1.1" android:fromYScale="1.1" android:toXScale="1.0" android:toYScale="1.0" android:pivotX="50%" android:pivotY="50%" android:fillAfter="true" android:interpolator="@android:anim/decelerate_interpolator" android:duration="@android:integer/config_shortAnimTime" /> 手动执行连续动画 public void startAnimation(Button button) { // Define the scale up animation Animation scaleUpAnimation = AnimationUtils.loadAnimation(this, R.anim.scale_up); // Define the scale down animation Animation scaleDownAnimation = AnimationUtils.loadAnimation(this, R.anim.scale_down); scaleUpAnimation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { button.startAnimation(scaleDownAnimation); } @Override public void onAnimationRepeat(Animation animation) { } }); button.startAnimation(scaleUpAnimation); } 结果 但是,如果我尝试使用 AnimationSet 替换上述代码,动画结果就会损坏。 public void startAnimation(Button button) { // Define the scale up animation Animation scaleUpAnimation = AnimationUtils.loadAnimation(this, R.anim.scale_up); // Define the scale down animation Animation scaleDownAnimation = AnimationUtils.loadAnimation(this, R.anim.scale_down); // Create an AnimationSet to combine both animations // (It makes no difference whether I am using true or false) AnimationSet animationSet = new AnimationSet(true); animationSet.addAnimation(scaleUpAnimation); animationSet.addAnimation(scaleDownAnimation); // Apply the animation to the button button.startAnimation(animationSet); } 使用AnimationSet的结果(动画不流畅) 我可以知道为什么AnimationSet不起作用吗?谢谢。 我们需要使用setStartOffset来延迟第二个动画的执行。这是解决上述问题的完整代码片段。 public void startAnimation(Button button) { int config_shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime); // Define the scale up animation ScaleAnimation scaleUpAnimation = new ScaleAnimation( 1f, 1.02f, 1f, 1.02f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f ); scaleUpAnimation.setInterpolator(new DecelerateInterpolator()); scaleUpAnimation.setDuration(config_shortAnimTime); scaleUpAnimation.setFillAfter(true); // Define the scale down animation ScaleAnimation scaleDownAnimation = new ScaleAnimation( 1.02f, 1f, 1.02f, 1f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f ); scaleDownAnimation.setInterpolator(new AccelerateInterpolator()); scaleDownAnimation.setDuration(config_shortAnimTime); scaleDownAnimation.setFillAfter(true); scaleDownAnimation.setStartOffset(scaleUpAnimation.getDuration()); // Create an AnimationSet to combine both animations AnimationSet animationSet = new AnimationSet(false); animationSet.addAnimation(scaleUpAnimation); animationSet.addAnimation(scaleDownAnimation); // Apply the animation to the button button.startAnimation(animationSet); }


资源提供的整数在运行时出现乱码

在我的 Android 应用程序中,我创建了文件 app/src/main/res/values/integers.xml: 在我的 Android 应用程序中,我创建了文件 app/src/main/res/values/integers.xml: <?xml version="1.0" encoding="utf-8"?> <resources> <integer name="server_port">8080</integer> </resources> 然后我就有了 public class MyApplication extends Application { final MyServer server = new MyServer(R.integer.server_port); } 但是,当应用程序启动时,日志语句显示该值(即 R.integer.server_port)为 2131296322。 为什么数值会出现乱码?这不是整数资源应该如何实现的吗? R.integer.server_port 给出整数的资源 ID,而不是整数本身。为了获得实际的整数,你必须做getResources().getInteger(R.integer.server_port)。但是,这需要对原始代码进行一些修改,因为在实例化 MyApplication 时尚未设置资源。相反,你可以这样做 public class MyApplication extends Application { MyServer server; @Override public void onCreate() { super.onCreate(); server = new MyServer(getResources().getInteger(R.integer.server_port)); } }


如何下载使用 StreamWriter 编写的 xml 文件作为 xml 文件

我有一个使用 StreamWriter 用 C# 编写的 XML 文件,代码如下: 字符串文件名 = Session.SessionID + ".xml"; 字符串文件路径 = "h:\root\home\mchinni-001\www\site1\OUTFolde...


活动深层链接 - IllegalArgumentException:缺少必需的参数并且没有 android:defaultValue

在我的应用程序中,我有以下结构: 在我的应用程序中,我具有以下结构: <!-- AndroidManifest.xml --> <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"> <application> <activity android:name=".DeepLinkActivity" android:exported="true" android:launchMode="singleInstancePerTask"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:host="myhost" android:path="/mypath" android:scheme="myscheme" /> </intent-filter> </activity> </application> </manifest> <!-- activity_deep_link.xml --> <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"> <androidx.fragment.app.FragmentContainerView android:id="@+id/navHostFragment" android:name="androidx.navigation.fragment.NavHostFragment" android:layout_width="match_parent" android:layout_height="match_parent" app:defaultNavHost="true" tools:navGraph="@navigation/my_nav_graph" /> </FrameLayout> // DeepLinkActivity.kt class DeepLinkActivity : AppCompatActivity() { private lateinit var binding: ActivityDeepLinkBinding override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding = ActivityDeepLinkBinding.inflate(layoutInflater) setContentView(binding.root) setUpNavigationGraph() } private fun setUpNavigationGraph() { val navHostFragment = supportFragmentManager .findFragmentById(binding.navHostFragment.id) as NavHostFragment val navController = navHostFragment.navController val navGraph = navController.navInflater .inflate(R.navigation.my_nav_graph) .apply { this.setStartDestination(R.id.notTheStartDestinationFragment) } val startDestinationArgs = bundleOf( "someRequiredArgumentHere" to false ) navController.setGraph(navGraph, startDestinationArgs) } } 当我通过 ADB (adb shell am start -d myscheme://myhost/mypath) 通过深度链接打开该活动时,该活动正常启动。 但是当我通过 Chrome 应用程序启动它时,应用程序崩溃了: 原因:java.lang.IllegalArgumentException:缺少必需参数“someRequiredArgumentHere”并且没有 android:defaultValue 观察:我正在使用 Safe Args 插件。 我做错了什么以及为什么行为不同? 我刚刚发现为什么在通过浏览器导航时会忽略 startDestinationArgs。 如果我们检查NavController#setGraph(NavGraph, Bundle?)的内部代码,如果没有发生深层链接,NavController#onGraphCreated(Bundle?)只会使用startDestinationArgs。 作为一种解决方法,在设置导航图之前,我只需清除活动的意图(但这可能不是解决该问题的最佳方法)


如何定义 XML 模式并使用 JS 验证 XML

我正在寻找一种在 XSD 文件中定义 XML 架构的方法,然后使用所述架构来验证存储在字符串中的 XML。我希望能够使用 JavaScript 来完成这一切,因为我...


如何将xml树放入单独的python文件中?

我使用 python 和 xml.etree.ElementTree 来构建 xml 文件。但只有基础树有超过 350 行,我想将其放在一个单独的文件中。我怎么做? 我的代码: 导入 xml...


从 xml 中的 php 输出中删除字符

我编写了一个从 Magento Commerce 数据库中提取的 xml/php 文档,以创建包含其中所有项目的 XML 文档,以便 Google 购物可以导入这些项目。谷歌的...


在Python中将注释xml转换为文本

我有一个文件夹,里面有大量带有图像注释数据的xml文件。我想将xml文件转换为文本文件,以便它们可以用于YOLO模型 我已经通过


.NET:从 XPath 中定位原始 XML 文档中的节点

我正在尝试以编程方式定位由 XPath 标识的 XML 文本中的元素。也就是说,不仅要在解析的 XML 结构中找到引用的元素,还要确定开始和结束


Java XML解析:文档(DeferredDocumentImpl)与文档(XMLDocument)在不同环境下的差异

我在 Java 8 中遇到 XML 解析问题,其中相同的代码在生产环境中的行为与较低环境中的行为不同。 这是打印 XML nodeValue 的 Java 代码片段...


PHP Curl 下载远程 XML 文件

我正在尝试自动化工作流程并下载远程 xml 文件 (google-shopping-feed.xml) 我的函数如下所示 函数 saveRemoteFile($url, $filename) { 全球$


在 Java 中使用 JAXB 从 XML 反序列化 HashMap

这是我的 XML 内容: 我自己制作的,所以我可以改变它,只是发现这个结构适合我的数据。 道具 ...


如何将xml文件嵌入到资源文件中

我想将xml文件嵌入到我的项目中的资源文件中,每当我需要该文件时,我必须从资源中获取它并使用它,如何做到这一点,我想修改xml文件的内容取决于。 ..


如何在XML中对不同级别的标签进行分组?

这里是源xml。 我们有 1 个标头级别标签。 行级别标签包含在 1 个标题级别下。 ABC公司 在 ...


如何使用wcf通过post发送xml

如何在 WCF 的帮助下通过 post 发送 xml 数据? 例如我有一些代码: 公共接口 IServiceForILobby { 【运营合同】 [WebInvoke(方法 = "POST")] 字符串 SendXml(


如何通过正则表达式在字符串中重复查找相同的xml元素

我想通过正则表达式找到字符串中重复出现的多个相同的xml元素(但它在xml元素中包含不同的值)。 我尝试过,但无法在 python 中找到正确的编码...


如何为Android Pay添加假信用卡Visa?

我正在开发一个Android应用程序,它使用android pay进行付款。在 https://codelabs.developers.google.com/codelabs/android-pay/#13 网站中。这是网站上写的


Java Apache 在“Content-Disposition:”中设置附加参数

我正在使用 java Apache 5.3.1,我正在尝试使用 XML 发送多部分,并且需要以下“Content-Disposition:”集 - 内容处置:表单数据;名称=“xml”;文件名=...


Saxon XSLT 可以将 XML 保存到 eXist-db 吗?

Saxon XSLT 可以将 XML 保存到 eXist-db 吗?我搜索了文档和论坛,但找不到任何明确记录的内容。我可以使用 doc('http://localhost:8080/exist/rest...


在 Android 14 中启用输入法时出错 - ANDROID

在 Android 中,启用输入之前工作正常,但当我在 Android 14(sdk 34)中测试时,出现以下异常。 致命异常:java.lang.SecurityException:设置键:<


将 Unix 文件的内容复制到 Postgres 表列

我有一个要求,即在 Unix 路径上接收 XML 文件。我想将此 xml 文件的内容复制到 Postgres 表的一列中。 收到的示例文件:/home/bojack/test.xml ...


确实 API XML 在多次请求后被阻止

我一直在使用 Indeed.com XML Feed API 来收集测试申请的职位信息。看来我们的服务器 IP 的 API 被阻止并抛出以下错误。 卷曲:(56) 接收 f...


Android Studio:导入库的奇怪问题

我正在尝试使用 Android Studio (gradle 8) 和公共 github 库:AndroidUSBCamera 创建一个 Android 应用程序。 我不认为我面临与库相关的问题,而是依赖/gradle/android


XML 文档位于包中,但从未复制到输出目录

生成的包确实包含 DLL 文件旁边的 XML 文件,但是,当使用其他项目的包时,文档永远不会复制到输出目录。 这是重新...


Android Studio 中选择一行代码的快捷方式

android studio中有选择一行代码的捷径吗?


使用组时无法识别 TestNG 参数

使用 testNG xml 运行测试套件时,测试将正常运行,并且 xml 文件中的所有参数均按预期使用。当我将分组添加到我的 @Test 方法并添加组时...


Nuget 包不复制内容(XML 文件)

我们正在使用 TFS 构建步骤来创建 nuget 包。所以 TFS 自动完成这项工作,我的意思是,它首先创建 nuspec 文件,然后创建 nupkg。 所以,这个包包含我的 xml setti...


OWASP ZAP 扫描工具不支持 XML 格式的请求

我想使用 ZAP 工具执行扫描并使用 CI 管道生成报告。 .Net Web API 接受请求并返回 XML 格式的响应。 API 工作正常。 每当我运行 ZAP 工具时...


如何使用布尔属性定义 XML 模式并使用 JS 验证 XML [重复]

我正在寻找一种根据自定义 XML 模式(XSD 文件)解析 XML 字符串的方法,其中包括布尔属性,例如在 HTML 中使用“选中”或“隐藏”等进行的操作: 我正在寻找一种根据自定义 XML 模式(XSD 文件)解析 XML 字符串的方法,其中包括布尔属性,例如在 HTML 中使用“选中”或“隐藏”等进行的操作: <div checked hidden> hello world </div> 我不能只使用 HTML 和 HTML 解析器,因为我希望能够定义自己的允许布尔属性列表。我无法使用纯 XML,因为纯 XML 根本不允许布尔属性。 有什么方法可以利用带有布尔属性的 XML 吗? 我希望能够在 JavaScript 中完成这一切,但如果绝对必要,我可以使用其他东西。 Java 脚本不存在使用 XSD 对客户端 XML 验证的直接支持。我能找到的最好的客户端是这个用于 java 脚本的第三方库:xmljs。还有一个展示其用法的演示:demo. 对于复杂且更强大的验证,我建议在服务器端进行,使用 Node.js 库(例如 libxmljs)或其他语言的支持,例如 Java 库 Xerces 或 C# 中的 XmlSchemaSet 类。


AppleScript。可能是不合理的语法复杂化。从 xml 导入 iTunes 播放计数

我是 AppleScript 新手,只练习了几周。我编写了一段代码,用于从音乐应用程序导入的 xml 文件(实际上更像是 plist)传输信息(


使用 kotlin/compose 与 java/xml 指南相比

我猜我应该说我对 kotlin 的 compose 很陌生,我只用过 java/xml 的项目,我在这里很困惑。 使用java,我们为每个屏幕提供具有自己的逻辑/设计的片段。这里...


使用 xml 中多个位置存在的元素创建 tde 模板

我正在使用 MarkLogic 进行 TDE。我有一个特定的场景,需要提取 XML 中不同级别可用的城市。城市值必须转到同一列值而不是选项卡


在 Python 中分割大型 XML 文件

我希望将一个巨大的 XML 文件分割成更小的部分。我想扫描文件查找特定标签,然后获取 和 之间的所有信息,然后将其保存到文件中,然后继续


将嵌套 XML 转换为 R 中的数据帧

我正在尝试将 ClinicalTrials.gov 中的 XML 数据转换为数据框架,以便在 R 中进行分析。我有一个 URL,允许我在每项研究中选择我要查找的特定字段。每行和


Android 无法请求 Android 13 设备的存储权限

在我的Android项目中,我要求用户打开相机。除此之外,我还要求获得存储许可。该权限适用于 Android 版本 12 及以下版本,但适用于...


如何通过值匹配 xml 属性名称并仅从元素列表中显示该元素

我是 xslt 的新手。我只想显示 xml 列表中匹配的项目。 使用 xslt 转换。 在这种情况下,我只想显示名称为“一”和“二”的属性 那...


MAUI 中切换风格问题

我正在我的 MAUI 项目上使用开关。我在 Android 设备 10 和 11 上发现了样式问题,但在 Android 12 上,不存在样式问题。 以下是 Android 10 和 Android 11 的屏幕截图。 贝尔...


在 Android Studio 可组合项中使用滑块

我正在尝试使用 Android Studio 编写一个 Android 应用程序。 看来最新的 android studio 只支持 Kotlin。 我想要一个函数来生成一个滑块,该滑块的起始值介于...


如何使用powershell更新xml文件中的节点类型元素

我有一个下面的 xml 文件示例。我想更新元素设置节点并将其更改为“NewSettings”(以粗体突出显示)。我尝试通过 powershell 使用不同的属性来完成此操作...


Xamarin MediaPicker 在 Android 11 上保存图像,但在 Android 10 上不保存图像

我正在关注 Xamarin.Essentials:媒体选择器 我有两个 Android 设备用于测试,安装了 android 11 的设备拍摄照片并将其保存到手机上,另一个


如何在 Android for Cars Android Auto 中向行添加操作?

我想在 Android Auto 的汽车应用程序 Android 中显示一个列表。该列表应包含带有两个按钮的项目,用于单独的操作。 我尝试添加 addAction(),但似乎没有用...


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