Author |
Message
|
maanav_kr |
Posted: Tue Mar 06, 2007 5:35 pm Post subject: XMLNSC parsing : empty tag problem |
|
|
 Novice
Joined: 19 Jan 2007 Posts: 15
|
Hello,
Am using XMLNSC parsing for input messages.. message looks somethign like:
Code: |
<?xml version="1.0" encoding="UTF-8"?>
<NS1:s_o xmlns:NS1="http://www.w3schools.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<NS1:mr_history_data>
<NS1:abc></NS1:abc>
</NS1:mr_history_data>
</NS1:s_o> |
I want to validate if the tag abc is empty or has some content.
I assign the tag to a char string :
Code: |
DECLARE ABC_file CHARACTER InputRoot.XMLNSC.NS1:s_o.NS1:mr_history_data.NS1:demand; |
But then following code alway takes me to False :
Code: |
if (ABC_file = '') then
set Environment.de_if = 'TRUE';
else
set Environment.de_if = 'FALSE';
end if; |
I tried to trim, then checking length of ABC_file, I get 3.
Code: |
set Environment.de_len=LENGTH(DEMAND_READING_file); |
But cannt see anything in trace node except new line and tab / blank spaces
Code: |
(0x01000000)http://www.w3schools.com:abc = |
Then i even assigned the value to new tag, stangely it has new line and tab or something
Code: |
(0x03000000)http://www.w3schools.com:remand = '
' |
If i use XML parsing, the IF ..ELSE works fine.. Can someone please let me know if any other equivalent is to be used?
Thanks,
Mk |
|
Back to top |
|
 |
sarat |
Posted: Tue Mar 06, 2007 11:41 pm Post subject: |
|
|
 Centurion
Joined: 29 Jun 2005 Posts: 136 Location: India
|
Hi mundhrikottai,
Your i/p msg is
Quote: |
<?xml version="1.0" encoding="UTF-8"?>
<NS1:s_o xmlns:NS1="http://www.w3schools.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<NS1:mr_history_data>
<NS1:abc></NS1:abc>
</NS1:mr_history_data>
</NS1:s_o> |
and ur code is
Code: |
DECLARE ABC_file CHARACTER InputRoot.XMLNSC.NS1:s_o.NS1:mr_history_data.NS1:demand; |
But where's "demand" in the input? _________________ With Regards,
Sarat. |
|
Back to top |
|
 |
maanav_kr |
Posted: Wed Mar 07, 2007 1:27 pm Post subject: |
|
|
 Novice
Joined: 19 Jan 2007 Posts: 15
|
Hi sarat,
'demand' is actually 'abc'.. i renamed all occurences for the forum.. misssed this one.
Regards
Maanav |
|
Back to top |
|
 |
sarat |
Posted: Wed Mar 07, 2007 10:30 pm Post subject: |
|
|
 Centurion
Joined: 29 Jun 2005 Posts: 136 Location: India
|
Its ok...
Yeah I've used ur code and input.
The ABC_file = \n not recognizing as null.
Tht's why
IF ABC_file = ' ' is always going to FALSE!! _________________ With Regards,
Sarat. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Mar 08, 2007 1:25 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Looks as if you are hitting a known problem with XMLNSC. If you raise a PMR you can get an IFix for this. You should ask for a test fix for PMR 12211,999,866. Or you can wait for the next Fix Pack. |
|
Back to top |
|
 |
Marek |
Posted: Fri Mar 30, 2007 2:04 am Post subject: |
|
|
Apprentice
Joined: 30 Jun 2004 Posts: 32 Location: Edinburgh
|
In the example why assign the tag to a char string? I don't see the point in this. If you intend to refer to 'InputRootInputRoot.XMLNSC.NS1:s_o.NS1:mr_history_data' more often then from a readibility and efficeincy perspective a REFERENCE variable would be best...
Thanks for any clarification. |
|
Back to top |
|
 |
|