Author |
Message
|
bhaski |
Posted: Thu Feb 15, 2007 1:17 pm Post subject: problem with Namespace on the root Pls help me |
|
|
 Voyager
Joined: 13 Sep 2006 Posts: 78 Location: USA
|
Hello Friends
I am sending one input in XML when I am generating the output, I need the output in the following format.
<?xml version="1.0"?>
<MessageHDR xmlns= "http://tempuri.org/InBnd WrkStationHeaderXML.xsd">
<User />
<Filename>c:\test.txt</Filename>
<Applid>text</Applid>
<FileID>100</FileID>
<MessageDTL>
<First/>
<First/>
<First/>
<First/>
<First/>
<First/>
<second/>
<second>text</second>
<second/>
<second>corp</second>
<thrid>Anthony Montemorra</thrid>
<four>Anthony Montemorra</four>
<five/>
<six/>
</MessageDTL>
<DATABody> Is taken from Input file under <databody>
</DATABody>
</MessageHDR>
How to include the name space "http://tempuri.org/InBnd WrkStationHeaderXML.xsd" at the first level. i.e starting with <MessageHDR xmlns= "http://tempuri.org/InBnd WrkStationHeaderXML.xsd">. All the output data is generated from database based on the input username.
I don't have any message set. If I need to use message set, how to specify the name space for output.
I am using MQ 6 and WMB 6 with latest fix pack.
Pls help me to come out with this name space issue.
Thanks in Advance
Bhaski. |
|
Back to top |
|
 |
vsr |
Posted: Thu Feb 15, 2007 2:15 pm Post subject: |
|
|
Centurion
Joined: 04 Apr 2006 Posts: 104
|
DECLARE ns1 NAMESPACE 'http://tempuri.org/InBnd WrkStationHeaderXML.xsd';
Code: |
SET OutputRoot.Properties.MessageSet = '';
SET OutputRoot.Properties.MessageType = '';
SET OutputRoot.Properties.MessageFormat = '';
SET OutputRoot.Properties.MessageDomain = 'XMLNS';
SET OutputRoot.XMLNS.(XML.XmlDecl) = '';
SET OutputRoot.XMLNS.(XML.XmlDecl).(XML.Version) = '1.0';
SET OutputRoot.XMLNS.(XML.XmlDecl).(XML.Encoding) = 'UTF-8';
SET OutputRoot.XMLNS.ns1:MessageHDR.User = 'UR DATA';
|
If you have to use message set, then code the messageSet ,type and format in the outputroot properties shown above .
Also refer this link..
http://www.mqseries.net/phpBB2/viewtopic.php?p=164158#164158 |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Feb 15, 2007 2:40 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
vsr wrote: |
DECLARE ns1 NAMESPACE 'http://tempuri.org/InBnd WrkStationHeaderXML.xsd';
Code: |
SET OutputRoot.Properties.MessageSet = '';
SET OutputRoot.Properties.MessageType = '';
SET OutputRoot.Properties.MessageFormat = '';
SET OutputRoot.Properties.MessageDomain = 'XMLNS';
SET OutputRoot.XMLNS.(XML.XmlDecl) = '';
SET OutputRoot.XMLNS.(XML.XmlDecl).(XML.Version) = '1.0';
SET OutputRoot.XMLNS.(XML.XmlDecl).(XML.Encoding) = 'UTF-8';
SET OutputRoot.XMLNS.ns1:MessageHDR.User = 'UR DATA';
|
If you have to use message set, then code the messageSet ,type and format in the outputroot properties shown above .
Also refer this link..
http://www.mqseries.net/phpBB2/viewtopic.php?p=164158#164158 |
And if you really want it to be UTF-8 you should add
SET OutputRoot.Properties.CodedCharSetId = 1208; -- from memory so check for exact syntax _________________ MQ & Broker admin |
|
Back to top |
|
 |
