BizTalk Server Orchestration - xpath return nothing if xml doc contains default namespace

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server Orchestration > May 2005 > xpath return nothing if xml doc contains default namespace





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 xpath return nothing if xml doc contains default namespace
John Lee

2005-05-10, 8:47 pm

Hi,

When I have outersource submit the following xml doc into bizTalk
I use xpath(msgIncoming, "//name") to extract the name but I got empty
string back
and it works if xmlns="mynamespace" is removed.

<root xmlns="mynamespace">
<name>John</name>
</root>

any idea?

Thanks in advance!
John


Stephen W. Thomas

2005-05-11, 2:48 am

Hello.

You might want to try: xpath(msgIncoming, "//local-name()='name’")

I might have the syntax off a little. You can look for the full xPath to
the node inside the schema editor.

Stephen W. Thomas
http://www.geekswithblogs.com/sthomas


"John Lee" wrote:

> Hi,
>
> When I have outersource submit the following xml doc into bizTalk
> I use xpath(msgIncoming, "//name") to extract the name but I got empty
> string back
> and it works if xmlns="mynamespace" is removed.
>
> <root xmlns="mynamespace">
> <name>John</name>
> </root>
>
> any idea?
>
> Thanks in advance!
> John
>
>
>

Tomas Restrepo \(MVP\)

2005-05-11, 2:48 am

Hi Stephen, John,
> You might want to try: xpath(msgIncoming, "//local-name()='name'")
>


I think xpath(msgIncoming, "//*[local-name()='name']")

might work a little bit better


--
Tomas Restrepo
tomasr@mvps.org
http://www.winterdom.com/


John Lee

2005-05-11, 2:48 am

Thanks for the reply!

That did not work for me. It still return empty string for both
- <ns0:Root xmlns:ns0="http://mynamespace">
<ns0:Name>Name_Qualified</ns0:Name>
<ns0:Order ID="ID_0" />
</ns0:Root>
and
- <Root xmlns="http://mynamespace">
<Name>Name_0</Name>
<Order ID="1" />
</Root>

John

"Tomas Restrepo (MVP)" <tomasr@mvps.org> wrote in message
news:%23zngGfdVFHA.2572@TK2MSFTNGP14.phx.gbl...
> Hi Stephen, John,
>
> I think xpath(msgIncoming, "//*[local-name()='name']")
>
> might work a little bit better
>
>
> --
> Tomas Restrepo
> tomasr@mvps.org
> http://www.winterdom.com/
>
>



Tomas Restrepo \(MVP\)

2005-05-11, 7:47 am

John,

> Thanks for the reply!
>
> That did not work for me. It still return empty string for both
> - <ns0:Root xmlns:ns0="http://mynamespace">
> <ns0:Name>Name_Qualified</ns0:Name>
> <ns0:Order ID="ID_0" />
> </ns0:Root>
> and
> - <Root xmlns="http://mynamespace">
> <Name>Name_0</Name>
> <Order ID="1" />
> </Root>
>


How about "string(//*[local-name()='Name'])" ?


--
Tomas Restrepo
tomasr@mvps.org
http://www.winterdom.com/


Stephen W. Thomas

2005-05-11, 7:47 am

Hello.

If you open the schema in BizTalk Editor, click on the node you want to
extract.
Look at the Properties of that node and find “Instance XPath”. It will be
long but have the full path to that node including namespace. You should be
able to use this XPath for your selection.

Best of luck.

Stephen W. Thomas
http://www.geekswithblogs.com/sthomas


"Tomas Restrepo (MVP)" wrote:

> John,
>
>
> How about "string(//*[local-name()='Name'])" ?
>
>
> --
> Tomas Restrepo
> tomasr@mvps.org
> http://www.winterdom.com/
>
>
>

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com