Namespace Prefix problem

A

Anirudh

Hi,
i have a SOAP XML which is similar to this:

<request xmlns="http://www.someurl.com">
<abc>
<xyz></xyz>
<xyz></xyz>
</abc>

I need the same namespace for 'request' and 'abc' but i want to
maintain the default namespace for 'xyz'. i.e, i want the xml to look
something like this:

<prefix:request xmlns:prefix="http://www.someurl.com">
<prefix:abc>
<xyz></xyz> // These do NOT come under 'prefix'.
<xyz></xyz> // They are xmlns = "".
</prefix:abc>

Is there any way i can achieve this? What do i need to specify in the
attribute tags? Thanks in advance.
 
D

Dilip Krishnan

Hello (e-mail address removed),
you need to add [XmlElement("xyz", Namespace="")] to the xyz type declaration

HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com
http://www.geniant.com
 
A

Anirudh

Hi Dilip,
Thanks for the info. Could also also tell me how i can attach a
prefix to a tag (in this case, 'request' and 'abc' and omit that prefix
for 'xyz'). Thanks again.
-Anirudh
 
D

Dan Rogers

Unless you use a namespace manager, it is up to the serializer to resolve
whether it uses prefixes or inline default namespace markup. The two are
equivalent, and to be XML compliant, a parser must be albe to treat both as
if they were the same.

Some of the pretty basic WS tools and hand-coded XML crackers attached to
port listeners have problems because they try to treat XML as if it were a
string. I wouldn't worry about the on-the wire format.

--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top