MiLi |
Posted: Fri Feb 16, 2007 12:30 am Post subject: |
|
|
Acolyte
Joined: 07 Oct 2005 Posts: 51
|
Look at this:
Code: |
CALL CopyMessageHeaders();
-- Declaration of namespace constants
DECLARE sp1 NAMESPACE 'http://www.ibm.com/space1';
DECLARE sp2 NAMESPACE 'http://www.ibm.com/space2';
DECLARE sp3 NAMESPACE 'http://www.ibm.com/space3';
-- Namespace declaration to associate prefix 'space1' with the namespace
SET OutputRoot.XMLNS.message.(XML.NamespaceDecl)xmlns:space1 = 'http://www.ibm.com/space1';
SET OutputRoot.XMLNS.message.sp1:data1 = 'Hello!';
-- Default Namespace declaration
SET OutputRoot.XMLNS.message.sp2:data2.(XML.NamespaceDecl)xmlns = 'http://www.ibm.com/space2';
SET OutputRoot.XMLNS.message.sp2:data2.sp2:subData1 = 'Hola!';
SET OutputRoot.XMLNS.message.sp2:data2.sp2:subData2 = 'Guten Tag!';
SET OutputRoot.XMLNS.message.sp3:data3 = 'Bonjour!';
SET OutputRoot.Properties.MessageDomain = 'XMLNS';
|
In your case use
Code: |
SET OutputRoot.XMLNS.MessageHDR.(XML.NamespaceDecl)xmlns = 'http://tempuri.org/InBnd WrkStationHeaderXML.xsd'; |
You are using wmb6 so you should use XMLNSC domain !
Code: |
SET OutputRoot.XMLNSC.MessageHDR.(XMLNSC.NamespaceDecl)xmlns = 'http://tempuri.org/InBnd WrkStationHeaderXML.xsd'; |
note that you need to use XMLNSC.NamespaceDecl instead of XML.NamespaceDecl when using XMLNSC Domain ! _________________ IBM Certified System Administrator - WebSphere MQ V6.0
IBM Instructor - WebSphere MQ, WebSphere Message Broker |
|
Back to top |
|
 |
bhaski |
Posted: Fri Feb 23, 2007 1:31 pm Post subject: |
|
|
 Voyager
