的順序我有一個代碼行是這樣的:JAXBContext中和的Marshaller改變XML命名空間
StringWriter writer = new StringWriter();
JAXBContext jc = JAXBContext.newInstance(namespace);
Marshaller marshaller = jc.createMarshaller();
marshaller.marshal(input, writer);
當namespace = "nfpa:nfpares"
。我有一個生成的內容是這樣的:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ServiceRequest xmlns:ns2="nfpares" xmlns="nfpa">
...
</ServiceRequest>
,但不知何故,在庫(我沒有控制),開發者還使用JAXBContext
和相同的命名空間的另一部分,但所產生的內容是:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ServiceRequest xmlns="nfpa" xmlns:ns2="nfpares">
...
</ServiceRequest>
注意名稱空間仍然相同,但是它們的排序已經切換。我需要對原始內容進行加密驗證。除了命名空間的順序之外,這兩者之間的一切都是相同的。有誰知道發生了什麼?因爲我使用JAXBContext
的不同版本?
感謝
@ user267476 - 使用'101010'按鈕來格式化代碼(縮進4個空格)http://stackoverflow.com/editing-help – McDowell 2010-08-28 09:22:51