From: Jason S. <js...@in...> - 2011-04-08 16:25:20
|
+1. DTDs are part of the XML spec, and the rumors of their death are greatly exaggerated. They are still, in fact, quite indispensible. And when I put a well formed XML document into a database, I should be able to get the same document back, right? If I am dealing with machine-to-machine XML documents, who cares if the DTD stays or goes. However, from an XML authoring perspective, this is a very serious missing feature. In my world, this limitation has come up several times in the past few months. Welcome to success! The more successful you are, the more people expect from you. ;-) Jason Smith ________________________________ From: Casey Jordan [cas...@jo...] Sent: Thursday, April 07, 2011 2:50 PM To: Jens Østergaard Petersen Cc: exi...@li... ml Subject: Re: [Exist-open] Propagating doctype definition in XQuery There are some interesting suggestions and I thank you all for your replies. I will play around with these ideas. One thing that really scares me here is that it appears the doctype declarion is being stripped out when files are saved to eXist. I don't see how it makes sense for a native xml database to be stripping out the doctype declarions.... When people edit files in webDav via oXygen or other tools many times the doctype is required to determine the correct grammar association and more. Am I missing something here? Thanks, Casey 2011/4/3 Jens Østergaard Petersen <oe...@gm...<mailto:oe...@gm...>> Hi Casey, I assume you want to process a dita document. As Andrew wrote, there is no way to access the doctype, since it is not a processing instruction node (or any other node accessible to xquery/xpath). However, since the dita doctype is revealed in the attributes on the interpreted root element, one can reconstruct it by wrapping it up in another element and pulling out the relevant attribute. Let us start with a test.xml like this: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE task PUBLIC "-//OASIS//DTD DITA General Task//EN" "http://docs.oasis-open.org/dita/v1.1/OS/dtd/task.dtd"> <task id="taskId"> <title>Task title</title> <shortdesc/> <taskbody> <context> <p>Context for the current task</p> </context> <steps> <step> <cmd>Task step.</cmd> </step> </steps> </taskbody> </task> This gets interpreted as <?xml version="1.0" encoding="UTF-8"?> <task xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/" id="taskId" ditaarch:DITAArchVersion="1.2" domains="(topic task) (topic hi-d) (topic ut-d) (topic indexing-d) (topic hazard-d) (topic abbrev-d) (topic pr-d) (topic sw-d) (topic ui-d) " class="- topic/topic task/task "> <title class="- topic/title ">Task title</title> <shortdesc class="- topic/shortdesc "/> <taskbody class="- topic/body task/taskbody "> <context class="- topic/section task/context "> <p class="- topic/p ">Context for the current task</p> </context> <steps class="- topic/ol task/steps "> <step class="- topic/li task/step "> <cmd class="- topic/ph task/cmd ">Task step.</cmd> </step> </steps> </taskbody> </task> and the fact that task.dtd is used can be queried with let $a := doc("test.xml") let $b := <transform> {$a/task/@domains} </transform> return if (contains($b/@domains, "(topic task)")) then 'task.dtd' else 'some other dtd' I don't know anything about dita - perhaps @class is more revealing? Cheers, Jens On Apr 3, 2011, at 1:01 AM, Casey Jordan wrote: Hi all, Quick question, say I have a identity function like below that just copies a document declare function jorsek-editor:load-document($document-uri as xs:string) as document-node() { let $doc := doc($document-uri) return document{ (: I want to copy all processing instructions, doctype definitions etc here :) $doc/processing-instruction(), (: Copy the documentElement :) $doc/*[1] } }; So my question is, how can I copy the doctype definition along with the processing instructions that are above the document element? Thanks, Casey -- -- Casey Jordan easyDITA a product of Jorsek LLC "CaseyDJordan" on LinkedIn, Twitter & Facebook Cell (585) 348 7399 Office (585) 239 6060 easydita.com<http://easydita.com/> This message is intended only for the use of the Addressee(s) and may contain information that is privileged, confidential, and/or exempt from disclosure under applicable law. If you are not the intended recipient, please be advised that any disclosure copying, distribution, or use of the information contained herein is prohibited. If you have received this communication in error, please destroy all copies of the message, whether in electronic or hard copy format, as well as attachments, and immediately contact the sender by replying to this e-mail or by phone. Thank you. ------------------------------------------------------------------------------ Create and publish websites with WebMatrix Use the most popular FREE web apps or write code yourself; WebMatrix provides all the features you need to develop and publish your website. http://p.sf.net/sfu/ms-webmatrix-sf _______________________________________________ Exist-open mailing list Exi...@li...<mailto:Exi...@li...> https://lists.sourceforge.net/lists/listinfo/exist-open ------------------------------------------------------------------------------ Create and publish websites with WebMatrix Use the most popular FREE web apps or write code yourself; WebMatrix provides all the features you need to develop and publish your website. http://p.sf.net/sfu/ms-webmatrix-sf _______________________________________________ Exist-open mailing list Exi...@li...<mailto:Exi...@li...> https://lists.sourceforge.net/lists/listinfo/exist-open -- -- Casey Jordan easyDITA a product of Jorsek LLC "CaseyDJordan" on LinkedIn, Twitter & Facebook Cell (585) 348 7399 Office (585) 239 6060 easydita.com<http://easydita.com> This message is intended only for the use of the Addressee(s) and may contain information that is privileged, confidential, and/or exempt from disclosure under applicable law. If you are not the intended recipient, please be advised that any disclosure copying, distribution, or use of the information contained herein is prohibited. If you have received this communication in error, please destroy all copies of the message, whether in electronic or hard copy format, as well as attachments, and immediately contact the sender by replying to this e-mail or by phone. Thank you. |