From: Adam R. <ad...@ex...> - 2011-04-07 21:17:32
|
If I understand correctly then the doctype is not stripped-out of the document, well kinda. Basically eXist-db should extract the doctype when you store the document and store it in the document's metadata store. When eXist-db serializes the document, then the doctype is retrieved from the document's metadata store and output just before the document itself. At least that is what should be happening... 2011/4/7 Casey Jordan <cas...@jo...>: > 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...> >> >> 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 >> >> >> 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... >> 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... >> 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 > > > 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. > > ------------------------------------------------------------------------------ > Xperia(TM) PLAY > It's a major breakthrough. An authentic gaming > smartphone on the nation's most reliable network. > And it wants your games. > http://p.sf.net/sfu/verizon-sfdev > _______________________________________________ > Exist-open mailing list > Exi...@li... > https://lists.sourceforge.net/lists/listinfo/exist-open > > -- Adam Retter eXist Developer { United Kingdom } ad...@ex... irc://irc.freenode.net/existdb |