Author |
Message
|
SKAT |
Posted: Thu Aug 25, 2005 3:04 am Post subject: Basic XMLNS question |
|
|
Novice
Joined: 15 Aug 2005 Posts: 24
|
Hi guys,
I have the following question on XmlNs Message Set
Incoming message to my MQInput looks like this
Code: |
<?xml version="1.0" encoding="UTF-8"?>
<Q1:ImageFile.xmlns:Q1="http://www.ibm.com/websphere/crossworlds/2002/BOSchema/ImageFile" version="3.0.0" verb="Create" locale="en_US" delta="false">
<Q1:Attributes>
<Q2:MO_ImageFileAttributes xmlns:Q2="http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MO_ImageFileAttributes" version="3.0.0" verb="Create" locale="en_US" delta="false">
<Q2:InFileName>/var/mqm/jtext/my_in/MIST.dat</Q2:InFileName>
</Q2:MO_ImageFileAttributes>
</Q1:Attributes>
<Q1:Image>BIG20050722105153107TF1 </Q1:Image>
<Q1:ObjectEventId>JTextConnector_1124874766682_1</Q1:ObjectEventId>
</Q1:ImageFile>
|
Question
How do I set the following to enable me retrieve the element
Code: |
<Q1:Image>BIG20050722105153107TF1 </Q1:Image> |
Namespace Settings
Namespace URL ?
Prefix?
Namespace Location
Namespace URL ?
schema location ?
Regards
Skat |
|
Back to top |
|
 |
elvis_gn |
Posted: Thu Aug 25, 2005 3:16 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
I opened your file withXMLSpy and found that there is no space between Q1:ImageFile.xmlns:.....
I changed that and first got it to work,pasted it below.
<?xml version="1.0" encoding="UTF-8"?>
<Q1:ImageFile xmlns:Q1="http://www.ibm.com/websphere/crossworlds/2002/BOSchema/ImageFile" version="3.0.0" verb="Create" locale="en_US" delta="false">
<Q1:Attributes>
<Q2:MO_ImageFileAttributes xmlns:Q2="http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MO_ImageFileAttributes" version="3.0.0" verb="Create" locale="en_US" delta="false">
<Q2:InFileName>/var/mqm/jtext/my_in/MIST.dat</Q2:InFileName>
</Q2:MO_ImageFileAttributes>
</Q1:Attributes>
<Q1:Image>BIG20050722105153107TF1 </Q1:Image>
<Q1:ObjectEventId>JTextConnector_1124874766682_1</Q1:ObjectEventId>
</Q1:ImageFile>
Now about how to access Image,use
DECLARE Q1 NAMESPACE "http://www.ibm.com/websphere/crossworlds/2002/BOSchema/ImageFile";
DECLARE Image CHAR InputBody.Q1:Image;
Hope it works !!
Try using the Grid view of XMLSpy, u'll understand what I did.
Regards. |
|
Back to top |
|
 |
SKAT |
Posted: Thu Aug 25, 2005 3:53 am Post subject: |
|
|
Novice
Joined: 15 Aug 2005 Posts: 24
|
Hi
thanks for your speedy reply.
I have tried your suggestion in two ways
First without using a message set to parse the message.
Both messages (yours and mine) parsed as BLOB
When using a messageset in the MQInput however, both failed. I conclude therefore that, the message was not the problem.
Nevertheless, your seggestion to retrieve the Q1:Image gives me a compilation warning
Code: |
DECLARE Q1 NAMESPACE "http://www.ibm.com/websphere/crossworlds/2002/BOSchema/ImageFile";
DECLARE Image CHAR InputBody.Q1:Image;
The ID http://www.ibm.com/websphere/crossworlds/2002/BOSchema/ImageFile cannot be resolved.
|
Have you an idea why ?
Back to my question again, how would you suggest how I should set the ff
Namespace Settings
Namespace URL ?
Prefix?
Namespace Location
Namespace URL ?
schema location ?
Even if I should use BLOB, I still need a messageset for my MQOutput.
Regards
skat |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Aug 25, 2005 3:57 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
I think you missed his point.
Your XML is not valid XML.
Code: |
<Q1:ImageFile.xmlns:Q1="http://www.ibm.com/websphere/crossworlds/2002/BOSchema/ImageFile" |
That period between ImageFile and xmlns is not valid, and breaks the ability to parse yoru xml.
Replace that with a space and you should be okay.
If this is a typo, then you haven't given us enough information to help. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
elvis_gn |
Posted: Thu Aug 25, 2005 4:12 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi SKAT,
1) What ever you input as BLOB will always pass, so your stating that your's and min's pass is totally irrelevent. Even if you send junk characters it will pass.
2) What is the domain you are using, I think you should use MRM and see the message being parsed.
3) My code was wrong as I used double quotes, using single quotes.
4) About your namespace settings...You'll notice that you have a Q1 infront of each element. This is the namespace prefix for the namespace http://www.ibm.com/websphere/crossworlds/2002/BOSchema/ImageFile.... So if you want the Q1 to be SKAT(for example), do the following
Namespace URL: http://www.ibm.com/websphere/crossworlds/2002/BOSchema/ImageFile
Prefix : SKAT
If you want the namespace to be referenced use the target namespace and give the location...
Finally, avoid all this, just activate namespaces in the message set and let the toolkit put default namespaces which will be NS1,NS2.... |
|
Back to top |
|
 |
