On Thu, 27 May 2010 13:44:17 -0700, cOre dUmPeR <[email protected]>
wrote:
> How does one open a file (on the filesystem) *without* stripping the DTD
> decl?
>
> Usually I do xdmp:document-get("/home/me/file.xml") to read files,
> however...
>
> In this case...file.xml has a DTD declaration...one that I would like to
> extract from the file and parse...but xdmp:document-get() will **strip**
> DTD decls :(
>
> So is there a way to read the file *without* stripping the DTD decl? Can
> I tell MLS to read the file as a plain string instead of as xml?
>
> Or better yet, does MLS keep the DTD info that I can retrieve instead of
> me parsing it?
>
> thanks
> /marv
>
Yes, you can read it as plain text instead of as XML:
xdmp:document-get("/home/me/file.xml",
<options xmlns="xdmp:document-get">
<format>text</format>
</options>
)
This will get you the document as one giant text node.
But if you want to treat what you have as XML, then you need
to construct a XML data model instance, and if you do that,
then it will be parsed, and the DTD is not part of the XDM
because it is instructions for the XML parser. Ditto for
character entities and CDATA sections and things like
inter-attribute whitespace.
//Mary
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general