Author |
Message
|
GSnyder13 |
Posted: Fri Apr 29, 2005 5:25 am Post subject: Problem with XMLNS namespace prefixes |
|
|
Novice
Joined: 29 Mar 2005 Posts: 13 Location: United States
|
I need to create the following XML(We are using WBIMB v5):
<?xml version="1.0" encoding="UTF-8"?>
<admin xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="csm_admin.xsd">
Here is my ESQL code:
CREATE COMPUTE MODULE Manugistics_Common_Security_Enterprise_Reformat_Compute
CREATE FUNCTION main() RETURNS BOOLEAN
BEGIN
-- Enter SQL below this line. SQL above this line might be regenerated, causing any modifications to be lost.
-- Set some message format settings in the MQMD
DECLARE publicationHeaderReference REFERENCE TO InputRoot.XML.llbeanDocument.document.publication.publicationHeader;
DECLARE inRef REFERENCE TO InputRoot.XML."llbeanDocument"."document"."publication"."publicationBody"."vendor";
DECLARE typeDesc REFERENCE TO InputRoot.XML."llbeanDocument"."document"."publication"."publicationHeader"."publicationTypeDesc" ;
SET OutputRoot.Properties = InputRoot.Properties;
SET OutputRoot.MQMD = InputRoot.MQMD;
SET OutputRoot.MQMD.Encoding = MQENC_NATIVE;
SET OutputRoot.MQMD.Format = MQFMT_STRING;
SET OutputRoot.MQMD.CodedCharSetId = MQCCSI_Q_MGR;
--xml declaration ----------------------------------------------------------------------------
SET OutputRoot.XMLNS.(XML.XmlDecl) = '';
SET OutputRoot.XMLNS.(XML.XmlDecl).(XML.Version) = '1.0';
SET OutputRoot.XMLNS.(XML.XmlDecl).(XML."Encoding") = 'UTF-8';
----------------------------------------------------------------------------------------------
DECLARE manu_sp NAMESPACE 'http://www.w3.org/2001/XMLSchema-instance';
-- Create admin
----------------------------------------------------------------------------------------------------------------;
SET OutputRoot.XMLNS.admin.(XML.NamespaceDecl)manu_sp:noNamespaceSchemaLocation = 'csm_admin.xsd';
----------------------------------------------------------------------------------------------------------------
SET OutputRoot.Properties.MessageDomain = 'XMLNS';
Here is my output:
<?xml version="1.0" encoding="UTF-8" ?>
- <admin xmlns:NS1="http://www.w3.org/2001/XMLSchema-instance" NS1:noNamespaceSchemaLocation="csm_admin.xsd">
Does anyone know how to make the "NS1" say "xsi" instead? The instructions in the IBM ESQL manual for XMLNS are not very good. When I reference SET OutputRoot.XMLNS.admin.(XML.NamespaceDecl)xmlns:noNamespaceSchemaLocation = 'csm_admin.xsd';
I get an error saying "Namespace constant xmlns has not been defined".
Any help would be greatly appreciated.
Thanks.
Gene Snyder |
|
Back to top |
|
 |
nathanw |
Posted: Fri Apr 29, 2005 5:52 am Post subject: |
|
|
 Knight
Joined: 14 Jul 2004 Posts: 550
|
whenever i have to wriet out in XMLNS i always include the following code at the beginning
Code: |
DECLARE xmlns NAMESPACE 'urn:hl7-org:v3';
DECLARE xsi NAMESPACE 'http://www.w3.org/2001/XMLSchema-instance';
SET "OutputRoot"."XMLNS"."xxxxxxx".(XML.NamespaceDecl)xmlns:space1 = 'urn:hl7-org:v3';
SET "OutputRoot"."XMLNS"."xxxxxxx".xmlns:data1 = 'http://www.w3.org/2001/XMLSchema-instance';
|
See if that helps |
|
Back to top |
|
 |
alexey |
Posted: Sat Apr 30, 2005 12:46 am Post subject: |
|
|
 Acolyte
Joined: 18 Dec 2003 Posts: 62 Location: Israel
|
|
Back to top |
|
 |
GSnyder13 |
Posted: Sat Apr 30, 2005 5:13 am Post subject: Thanks, but... |
|
|
Novice
Joined: 29 Mar 2005 Posts: 13 Location: United States
|
Thank you both for your responses, but I still can't get the "NS1" to say "xsi":
<admin xmlns:NS1="http://www.w3.org/2001/XMLSchema-instance" NS1:noNamespaceSchemaLocation="csm_admin.xsd">
According to the ESQL manual for WBIMB Messagebroker, v5, "Manipulating messages in the XMLNS domain": "If, when the output message is generated, the namespace with which an element or attribute is qualified has no corresponding namespace declaration, one is qutomatically generated using prefixes of the form NSn where n is a positive integer".
No matter how I code this, nothing changes. NS1 is always coming up as the default prefix. I don't get it...
This is very frustrating and if anyone from IBM is monitoring these postings, I think an explanation is in order. These things seem to be more complicated than they need to be considering all of the postings I am seeing relative to namespaces, prefixes, and XMLNS. The ESQL manual for WBIMB v5 is not very clear. I have actually tried the exact same code that is in the manual from "Manipulating messages in the XMLNS domain" and I get a warning saying "xmlns" is not a namespace constant. Has anyone else experienced this? |
|
Back to top |
|
 |
jefflowrey |
Posted: Sat Apr 30, 2005 5:43 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Upgrade to FP4 or FP5.
I remember seeing a bug here about namespace declarations. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Diwakar |
Posted: Fri May 13, 2005 2:00 pm Post subject: |
|
|
Apprentice
Joined: 06 Apr 2005 Posts: 33
|
I am facing the same problem.....I am using WBIMB v5 CSD4.
Has anybody found a solution to this problem ??
Please let me know.
Thanks. |
|
Back to top |
|
 |
GSnyder13 |
Posted: Sat May 14, 2005 3:25 am Post subject: Namespace - XMLNS |
|
|
Novice
Joined: 29 Mar 2005 Posts: 13 Location: United States
|
My problem was really due to a misunderstanding regarding warnings issued by the broker. When I code this (where 'manu_sp' can be anything you want it to be):
DECLARE manu_sp NAMESPACE 'http://www.w3.org/2001/XMLSchema-instance';
SET OutputRoot.XMLNS.admin.(XML.NamespaceDecl)xmlns:noNamespaceSchemaLocation = 'csm_admin.xsd';
The editor that does the syntax check will issue a warning that "Namespace constant xmlns has not been defined". "xmlns" is a constant, but it apparently is not visible to the syntax checker in the ESQL editor. This warning is just that---a warning. When the ESQL is saved, deployed, and tested, you WILL get this as output:
<admin xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="csm_admin.xsd">
I take back my disparaging remarks about the code not working. It DOES work. What the manual doesn't address is the issue about warnings and the constant 'xmlns' not being visible to the syntax checker in the broker when editing the ESQL. |
|
Back to top |
|
 |
|