Author |
Message
|
dweller |
Posted: Wed Nov 08, 2006 6:08 am Post subject: problems with namespace |
|
|
Apprentice
Joined: 31 Oct 2006 Posts: 28
|
in compute node i have this line:
SET OutputRoot.XMLNSC.Envelope.(XMLNSC.NamespaceDecl)xmlns = 'http://www.envelope.com/MBM';
in output xml i get this:
<Envelope xmlns="" xmlns="http://www.intentia.com/MBM"/>
where did that first xmlns come from?  |
|
Back to top |
|
 |
elvis_gn |
Posted: Wed Nov 08, 2006 6:39 am Post subject: Re: problems with namespace |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi dweller,
dweller wrote: |
SET OutputRoot.XMLNSC.Envelope.(XMLNSC.NamespaceDecl)xmlns = 'http://www.envelope.com/MBM'; |
Is this the only line of code...plz paste the rest.
Regards. |
|
Back to top |
|
 |
dweller |
Posted: Wed Nov 08, 2006 6:45 am Post subject: |
|
|
Apprentice
Joined: 31 Oct 2006 Posts: 28
|
BEGIN
CALL CopyMessageHeaders();
-- CALL CopyEntireMessage();
SET OutputRoot.XMLNSC.Envelope.(XMLNSC.NamespaceDecl)xmlns = 'http://www.envelope.com/MBM';
RETURN TRUE;
END;
and btw in Debug mode, Variables view there is only one xmlns variable(not the empty one). But rfhutil still shows that second empty xmlns declaration.
wmb 6.0, rfhutil 3.1 |
|
Back to top |
|
 |
elvis_gn |
Posted: Wed Nov 08, 2006 7:48 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi dweller,
dweller wrote: |
BEGIN
CALL CopyMessageHeaders();
-- CALL CopyEntireMessage();
DECLARE xmlns NAMESPACE 'http://www.envelope.com/MBM';
SET OutputRoot.XMLNSC.xmlns:Envelope.(XMLNSC.NamespaceDecl)xmlns = 'http://www.envelope.com/MBM';
RETURN TRUE;
END; |
Just try this and tell me if the extra xmlns disappears...
Regards. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Nov 08, 2006 8:37 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Elvis: Watch out! The XML specification clearly says
Quote: |
The prefix xmlns is used only to declare namespace bindings and is by definition bound to the namespace name http://www.w3.org/2000/xmlns/. It MUST NOT be declared . Other prefixes MUST NOT be bound to this namespace name, and it MUST NOT be declared as the default namespace. Element names MUST NOT have the prefix xmlns. |
I realise that this is ESQL, not an XML document. But it is very bad practice to use the prefix 'xmlns' for anything other than its intended purpose. In this case, 'mbm' might be a good alternative. |
|
Back to top |
|
 |
elvis_gn |
Posted: Wed Nov 08, 2006 9:04 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi kimbert,
Are u referring to my using xmlns in the declare statement ? Yes I could have used anything there...used it only to help dweller relate that the default namespace(appearing as only "xmlns" and no prefixes in the output) is the one used on the field "Envelope" too...if there was a prefix used, I would have definitely used that...
I don't think I violated any of the other rules you mentioned above...did I ?
Regards. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Nov 09, 2006 2:10 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
elvis,
I can see why you did it. But I would advise against using xmlns as a namespace constant. When somebody writes ESQL like this
Code: |
DECLARE myNS NAMESPACE http://myNamespace.com |
they are usually declaring 'myNS' as a 'namespace prefix' for use in ESQL. So an ESQL NAMESPACE constant is very similar to an XML Namespace declaration. They both allow a long namespace to be abbreviated. It is bad practice to use ESQL namespace constants in a way which would be illegal in an XML document. |
|
Back to top |
|
 |
dweller |
Posted: Thu Nov 09, 2006 2:25 am Post subject: |
|
|
Apprentice
Joined: 31 Oct 2006 Posts: 28
|
thanx for replies.
i need to generate root element with namespaces like this:
<Envelope xmlns="http://www.envelope.com/MBM" xmlns:env="http://www.envelope.com/MBM_Envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
this code does it, but it adds that extra empty xmlns namespace declaration:
SET OutputRoot.XMLNSC.Envelope.(XMLNSC.NamespaceDecl)xmlns = 'http://www.intentia.com/MBM';
SET OutputRoot.XMLNSC.Envelope.(XMLNSC.NamespaceDecl)xmlns:env = 'http://www.envelope.com/MBM_Envelope';
SET OutputRoot.XMLNSC.Envelope.(XMLNSC.NamespaceDecl)xmlns:xsi = 'http://www.w3.org/2001/XMLSchema-instance';
SET OutputRoot.XMLNSC.Envelope.(XMLNSC.NamespaceDecl)xmlns:xsd = 'http://www.w3.org/2001/XMLSchema';
then i declare namespaces and write xml.
declaring xmlns before adding to envelope like you wrote did help, but then it damages other namespaces. i'm sorry i didn't write about other namespaces before, i thought fixing xmlns declaration wouldn't affect other namespaces. |
|
Back to top |
|
 |
bhaski |
Posted: Fri Feb 23, 2007 2:52 pm Post subject: |
|
|
 Voyager
Joined: 13 Sep 2006 Posts: 78 Location: USA
|
Hi friends
do you have the answer for this issue ? I am also suffering with this issue on Namespace declaration in XMLNSC?
Bhaski. |
|
Back to top |
|
 |
|