SKAT |
Posted: Thu Aug 25, 2005 6:31 am Post subject: |
|
|
Novice
Joined: 15 Aug 2005 Posts: 24
|
Hi,
both responses were positive.
What I have lernt is that the receiving MQInput Node does not actually care about the namespace of the incoming message. I have therefore used XML messageset ignoring the namespace to receive the message.
This is what I got
Code: |
(0x01000010):XML = (
(0x05000018):XML = (
(0x06000011): = '1.0'
(0x06000012): = 'UTF-8'
)
(0x06000002): = '
'
(0x01000000):Q1:ImageFile = (
(0x03000000):xmlns:Q1 = 'http://www.ibm.com/websphere/crossworlds/2002/BOSchema/ImageFile'
(0x03000000):version = '3.0.0'
(0x03000000):verb = 'Create'
(0x03000000):locale = 'en_US'
(0x03000000):delta = 'false'
(0x02000000): = '
'
(0x01000000):Q1:Attributes = (
(0x02000000): = '
'
(0x01000000):Q2:MO_ImageFileAttributes = (
(0x03000000):xmlns:Q2 = 'http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MO_ImageFileAttributes'
(0x03000000):version = '3.0.0'
(0x03000000):verb = 'Create'
(0x03000000):locale = 'en_US'
(0x03000000):delta = 'false'
(0x02000000): = '
'
(0x01000000):Q2:InFileName = (
(0x02000000): = '/var/mqm/jtext/my_in/MIST.dat'
)
(0x02000000): = '
'
)
(0x02000000): = '
'
)
(0x02000000): = '
'
(0x01000000):Q1:Image = (
(0x02000000): = 'BIG20050722105153107TF1 '
)
(0x02000000): = '
'
(0x01000000):Q1:ObjectEventId = (
(0x02000000): = 'JTextConnector_1124874766682_1'
)
(0x02000000): = '
'
)
)
|
Now coming back to retrieve the data, in this case
Code: |
(0x01000000):Q1:Image = (
(0x02000000): = 'BIG20050722105153107TF1 '
)
|
using this
Code: |
DECLARE Q1 NAMESPACE 'http://www.ibm.com/websphere/crossworlds/2002/BOSchema/ImageFile';
DECLARE nsRawDataRef CHAR InputBody.Q1:Image;
|
in my followup compute node, the
cannot be resolved, so I changed it to this
Code: |
InputBody."Q1:Image"
|
It can compile alright but the value of the element is NULL
Have you any idea why?
Here is the proof
Code: |
2005-08-25 17:00:59.763187 5155 UserTrace BIP2539I: Node 'CopyRawToFw': Finished evaluating expression 'SUBSTRING(nsRawDataRef FROM 1 FOR 2)' at (CopyToFixWidth.Main, 19.27). This resolved to 'SUBSTRING([b]NULL[/b] FROM 1 FOR 2)'. The result was 'NULL'.
2005-08-25 17:00:59.763221 5155 UserTrace BIP2537I: Node 'CopyRawToFw': Executing statement 'SET OutputRoot.MRM.RecordType = recordType;' at (CopyToFixWidth.Main, 20.3).
2005-08-25 17:00:59.763294 5155 UserTrace BIP2538I: Node 'CopyRawToFw': Evaluating expression 'recordType' at (CopyToFixWidth.Main, 20.39).
|
|
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Aug 25, 2005 6:36 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Why do you think you can ignore the namespace, and then try and access a namespace qualified element?
Use XMLNS, not XML, please. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
SKAT |
Posted: Thu Aug 25, 2005 8:26 am Post subject: |
|
|
Novice
Joined: 15 Aug 2005 Posts: 24
|
Hi again,
i have tried the XMLNS version and still no success.
The BLOB version has not helped either.
Looking at the input message
Code: |
<?xml version="1.0" encoding="UTF-8"?>
<Q1:ImageFile xmlns:Q1="http://www.ibm.com/websphere/crossworlds/2002/BOSchema/ImageFile" version="3.0.0" verb="Create" locale="en_US" delta="false">
<Q1:Attributes>
<Q2:MO_ImageFileAttributes xmlns:Q2="http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MO_ImageFileAttributes" version="3.0.0" verb="Create" locale="en_US" delta="false">
<Q2:InFileName>/var/mqm/jtext/sirax_in/MIST.dat</Q2:InFileName>
</Q2:MO_ImageFileAttributes>
</Q1:Attributes>
<Q1:Image>BIG20050722105153107TF1 </Q1:Image>
<Q1:ObjectEventId>JTextConnector_1124874766682_1</Q1:ObjectEventId>
</Q1:ImageFile>
|
I have observed that the logical structure of the xml input looks like
Code: |
<Q1:ImageFile ...>
<Q1:Image></Q1:Image>
</Q1:ImageFile>
|
Does that mean I should access the image through the parent like
Code: |
DECLARE Q1 NAMESPACE 'http://www.ibm.com/websphere/crossworlds/2002/BOSchema/ImageFile';
DECLARE nsRawDataRef CHAR InputBody."Q1:ImageFile"."Q1:Image";
|
I get a compilation warning on the second declaration. Unresolved message field.
How do i access this if my thoughts should hold ?
Any more idea how to get the Image data ?
see the other mrm try
Code: |
(0x01000021):MRM = (
(0x0300000D):@version = '3.0.0'
(0x0300000D):@verb = 'Create'
(0x0300000D):@locale = 'en_US'
(0x0300000D):@delta = 'false'
(0x01000015)http://www.ibm.com/websphere/crossworlds/2002/BOSchema/ImageFile:Attributes = (
(0x01000015)http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MO_ImageFileAttributes:MO_ImageFileAttributes = (
(0x0300000D):@version = '3.0.0'
(0x0300000D):@verb = 'Create'
(0x0300000D):@locale = 'en_US'
(0x0300000D):@delta = 'false'
(0x03000015)http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MO_ImageFileAttributes:InFileName = '/var/mqm/jtext/my_in/MIST.dat'
)
)
(0x03000015)http://www.ibm.com/websphere/crossworlds/2002/BOSchema/ImageFile:Image = 'FH20050722105153107TF1 '
(0x03000015)http://www.ibm.com/websphere/crossworlds/2002/BOSchema/ImageFile:ObjectEventId = 'JTextDConnector_1124874766682_1'
)
|
|
|
Back to top |
|
 |
