[英]Test file to XML file (Problem with the structure)
我想將文本文件轉換為具有特定結構的 XML 文件。 我想將文本分成段落,這些段落將進入一章。 例如,每一章應該有 3 個段落。 XML 的根元素稱為“Book”。 再舉一個例子,我有這個文本文件: Lorem ipsum dolor sit amet, consectetur adipisci ...
[英]Test file to XML file (Problem with the structure)
我想將文本文件轉換為具有特定結構的 XML 文件。 我想將文本分成段落,這些段落將進入一章。 例如,每一章應該有 3 個段落。 XML 的根元素稱為“Book”。 再舉一個例子,我有這個文本文件: Lorem ipsum dolor sit amet, consectetur adipisci ...
[英]Create Woodstox's XMLValidationSchema from multiple resource files
我有一個主文件。xsd 有一個導入,其架構位置指向 file1.xsd,如下所示: 我在 Docker 容器上運行它,它抱怨在容器主文件夾中找不到 file1.xsd: 如何將這兩個 xsd 資源鏈接到同一個 XMLValidationSchema 中,這是我必須獲得的強制類型? (修改 doc ...
[英]Java - Update Elements in Large XML Files
我使用非常大的 XML 數據集 (1 GB+),需要回溯和更新每個節點的特定元素,具體取決於后面其他元素的值。 例如,在這個記錄/節點中: 由於“經驗”大於 5 年,角色需要從“Associate”更新為“Senior”。 我想避免通過 DOM 將整個文件加載到 memory 中。 理想情況下,我會 ...
[英]Streaming xml in java
我正在嘗試讀取大型 XML 文件,我只想讀取車主,但我無法將整個 xml 加載到 memory,該怎么做? XML 文件: 例如,這段代碼並不知道它到底讀的是什么……如何確定我們讀的是車主? ...
[英]Understanding XMLStreamReader and START_ELEMENT
考慮以下 XML 文件:% cat test.xml <?xml version="1.0" encoding="utf-8"?> <root> </root> 為什么我在使用XMLStreamReader時沒有收到START_ELEMENT事件。 代碼是(從 ...
[英]What exactly does `XMLStreamReader.getEncoding()` do?
XMLStreamReader的getCharacterEncodingScheme()返回<?xml encoding="utf-8">行的encoding屬性。 但是如果getCharacterEncodingScheme()就足夠了,那為什么還有getEncoding()? ...
[英]Using StaX how to read UTF-8 data with & characters?
如何使用 Stax 讀取標簽文本中的所有字符,甚至是&amp; ? 我對傳入的 XML 文件沒有影響。 一個示例 XML 文件是:<?xml version="1.0" encoding="UTF-8"?> <Employees> <Employee ...
[英]Efficient way to reduce memory (RAM) consumption while writing huge file data into XML
我必須將 7 個列表寫入 XML 文件,每個列表的大小為 1 GB 到 5 GB。 預期的 XML 文件如下: Java對象是這樣的: 將所有列表包裝成一個對象(目錄)到一個 Java 對象中,並且一次編組會消耗大量內存,而且每次當這個列表大小增加時,我們都必須擴展我們的基礎設施。 下面 ...
[英]ZipFileInputStream read method is delaying the process of marshalling when using StaxEventItemWriter in Spring Batch
前言我在spring-boot應用程序中使用spring batch 。 Spring 引導版本為2.3.3.RELEASE 。 我有一個multi-step作業,它在第一步中驗證 xml 文件 header,然后在chunk oriented step中read transaction ,對每個 ...
[英]Xml Transformer give me an error when trying to transform a StaxSource into a StreamResult
嘗試將 Staxsource 轉換為 StreamResult 給我一個錯誤(在 Wildfly 24 上使用 Adoptopenjdk 11-hotspot 運行時) 但是從單元測試中執行的相同代碼沒有錯誤地通過並且正確地完成了工作(使用 Adoptopenjdk 11-hotspot) 這是 ...
[英]How to merge two XML files with certain condition using StAX
例如,假設我們有兩個 XML 文件: “1.xml” “2.xml” 對於合並文件,條件是如果第二個文件中的學生 ID 與第一個文件中的學生 ID 匹配,則將其從第二個文件中取出。 合並后的文件應如下所示: “合並.xml” 我該怎么做? 提前致謝! ...
[英]DTD parsing with axiom
我正在嘗試使用 axiom 1.2.22 和 woodstox 6.2.6 來解析帶有 doctype 的 XML 文檔。 (我使用的是 OpenJDK 11,但這應該沒有任何區別。)我遇到了在如何忽略 Apache 的 AXIOM 中的 DTD 解析中提到的相同錯誤: 根據https://is ...
[英]Element being returned as NULL when parsing through StAX
我正在嘗試讀取 XML 文件元素的屬性,為此我正在使用庫 jdom2 和 Stax。 我試過在控制台中打印根元素的子元素,而 includeAll 確實是根元素的子元素。 為什么它被返回為 NULL? ...
[英]Is there a way to store the XMLStreamReader values temporarily within another XMLStreamReader for validations?
我不確定這是否可能,所以無論如何我都想詢問並澄清,因為即使經過大量搜索和嘗試,我也無法在這里找到與此類似的任何東西。 如果發現重復真的很抱歉。 我正在嘗試使用XMLStreamReader解析 XML 文件。 閱讀后,我必須對我的localpart進行一些檢查,據此我需要將此XMLStreamRe ...
[英]Unable to unmarshal the XML to my class using the XMLEventReader
我正在嘗試對大型XML文件執行JAXB Unmarshalling ,因此使用XMLEventReader但它沒有按預期工作並且沒有執行Unmarshalling 。 以下是我試圖unmarshal組的 XML 文件: 以下是將用於unmarshalling的Customer.class : 以下 ...
[英]Stax XMLStreamReader check for the next event without moving ahead
我有一個包含許多事件的大型XML文件。 我想unmarshal它們。 因為它是一個大文件,所以我想一個一個地unmarshal組它們,這樣整個文件就不會存儲在 memory 中。它適用於某些事件,但由於它無法將 map 轉換為特定的 class 而失敗,因為它已經存在在接下來的活動中。 注意:我知道 ...
[英]STAX to modify a nested XML with conditions and write back for Huge XML- around 6 GB
I am a beginner to java and have been working on a code to unzip a zip file containing around 100 000 XML files and then merging those files into 1 ...
[英]How to be Sonar compliant with the XMLInputFactory and woodstox library registered implementation?
我正在嘗試遵守以下聲納攔截器規則: XML 解析器不應受到 XXE 攻擊 (java:S2755) XML 規范允許使用內部或外部實體(文件系統/網絡訪問......),這可能導致機密文件泄露或 SSRF 等漏洞。 在 Sonar 規則描述中,他們給出了如何合規的示例: 我的問題是在應用程序的 ...
[英]How to use XSD for non namespaced documents
最近我遇到了一個服務,它在 XML 中返回它的結果,有點像以下方式<event> <event-header> ... </event-header> <event-body> ... </event-body&g ...
[英]Java - Event How to get value without namespace (using stax)
我想在沒有命名空間的情況下編寫 xml 文件的每個事件: 我想刪除: ['http://aaa.en/ccc']: XML 文件: ...