[MarkLogic Dev General] Loading a document through XCC with the
Content object
Michael Blakeley
michael.blakeley at marklogic.com
Mon Jun 30 12:05:21 PDT 2008
Mattio,
I don't know much about C#, but I do know that the node-kind code in cq
isn't 100% reliable, especially if you're using an older release of cq.
Multiple nodes at the root level can produce misleading cq listings.
Try this:
for $i in doc('/product/633504414890149643.xml')/node()
return xdmp:describe($i)
If the problem is in cq's node-kind code, you might see something like:
doc('/product/633504414890149643.xml')/text()
doc('/product/633504414890149643.xml')/product
(Guessing that your root element is named "product" - otherwise, replace
"product" with whatever your root element is called). But if there's a
problem with the document ingestion, you might see a text node by itself:
doc('/product/633504414890149643.xml')/text()
In that case, there's a problem with document ingestion, and your
document is arriving as serialized text, instead of XML.
-- Mike
Mattio Valentino wrote:
> I'm loading an XML file using XCC in C#. It's working fine, but I
> noticed one detail I'm not sure about.
>
> I'm loading the file with the following snippet:
>
> FileInfo file = new FileInfo(fileUri);
> ContentCreateOptions options = new ContentCreateOptions();
> options.Collections = new string[] { this.Collection };
> options.Format = DocumentFormat.Format.XML;
> Marklogic.Xcc.Content myDocument =
> ContentFactory.NewContent(this.Collection + "/" + file.Name, file,
> options);
> mlSession.InsertContent(myDocument);
>
> The document loads fine and I can query it with cq fine.
>
> When I list all documents in cq using the link in the top left,
> documents I've loaded with xdmp:load or xdmp:document-load come up
> with something like:
>
> /product/GR3410.xml - element book
>
> But the documents I loaded with XCC come up with something like:
>
> /product/633504414890149643.xml - text
>
> Am I doing something wrong when I insert the document or is this
> nothing to worry about?
>
> Thanks,
> Mattio
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://xqzone.com/mailman/listinfo/general
More information about the General
mailing list