How to check existence of optional field in XML file
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > BizTalk Server > BizTalk Server General > How to check existence of optional field in XML file




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    How to check existence of optional field in XML file  
Jayendra


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-29-06 10:21 PM

Hi,

I need to check the existence of optional filed,Could anyone help me on
this.
In the below input file,i want to wheather elment <ECertified>Exists or not.

I have tried in my way,But it is throwing exception in case elment
doesn't exist.
xpath>>Count(//Company//Emp[1]//ECertified).




i/p file:
<Company>

<Emp>
<Eno>1</ENo>
<EName>AAA</Ename>
</Emp>

<Emp>
<Eno>2</ENo>
<EName>bbb</Ename>
<ECertified>Yes</ECertified>
</Emp>


</Company>



Thanks,
Prakash





[ Post a follow-up to this message ]



    Re: How to check existence of optional field in XML file  
Sander Schutten


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-29-06 10:21 PM

Your xpath query looks a bit weird. Please try:
count(/Company/Emp[1]/ECertified)

Maybe that will do the trick. At least count should return 0 if the
element isn't there, but make sure that there's at least one Emp
element, else it probably won't work!

Sander

Jayendra wrote:
> Hi,
>
>   I need to check the existence of optional filed,Could anyone help me on
> this.
>   In the below input file,i want to wheather elment <ECertified>Exists or 
not.
>
>    I have tried in my way,But it is throwing exception in case elment
> doesn't exist.
> xpath>>Count(//Company//Emp[1]//ECertified).
>
>
>
>
> i/p file:
> <Company>
>
> <Emp>
> <Eno>1</ENo>
> <EName>AAA</Ename>
> </Emp>
>
> <Emp>
> <Eno>2</ENo>
> <EName>bbb</Ename>
> <ECertified>Yes</ECertified>
> </Emp>
>
>
> </Company>
>
>
>
> Thanks,
> Prakash






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 10:58 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register