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\marklogic\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\marklogic\xcc\ContentCreateOptions.html>
 createOptions)

>From the API:

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