This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Microsoft XML > September 2004 > Re: Why do I get an extra attribute called "xmlns" in my children





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 Re: Why do I get an extra attribute called "xmlns" in my children
Dwight

2004-09-27, 12:14 pm

Hi JOe,

Thanks for your speedy response.

In addition to your reponse, how can I create my child element without the
xmlns="" attribute?

TIA
Dwight




"Joe Fawcett" wrote:

> "Dwight" <Dwight@discussions.microsoft.com> wrote in message
> news:16DE622A-3806-4107-8780-7820A26EF93A@microsoft.com...
> get
> follows:
> You set up a default namespace for your document in the 'Root' but when you
> created the child element you did so using the null namespace (you cannot
> create namespaced elements using CreateElement).
> If you want the child element to be in the same namespace as its parent then
> use CreateNode method specifying the namespace uri (MyNameSpace) as the
> third parameter.
>
> --
>
> Joe (MVP - xml)
>
>
>

Julian F. Reschke

2004-09-27, 12:14 pm

Dwight wrote:
> Hi JOe,
>
> Thanks for your speedy response.
>
> In addition to your reponse, how can I create my child element without the
> xmlns="" attribute?


He just told you:
[color=darkred]
parent then[color=darkred]

Julian
Martin Honnen

2004-09-27, 12:14 pm



Dwight wrote:


> In addition to your reponse, how can I create my child element without the
> xmlns="" attribute?


Use createNode, as already suggested:
loGovTalkEnvelope.createNode(1, "Child", "MyNameSpace")

--

Martin Honnen
http://JavaScript.FAQTs.com/
Joe Fawcett

2004-09-27, 12:14 pm

"Dwight" <Dwight@discussions.microsoft.com> wrote in message
news:F4265A67-A0A2-4060-87ED-5039D4958EFE@microsoft.com...
> Hi JOe,
>
> Thanks for your speedy response.
>
> In addition to your reponse, how can I create my child element without the
> xmlns="" attribute?
>

You can't if you want to use a default namespace on Root but no namespace on
children.
You can give the Root a namespace prefix:
<myNs:Root xmlns:myNs="MyNameSpace"><Child>ChildText</Child></myNs:Root>
but you definitely need to undeclare the default namespace if you want it
just appling to the Root element. That's why the parser has added the
undeclaration in for you.

If you're not sure show me exactly how you want the document to look.
--

Joe (MVP - xml)


Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews