问题标签 [domparser]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c++ - 删除特定属性后如何删除在 XML 文件中创建的空白行
例如,我有一个 XML 文档
我正在使用 DOM 解析器来解析C++代码中的 XML 文件。我正在删除一个特定的属性,例如 id = 3。
使用 Xerces 库中的 API,我删除了该属性,但我在删除该属性的地方得到了一个空行。
删除操作如下。我将从给定文件中删除所需的属性并将剩余内容复制到临时文件但创建一个空行。
我需要输出如下,删除后文件中不应出现空行
javascript - javascript DOMParser 解析文档而不是字符串
我在网上和 StackOverflow 上进行了搜索,但没有找到与我遇到的问题非常相似的东西。
我有下面的 HTML 字符串:
我试图用以下方式解析它:
问题是,即使字符串以 tag 开头并且没有子节点,我也会从警报中得到以下回报:
所以我的问题是:
- 为什么解析的代码不以 开头
<script>
,因为字符串呢? - 难道我做错了什么?
- 我怎样才能正确解析该字符串代码?我的意图是从脚本和 img 标签中捕获 src。
请帮忙。谢谢。
java - Java DOM getElementByID
我在 Java 中使用 DOM 解析器将子节点添加到现有节点中。
我的 XML 是
有没有办法直接在现有节点下添加子节点?我可以使用这样的东西吗?
我的代码
php - 从 a 获取文本
我在<li>
里面有几个标签是<div>
这样的:
如何two
使用 HTML DOM 解析器获取文本,然后将其放入数组中以供以后使用?
javascript - Parsing XML in a Web Worker
I have been using a DOMParser object to parse a text string to an XML tree. However it is not available in the context of a Web Worker (and neither is, of course, document.ELEMENT_NODE or the various other constants that would be needed). Is there any other way to do that?
Please note that I do not want to manipulate the DOM of the current page. The XML file won't contain HTML elements or anything of the sort. In fact, I do not want to touch the document object at all. I simply want to provide a text string like the following:
...and get back a suitable tree structure and a way to traverse it. I also do not care about schema validation or anything fancy. I know about XML for <SCRIPT>, which many may find useful (hence I'm linking to it here), however its licensing is not really suitable for me. I'm not sure if jQuery includes an XML parser (I'm fairly new to this stuff), but even if it does (and it is usable inside a Worker), I would not include an extra ~50K lines of code just for this function.
I suppose I could write a simple XML parser in JavaScript, I'm just wondering if I'm missing a quicker option.
javascript - 在 JavaScript 中解析 XML,尝试通过类名获取元素
我正在尝试使用 JavaScript 解析一个大型 XML 文件。网上看了一下,好像最简单的入手方式就是使用浏览器的DOM解析器。这行得通,我可以通过 ID 获取元素。我还可以获得这些元素的“类”属性,它会返回我所期望的。但是,我似乎无法按类获取元素。
在最新的 Chrome 中尝试了以下内容:
有任何想法吗?
android - 使用 html 标签解析文本
我必须从服务器解析一个 xml 文件;我尝试使用 DOm 解析器和 Sax 解析器,但我无法解析 html 标签,并且在找到第一个“<”时停止
这是我的解析器类:
android - android 4.0 API 中的 Dom 解析器
我的问题是 Dom Parser 不能在 Android 4.0 中工作,但它在 2.2 上工作,如果我在我的 4.0 模拟器中运行项目而不是下面的行不执行,这不会给出任何错误。
以下是我的 Java 代码:-
任何帮助将不胜感激,对不起我糟糕的英语交流。
android - android中XML SAX解析器、Pull解析器和DOM解析器的区别
我想知道Android中的XML SAX解析器、拉解析器和DOM解析器有什么区别。在什么条件下,性能和实现上哪一个更好?
谢谢。霍拜卜。
websphere-7 - 在 Websphere 7 中解析 ddm 文件 DOMParser 时出现 java.lang.LinkegeError
我正在使用 websphere 7. 来部署我的应用程序。部署时需要解析 *.ddm 文件来读取属性。我们正在使用 DOMParser 来解析文件。以下是代码。同样工作正常的是Tomcat。
得到以下异常。