Output schemaLocation when set on the root of a fragment.
authorScott Cantor <cantor.2@osu.edu>
Thu, 1 Jun 2006 16:48:57 +0000 (16:48 +0000)
committerScott Cantor <cantor.2@osu.edu>
Thu, 1 Jun 2006 16:48:57 +0000 (16:48 +0000)
xmltooling/io/AbstractXMLObjectMarshaller.cpp

index 5d22362..f228875 100644 (file)
@@ -177,12 +177,19 @@ void AbstractXMLObjectMarshaller::marshallInto(
 {\r
     if (getElementQName().hasPrefix())\r
         targetElement->setPrefix(getElementQName().getPrefix());\r
+\r
+    if (m_schemaLocation) {\r
+        static const XMLCh schemaLocation[]= UNICODE_LITERAL_14(s,c,h,e,m,a,L,o,c,a,t,i,o,n);\r
+        if (targetElement->getParentNode()==NULL || targetElement->getParentNode()->getNodeType()==DOMNode::DOCUMENT_NODE)\r
+            targetElement->setAttributeNS(XMLConstants::XSI_NS,schemaLocation,m_schemaLocation); \r
+    }\r
+\r
     marshallElementType(targetElement);\r
     marshallNamespaces(targetElement);\r
     marshallAttributes(targetElement);\r
     marshallChildElements(targetElement);\r
     marshallElementContent(targetElement);\r
-\r
+    \r
 #ifndef XMLTOOLING_NO_XMLSEC\r
     if (sigs) {\r
         for_each(sigs->begin(),sigs->end(),mem_fun<void,Signature>(&Signature::sign));\r