on 02-14-2008 8:22 AM
Hi Guys,
I developed a JAVA mapping in XI to add name spaces for XML file, after mapping,name spaces xmlns="http://www.mro.com/mx/integration" and xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" were added correctly, but for some nodes, such as <Header> and <Content>, a name space xmlns="" was added automatically.Please check below files to compare.
It looks like be added automatically by XI. I didn't process anything for these nodes in JAVA program.
Now the issue is, how can I remove these redundant namespaces? Such as xmlns="".
Can I remove them using DOM or SAX in JAVA Mapping?
Thanks in advance.
====>Original XML file
<?xml version="1.0" encoding="UTF-8"?>
<LLYLPPInterface language="EN">
<Header>
<SenderID>GBIP</SenderID>
<CreationDateTime>2008-02-13T22:49:34-05:00</CreationDateTime>
<RecipientID/>
<MessageID/>
</Header>
<Content>
<LLY-LPP>
<INVOICE>
<INVOICELINE>
<PONUM>4780000008</PONUM>
<POLINENUM>1</POLINENUM>
<INVOICEQTY>1</INVOICEQTY>
<LOADEDCOST>68</LOADEDCOST>
</INVOICELINE>
</INVOICE>
</LLY-LPP>
</Content>
</LLYLPPInterface>
===>Target XML file after JAVA mapping
<?xml version="1.0" encoding="utf-8"?>
<LLYLPPInterface language="EN" xmlns="http://www.mro.com/mx/integration" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Header xmlns="">
<SenderID>GBIP</SenderID>
<CreationDateTime>2008-02-13T23:11:55-05:00</CreationDateTime>
<RecipientID/>
<MessageID/>
</Header>
<Content xmlns="">
<LLY-LPP>
<INVOICE>
<INVOICELINE>
<PONUM>4780000008</PONUM>
<POLINENUM>0</POLINENUM>
<INVOICEQTY>1</INVOICEQTY>
<LOADEDCOST>68</LOADEDCOST>
</INVOICELINE>
</INVOICE>
</LLY-LPP>
</Content>
</LLYLPPInterface>
Edited by: Eddie Zhang on Feb 14, 2008 9:22 AM
Edited by: Eddie Zhang on Feb 14, 2008 9:24 AM
The namespace xmlns="" is not redundent. The message would be different without this.
The XI does not add anything to a message, so this comes from your Java mapping.
If you use DOM parser, check your code carefully. Maybe you use SAX parser instead.
Regards
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try to check this: /people/stefan.grube/blog/2007/02/02/remove-namespace-prefix-or-change-xml-encoding-with-the-xmlanonymizerbean
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Milan,
Thanks for your replay.
Actually when I used module XMLAnonymizerBean to convert namespaces, the header of XML, such as <?xml version="1.0" encoding="UTF-8"?> was converted to format <?xml version='1.0' encoding='UTF-8'?>, quote was converted to single quote. Although I set parameter anonymizer.quote = ", it still didn't work, single quote appeared instead of quote.
I'm not sure why this happened. Can anyone help to clarify this?
Thanks
Edited by: Eddie Zhang on Feb 15, 2008 2:11 AM
> Actually when I used module XMLAnonymizerBean to convert namespaces, the header of XML, such as <?xml version="1.0" encoding="UTF-8"?> was converted to format <?xml version='1.0' encoding='UTF-8'?>, quote was converted to single quote. Although I set parameter anonymizer.quote = ", it still didn't work, single quote appeared instead of quote.
The XML declaration is not influenced by the parameter. You cannot change this.
Regards
Stefan
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.