Author |
Message
|
sivaguru |
Posted: Thu Sep 18, 2008 6:34 am Post subject: Issue relating to XMLNSC:XmlDeclaration |
|
|
Apprentice
Joined: 18 Jun 2008 Posts: 40
|
Hi,
We are currently testing our flow in v6.1 and we are facing an issue, can any one help us in solving the error. Below are the details
Trying to generate a XML structure
-------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8" Standalone="yes"?>
<Messages xmlns="http://www.s.org/b/message" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
RC='' RequestID='' version =''>
<Message>
<TimeStamp></TimeStamp>
…..
…..
<Message>
</Messages>
Snippet of the Code
---------------------------------
DECLARE Ns NAMESPACE 'http://www.s.org/b/message';
DECLARE xsi NAMESPACE 'http://www.w3.org/2001/XMLSchema-instance';
SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)version = '1.0';
SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)encoding = 'UTF-8';
SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)standalone = 'yes';
SET OutputRoot.XMLNSC.Messages.(XMLNSC.NamespaceDecl)xmlns = 'http://www.s.org/b/message';
SET OutputRoot.XMLNSC.Messages.(XMLNSC.NamespaceDecl)xmlns:xsi = 'http://www.w3.org/2001/XMLSchema-instance';
CREATE FIELD OutputRoot.XMLNSC.Messages.Ns:RC TYPE NameValue VALUE '0';
CREATE FIELD OutputRoot.XMLNSC.Messages.Ns:RequestID TYPE NameValue VALUE '';
CREATE FIELD OutputRoot.XMLNSC.Messages.Ns:version TYPE NameValue VALUE '2.0';
CREATE FIELD OutputRoot.XMLNSC.Messages.Ns:Message[1].RC TYPE NameValue VALUE '0';
CREATE FIRSTCHILD OF OutputRoot.XMLNSC.Messages.Ns:Message[1] Domain('XMLNSC') NAME 'TimeStamp' VALUE CURRENT_TIMESTAMP;
Trace Log Details
-----------------------------
(0x01000000):XMLNSC = (
(0x01000400): = (
(0x03000100):Version = '1.0'
(0x03000100):Encoding = 'UTF-8'
(0x03000100):StandAlone = 'no'
)
(0x01000000):Messages = (
(0x03000102):xmlns = 'http://www.s.org/b/message'
(0x03000102)xmlns:xsi = 'http://www.w3.org/2001/XMLSchema-instance'
(0x03000000)http://www.s.org/b/message:RC = '0'
(0x03000000)http://www.s.org/b/message:RequestID = ''
(0x03000000)http://www.s.org/b/message:version = '2.0'
(0x01000000)http://www.s.org/b/message:Message = (
(0x03000000):TimeStamp = TIMESTAMP '2008-09-18 08:28:35.775814'
(0x03000000):RC = '0' (0x03000000):MessageCode = 0
(0x03000000):MessageText = 'ConnectionDetails node does not have child node of type HTTP / MQ / ODBC in the input file '
(0x03000000):Severity = NULL
(0x03000000):MessageSource = ''
(0x03000000):MachineID = ''
(0x03000000):ClientInfo = ''
)
)
)
)
Error no and text From Exception List
-------------------------------------------
(0x03000000):Number = 5014
(0x03000000):Text = 'Element must have a namespace specified if there is a default namespace in scope'
 |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Sep 18, 2008 7:15 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
The error is specific, and your code is clearly failing to do what the error says it is failing to do.
Look at your CREATE statements closer. |
|
Back to top |
|
 |
sivaguru |
Posted: Thu Sep 18, 2008 8:10 am Post subject: |
|
|
Apprentice
Joined: 18 Jun 2008 Posts: 40
|
Hi,
Thanks for your reply. Are we erroring out in the below area since we dont know the syntax, can you give any reference or some sample to understand
CREATE FIELD OutputRoot.XMLNSC.Messages.Ns:Message[1].RC TYPE NameValue VALUE '0';
CREATE FIRSTCHILD OF OutputRoot.XMLNSC.Messages.Ns:Message[1] Domain('XMLNSC') NAME 'TimeStamp' VALUE CURRENT_TIMESTAMP;
 |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Sep 18, 2008 9:11 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
What does the error message say? That you didn't apply a namespace.
What did you do in your CREATE statement? You failed to apply a namespace.
What does the documentation tell you about how to use CREATE to apply a namespace? |
|
Back to top |
|
 |
sivaguru |
Posted: Thu Sep 18, 2008 9:19 am Post subject: |
|
|
Apprentice
Joined: 18 Jun 2008 Posts: 40
|
Hi,
In my case "Messages" is the root node where I created two namespace
xmlns & xmlns:xsi
Ns is the declaration of the xmlns namespace and I have prefixed Ns: for the direct child nodes of "Messages".
Do I need to prefix the Ns: for all sub elements and attributes of the root node "Messages".
Sorry Iam not clear abt the log message. Could you pls explain.
 |
|
Back to top |
|
 |
kimbert |
Posted: Thu Sep 18, 2008 12:07 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Please note the following very important facts:
- *every* element in your output tree must have the correct namespace. That means that your message flow needs to explicitly set the namespace on every single element ( unless the element really does not have a namespace ).
- An XML tag without a namespace prefix might still have a namespace. Please read about default namespaces in XML.
- The above rules mean that you will sometimes need to include a namespace in your ESQL element name even when the XML tag that you want to generate does not have a namespace prefix.
If you are not sure whether your output message tree is correct, do this:
- parse the XML message using XMLNS/XMLNSC and inspect the message tree using the debugger/Trace node. Take note of the namespace on each element
- Now use the same technique to inspect the output message tree that you have built. Does every element have the same namespace as the parser gave it? If not, you have failed! |
|
Back to top |
|
 |
sivaguru |
Posted: Thu Sep 18, 2008 8:25 pm Post subject: [Solved] - Issue relating to XMLNSC:XmlDeclaration |
|
|
Apprentice
Joined: 18 Jun 2008 Posts: 40
|
Hi,
Thanks we identified the pblm the problem and fixed it. As you said all the elements that are suppose to be in the scope of the namespace has to be prefixed with the namespace declaration.
Thanks again very much.
 |
|
Back to top |
|
 |
|