Author |
Message
|
ninja |
Posted: Tue Jul 21, 2009 8:08 am Post subject: How can I create a DOCTYPE statement using a prefix? |
|
|
Newbie
Joined: 21 Jul 2009 Posts: 8
|
Hi all,
I'm using WMB 6.1 and I have to create an output like below using ESQL:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE SwInt:ExchangeRequest SYSTEM "Sw.dtd">
<SwInt:ExchangeRequest>
...
</SwInt:ExchangeRequest>
Reading some topics I understood I must use XMLNS parser since DTD support in XMLNSC parser is limited.
Always in some topics I saw the code to produce a similar output without prefixs.
Simple output:
<?xml version="1.0"?>
<!DOCTYPE Order SYSTEM "NewDtdName.dtd">
<Order>
<Test>OK</Test>
</Order>
Simple code:
SET OutputRoot.XMLNS.(XML.XmlDecl) = '';
SET OutputRoot.XMLNS.(XML.XmlDecl).(XML.Version) = '1.0';
SET OutputRoot.XMLNS.(XML.DocTypeDecl)Order ='';
SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.SystemId) = 'NewDtdName.dtd';
SET OutputRoot.XMLNS.(XML.Element)Order.Test = 'OK';
I'm trying to extend this code to get my output but I'm not having good results.
Do you have some advice for me?
Thanks in advance! |
|
Back to top |
|
 |
kimbert |
Posted: Tue Jul 21, 2009 1:37 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Have you tried simply specifying the prefixed string 'SwInt:ExchangeRequest'? |
|
Back to top |
|
 |
ninja |
Posted: Wed Jul 22, 2009 12:25 am Post subject: |
|
|
Newbie
Joined: 21 Jul 2009 Posts: 8
|
Hi Kimbert,
if I write the following code:
SET OutputRoot.XMLNS.(XML.XmlDecl) = '';
SET OutputRoot.XMLNS.(XML.XmlDecl).(XML.Version) = '1.0';
SET OutputRoot.XMLNS.(XML.DocTypeDecl)myns:Order ='';
SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.SystemId) = 'NewDtdName.dtd';
SET OutputRoot.XMLNS.(XML.Element)myns:Order.Test = 'OK';
I get this (not good) output:
<?xml version="1.0"?>
<!DOCTYPE Order SYSTEM "NewDtdName.dtd">
<NS1:Order xmlns:NS1="myns">
<Test>OK</Test><
/NS1:Order>
But if I use this code:
SET OutputRoot.XMLNS.(XML.XmlDecl) = '';
SET OutputRoot.XMLNS.(XML.XmlDecl).(XML.Version) = '1.0';
SET OutputRoot.XMLNS.(XML.DocTypeDecl)"myns:Order" ='';
SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.SystemId) = 'NewDtdName.dtd';
SET OutputRoot.XMLNS.(XML.Element)"myns:Order".Test = 'OK';
...I get the right code!
It sounds a little "tricky" to me since WMB is not aware of the prefix...but if we don't have other solutions it's ok
Thanks! |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jul 22, 2009 1:06 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Why not declare the namespace? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
ninja |
Posted: Wed Jul 22, 2009 1:53 am Post subject: |
|
|
Newbie
Joined: 21 Jul 2009 Posts: 8
|
Hi Vitor,
if I declare and I use the namespaces, then I will get in the output the xmlns attribute in the elements: and this is unwanted.
The problem is that, I suppose, all namespaces are declared externally in the dtd file but WMB can't understand it. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jul 22, 2009 1:20 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
It sounds a little "tricky" to me since WMB is not aware of the prefix. |
Check the definition of the DOCTYPE tag in the XML specification. It is a 'Name', not a 'QName'. In other words, the string following 'DOCTYPE' is interpreted as a simple XML name, and not as a prefixed name. |
|
Back to top |
|
 |
|