Hi Geert,

 

Yes, I'm using Oxygen to browse the database using WebDAV.  I found a
solution which works, though it seems like a bit of extra work:

 

        cco.setNamespace(doc.getDocumentElement().getAttribute("xmlns"));

        Content content = ContentFactory.newContent(uri, doc, cco);

        session.insertContent(content);

 

 

Thanks,

gary

From: [email protected]
[mailto:[email protected]] On Behalf Of Geert Josten
Sent: Tuesday, June 07, 2011 4:52 PM
To: General MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] REsolved: XCC add Document
droppingxmlns attribute

 

Hi Gary,

 

How did you verify the presence (or absence) of the xmlns attribute within
MarkLogic Server?

 

Kind regards,

Geert

 

Van: [email protected]
[mailto:[email protected]] Namens Gary Larsen
Verzonden: dinsdag 7 juni 2011 22:28
Aan: 'General MarkLogic Developer Discussion'
Onderwerp: [MarkLogic Dev General] REsolved: XCC add Document dropping xmlns
attribute

 

This code will correct the namespace declaration (but seems like an  extra
step to me):

 

        cco.setNamespace(doc.getDocumentElement().getAttribute("xmlns"));

        Content content = ContentFactory.newContent(uri, doc, cco);

        session.insertContent(content);

 

gary

 

From: [email protected]
[mailto:[email protected]] On Behalf Of Gary Larsen
Sent: Tuesday, June 07, 2011 4:16 PM
To: 'General MarkLogic Developer Discussion'
Subject: [MarkLogic Dev General] XCC add Document dropping xmlns attribute

 

Hi,

 

It appears that when I store a Document using this ContentFactory method the
default namespace declaration is being stripped:

 

public static Content
<file:///C:\download-xmldb\Mark%20Logic\MarkXCC.Java-4.2-2\docs\api\com\mark
logic\xcc\Content.html>  newContent(String
<http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html>  uri,
                                 Document
<http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/Document.html>
document,
                                 ContentCreateOptions
<file:///C:\download-xmldb\Mark%20Logic\MarkXCC.Java-4.2-2\docs\api\com\mark
logic\xcc\ContentCreateOptions.html>  createOptions)

 

>From the API:

 

Create a new
<file:///C:\download-xmldb\Mark%20Logic\MarkXCC.Java-4.2-2\docs\api\com\mark
logic\xcc\Content.html> Content object from a W3C DOM
<http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/Document.html> Document
object. If not explicitly overridden, the document format will be set to
XML. This factory method makes use of the standard JAX
<http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/transform/TransformerFact
ory.html> TransformerFactory facility to serialize the DOM to a
UTF-8-encoded byte stream. See
<http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/transform/TransformerFact
ory.html#newInstance%28%29> TransformerFactory.newInstance() for information
on how to customize the transformer implementation.

 

I'm guessing that I somehow need to setNamespaceAware() on the Transformer
but there does not appear to be the means to do that.   Am I on the right
track?

 

Thanks,

gary

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to