Joined: 13 Sep 2006 Posts: 78 Location: USA
|
Hi Friend
That is working
now my issue is when I am trying to include the databody from input file ( data as it is below
<DATABody> <element1></element1><element2></element2>
</DATABody>
I need the outfile like
<DATABody> <element1></element1><element2></element2>
</DATABody>
Since the Element name and value I don't know, I am not able to do this properly.
Help me to paste databody input to databody output. but I need only one databody.
I think I am confusing you, I am sorry about this.
Bhaski. |
|
Back to top |
|
 |
bhaski |
Posted: Sat Feb 24, 2007 7:05 pm Post subject: |
|
|
 Voyager
Joined: 13 Sep 2006 Posts: 78 Location: USA
|
Hi MiLi
I tried this XMLNSC, it is good but
SET OutputRoot.XMLNSC.MessageHDR.(XMLNSC.NamespaceDecl)xmlns = 'http://tempuri.org/InBnd WrkStationHeaderXML.xsd';
when the above method is called, I am getting the output
like
<MessageHDR xmlns=" " xmlns='http://tempuri.org/InBnd WrkStationHeaderXML.xsd'
.
.
.
.
</MessageHDR>
Pls let me know why the about is happening?. what do do if I don't want the above xmlns=" ". Pls help me to come out from that?
Thanks and Regards
Bhaskar Rajamani. |
|
Back to top |
|
 |
broker_new |
Posted: Sat Feb 24, 2007 7:50 pm Post subject: |
|
|
 Yatiri
Joined: 30 Nov 2006 Posts: 614 Location: Washington DC
|
If you use a message set,
while creating the messageset itself it asks for the namespace,
so whatever the namespace you mention there and
if you check that use namespace option
automatically that namespace will be included in the output message. _________________ IBM ->Let's build a smarter planet |
|
Back to top |
|
 |
elvis_gn |
Posted: Sat Feb 24, 2007 8:15 pm Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi bhaski,
bhaski wrote: |
<?xml version="1.0"?>
<MessageHDR xmlns= "http://tempuri.org/InBnd WrkStationHeaderXML.xsd">
<User /> |
There is no default namespace for this xml, the value in xmlns is pointing to an xsd, so most probably your xml should have been as below
Quote: |
<?xml version="1.0"?>
<MessageHDR xmlns="http://tempuri.org/InBnd" xmlns:xsi="http://tempuri.org/InBnd WrkStationHeaderXML.xsd"> |
And the code would then be
Code: |
DECLARE defNs NAMESPACE 'http://tempuri.org/InBnd';
SET OutputRoot.XMLNSC.defNs:MessageHDR.(XMLNSC.NamespaceDecl)xmlns = 'http://tempuri.org/InBnd';
SET OutputRoot.XMLNSC.defNs:MessageHDR.(XMLNSC.NamespaceDecl)xmlns = 'http://tempuri.org/InBnd WrkStationHeaderXML.xsd'; |
Regards. |
|
Back to top |
|
 |
bhaski |
Posted: Mon Feb 26, 2007 6:45 am Post subject: |
|
|
 Voyager
Joined: 13 Sep 2006 Posts: 78 Location: USA
|
Hi Elvis
If I am doing that way,
I have to take some part of the Input XML element under <DATABODY> ( I don't know the structure of this child element of DATAbody. Whatever inside the <databody>, I have to include into the output under <Databody>.
SInce I am including the name space for each element, I am getting propblem at this point. Can you Pls let me know, If I convert into String, how can I change the string into element again?
now my issue is when I am trying to include the databody from input file ( data as it is below
<DATABody> <element1></element1><element2></element2>
</DATABody>
I need the outfile like
<DATABody> <element1></element1><element2></element2>
</DATABody>
Since the Element name and value I don't know, I am not able to do this properly.
Help me to paste databody input to databody output. but I need only one databody.
I think I am confusing you, I am sorry about this.
Thanks and Regards
Bhaski. |
|
Back to top |
|
 |
vsr |
Posted: Mon Feb 26, 2007 7:43 am Post subject: |
|
|
Centurion
Joined: 04 Apr 2006 Posts: 104
|
Why don't you paste your sample input to understand better . I guess you are unable to read the the data under 'databody' from the input because of namespace .. |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Feb 26, 2007 7:58 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Also, in XML the following tags are not the same.
<DATABODY/>
<DATAbody/>
<Databody/>
<databody/>
<dataBody/>
<dataBODY/>
Consequently, in ESQL, the following references will not be the same:
InputRoot.XMLNS.DATABODY
InputRoot.XMLNS.DATAbody
InputRoot.XMLNS.Databody
InputRoot.XMLNS.databody
InputRoot.XMLNS.dataBody
InputRoot.XMLNS.dataBODY _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
bhaski |
Posted: Mon Feb 26, 2007 8:10 am Post subject: |
|
|
 Voyager
Joined: 13 Sep 2006 Posts: 78 Location: USA
|
I am sorry, that is a problem of my lazyness. It is always <DATABODY><DATABODY>
Okay thanks for your all support
Pls find my input
<?xml version="1.0" encoding="UTF-8"?>
<MyRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Request>
<id>6196</od>
<number>PAC0002022</number>
<PID>String</PID>
<Name>
<CommercialName>xxxxxxxxxxxx</CommercialName>
<NameDesignation>yyyyyyy</NameDesignation>
</Name>
<DATABODY>
<ELEMENT>
<ELEMENT1_NAME>Entity Name</ELEMENT1_NAME>
<ELEMENT1_CODE>111</ELEMENT1_CODE>
<ELEMENT_GROUP_CODE>ADDINSURED</ELEMENT_GROUP_CODE>
</ELEMENT>
<ELEMENT>
<ELEMENT1_NAME>Entity Name</ELEMENT1_NAME>
<ELEMENT1_CODE>363</ELEMENT1_CODE>
<ELEMENT_GROUP_CODE>ADDINSURED</ELEMENT_GROUP_CODE>
</ELEMENT>
<ELEMENT>
<ELEMENT1_NAME>Entity Name</ELEMENT1_NAME>
<ELEMENT1_CODE>363</ELEMENT1_CODE>
<ELEMENT_GROUP_CODE>ADDINSURED</ELEMENT_GROUP_CODE>
</ELEMENT>
<ELEMENT>
<ELEMENT1_NAME>Entity Name</ELEMENT1_NAME>
<ELEMENT1_CODE>363</ELEMENT1_CODE>
<ELEMENT_GROUP_CODE>ADDINSURED</ELEMENT_GROUP_CODE>
</ELEMENT>
</DATABODY>
<Date>2007-01-18</RequestDate>
<Time>18:20:00</RequestTime>
<SystemId>SYSID</RequestSystemId>
</Request>
</MyRequest>
Pls forget about the case sensitive problem here. that is not a issue.
Bhaski. |
|
Back to top |
|
 |
bhaski |
Posted: Mon Feb 26, 2007 8:16 am Post subject: |
|
|
 Voyager
Joined: 13 Sep 2006 Posts: 78 Location: USA
|
Hi Broker New
I am not using message set, Pls suggest how to achieve without message set?
Bhaski. |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Feb 26, 2007 8:30 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
So this data does not have any namespaces attached to it.
To access a field under DATABODY, you would use ESQL like
InputRoot.XMLNS.MyRequest.Request.DATABODY.ELEMENT
If you need to access fields ANONYMOUSLY, or DYNAMICALLY, there are instructions and discussion on how to do this in the ESQL documentation in the Info Center. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
bhaski |
Posted: Mon Feb 26, 2007 8:35 am Post subject: |
|
|
 Voyager
Joined: 13 Sep 2006 Posts: 78 Location: USA
|
Pls provide one example jef?
Bhaski. |
|
Back to top |
|
 |
|