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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
+ XSLT Help and Discussion (7625)
- XQuery Help and Discussion (2017)
-> + Issue with Processing Instruct... (2)
-> + problem converting json to XML... (2)
-> + Problem base64 decoding string... (3)
-> + Problems posting multipart for... (5)
-> + trouble with download of price... (2)
-> + Problem with http-post not bei... (3)
-> + path problem, xps_file:writeAl... (9)
-> + Xquery update support? (2)
-> + problem with Stylus studio try... (5)
-> - adding dtd reference to xml ou... (4)
-> ->adding dtd reference to x...
-> ->adding dtd reference to x...
-> ->adding dtd reference to x...
-> + xquery escaping ambarsand when... (3)
-> + Whitespace problem when return... (5)
-> + Problem with namespace prefix ... (5)
-> - Sending via SFTP returns unexp... (1)
-> + Query and Sftp clent (4)
-> + xquery and try - catch (3)
-> + Query + ddtek:http-post optio... (5)
-> + Example files referenced in do... (3)
-> + Automatic Error Detection and ... (3)
-> + Working with result of ddtek:h... (2)
-- [1-20] [21-40] [41-60] Next
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
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

   
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.