注册 登录
编程论坛 J2EE论坛

使用jdom如何为XML添加“如此”名称空间

IceWee 发布于 2008-08-01 12:51, 999 次点击
MessageQueueCommand.xml
------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<MessageQueueCommand xmlns="M.Box.MessageQueueCommands" xmlns:xsi="http://www. xsi:schemaLocation="M.Box.MessageQueueCommands E:\xsdtest\MessageCommands.xsd">
  <InjectionRequestCommand>
    <AdditionalInfo Key="myKey1">myValue1 </AdditionalInfo>
    <AdditionalInfo Key="myKey2">myValue2 </AdditionalInfo>
    <MessageId>9E479DFE-3360-4A08-9157-71F78D715365 </MessageId>
    <Msisdn>63125874557458 </Msisdn>
    <SourceTransactionId>A12324BD1-C </SourceTransactionId>
    <TelcoId>1 </TelcoId>
    <TransmitterName>01RouterProc01 </TransmitterName>
    <ResponseQueue>MIAB.01RouterProc01.Telco1.Injection.Response </ResponseQueue>
    <Amount>1000 </Amount>
    <CodeType>10 Telco1 Topup </CodeType>
    <InjectionType>Topup </InjectionType>
    <RetailerGroupId>A100 </RetailerGroupId>
    <RetailerId>A1001 </RetailerId>
    <StoreId>A1001_1 </StoreId>
    <TransactionId>924348347261 </TransactionId>
  </InjectionRequestCommand>
</MessageQueueCommand>
------------------------------------------------------------------------------------------------------

上面的MessageQueueCommand.xml是需用jdom生成的xml文件。现在这个XML文件除了一个地方(红色字体)我不会添加,其他的都解决了。问题也正是此,像红色字体的名称空间使用jdom该如何添加呢?

备注:
它是一个本地的xsd文件,用来验证生成的xml文件的有效性。
1 回复
#2
witchery2008-08-08 00:36
mark~
 最近在用JDom...  刚接触...
1