XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Bruce CantorSubject: adding dtd reference to xml output via Xquery
Author: Bruce Cantor
Date: 01 Feb 2023 10:48 AM
Originally Posted: 01 Feb 2023 09:58 AM
Hi Forum

I am trying to add the dtd reference on some xml out, but failing.

As far as I can see I should use the ddtek:serialize function to add the information , but I am having trouble getting it to work.
The docs says that cdata-section-elements are Modifiable but I cannot grab the concept of adding it, so that is actually comes out in the result.


This is the reference I would like to add: <!DOCTYPE cXML SYSTEM "http://xml.cXML.org/schemas/cXML/1.2.014/cXML.dtd">

I tried like this, and it does not fail, but it does not work either:

ddtek:serialize(


<cXML payloadID="{concat($timestampInMilisec,'@eet.group-',$environment )}" timestamp="{$timestamp}" xml:lang="{$SAPDoclang}">
<Response>
Response information
</Response>
</cXML>
, "indent=yes, omit-xml-declaration=yes, cdata-section-elements = DOCTYPE"
)

How do I add the reference in xquery, please?

Postnext
Bruce CantorSubject: adding dtd reference to xml output via Xquery
Author: Bruce Cantor
Date: 01 Feb 2023 10:49 AM
Solution found (if anybody else has the same problem ):

Add doctype-system = http://xml.cXML.org/schemas/cXML/1.2.014/cXML.dtd as a serialization option.

Postnext
Bruce CantorSubject: adding dtd reference to xml output via Xquery
Author: Bruce Cantor
Date: 02 Feb 2023 08:14 AM
Problem is that the above code returns escaped xml tags, like this:

<?xml version="1.0" encoding="UTF-8"?>&lt;!DOCTYPE cXML SYSTEM "http://xml.cXML.org/schemas/cXML/1.2.014/cXML.dtd"&gt;&#xD;
&lt;cXML payloadID="1675325426156@eet.group-Local" xml:lang="en-US" timestamp="2023-02-02T09:10:26.156+01:00"&gt;&#xD;
&lt;Response&gt;&#xD;
&lt;Status xml:lang="en-US" code="200" text="OK"/&gt;&#xD;
&lt;/Response&gt;&#xD;
&lt;/cXML&gt;

Does anyone know how to make the result include 'normal' XML tags?

If I use the ddtek:parse function around the serialize it will return 'normal' looking XML, but then the dtd reference goes missing:

<?xml version="1.0" encoding="UTF-8"?>
<cXML payloadID="1675325557316@eet.group-Local" xml:lang="en-US" timestamp="2023-02-02T09:12:37.316+01:00" version="1.2.014">
<Response>
<Status xml:lang="en-US" code="200" text="OK"/>
</Response>
</cXML>

Posttop
Ivan PedruzziSubject: adding dtd reference to xml output via Xquery
Author: Ivan Pedruzzi
Date: 02 Feb 2023 01:49 PM

ddtek:serialize produces text not XML.

Please post a complete xquery example of your code.


The following query shows two methods to output a DTD declaration

1) in the main query output
2) in a secondary output using ddtek:serialize-to-url



declare option ddtek:serialize "indent=yes, doctype-system='http://xml.cXML.org/schemas/cXML/1.2.014/cXML.dtd'";
let $xml := <root/>
return (
$xml,
ddtek:serialize-to-url(
$xml,
"dtd_example.xml",
"indent=yes, doctype-system='http://xml.cXML.org/schemas/cXML/1.2.014/cXML.dtd'")
)



Ivan Pedruzzi
Stylus Studio Team

 
Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.