|
Home > Archive > BizTalk Server General > May 2006 > How to check existence of optional field in XML file
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to check existence of optional field in XML file
|
|
| Jayendra 2006-05-29, 5: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
| |
| Sander Schutten 2006-05-29, 5: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
|
|
|
|
|