elvis_gn |
Posted: Thu Aug 25, 2005 8:41 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
You will have to use namespaces, I dont think that it can be avoided.
If you want i'll look into it, mail me the stuff at elvis_gn@yahoo.com.
You should be able to know what reference to use from the message structure formed at the breakpoint after the Inputnode.
Regards. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Aug 25, 2005 8:41 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
try
Code: |
DECLARE Q1 NAMESPACE 'http://www.ibm.com/websphere/crossworlds/2002/BOSchema/ImageFile';
DECLARE nsRawDataRef CHAR;
set nsRaqDataRef = InputBody."Q1:ImageFile"."Q1:Image"; |
_________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
SKAT |
Posted: Thu Aug 25, 2005 8:49 am Post subject: |
|
|
Novice
Joined: 15 Aug 2005 Posts: 24
|
jefflowrey wrote: |
try
Code: |
set nsRaqDataRef = InputBody."Q1:ImageFile"."Q1:Image"; |
|
Still compilation warning on this |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Aug 25, 2005 8:54 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Post a trace of the parsed XMLNS - like you did for the MRM. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
SKAT |
Posted: Thu Aug 25, 2005 9:01 am Post subject: |
|
|
Novice
Joined: 15 Aug 2005 Posts: 24
|
Here is my XMLNS trace
Code: |
(0x01000010):XMLNS = (
(0x05000018):XML = (
(0x06000011): = '1.0'
(0x06000012): = 'UTF-8'
)
(0x06000002): = '
'
(0x01000000)http://www.ibm.com/websphere/crossworlds/2002/BOSchema/ImageFile:ImageFile = (
(0x07000012)xmlns:Q1 = 'http://www.ibm.com/websphere/crossworlds/2002/BOSchema/ImageFile'
(0x03000000):version = '3.0.0'
(0x03000000):verb = 'Create'
(0x03000000):locale = 'en_US'
(0x03000000):delta = 'false'
(0x02000000): = '
'
(0x01000000)http://www.ibm.com/websphere/crossworlds/2002/BOSchema/ImageFile:Attributes = (
(0x02000000): = '
'
(0x01000000)http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MO_ImageFileAttributes:MO_ImageFileAttributes = (
(0x07000012)xmlns:Q2 = 'http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MO_ImageFileAttributes'
(0x03000000):version = '3.0.0'
(0x03000000):verb = 'Create'
(0x03000000):locale = 'en_US'
(0x03000000):delta = 'false'
(0x02000000): = '
'
(0x01000000)http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MO_ImageFileAttributes:InFileName = (
(0x02000000): = '/var/mqm/jtext/my_in/MIST.dat'
)
(0x02000000): = '
'
)
(0x02000000): = '
'
)
(0x02000000): = '
'
(0x01000000)http://www.ibm.com/websphere/crossworlds/2002/BOSchema/ImageFile:Image = (
(0x02000000): = 'FH20050722105153107TF1 '
)
(0x02000000): = '
'
(0x01000000)http://www.ibm.com/websphere/crossworlds/2002/BOSchema/ImageFile:ObjectEventId = (
(0x02000000): = 'JTextConnector_1124874766682_1'
)
(0x02000000): = '
'
)
)
|
|
|
Back to top |
|
 |
|