- if (m_schemaLocation) {
- static const XMLCh schemaLocation[]= UNICODE_LITERAL_14(s,c,h,e,m,a,L,o,c,a,t,i,o,n);
- if (targetElement->getParentNode()==NULL || targetElement->getParentNode()->getNodeType()==DOMNode::DOCUMENT_NODE)
- targetElement->setAttributeNS(XSI_NS,schemaLocation,m_schemaLocation);
+ if (m_schemaLocation || m_noNamespaceSchemaLocation) {
+ static const XMLCh schemaLocation[] = {
+ chLatin_x, chLatin_s, chLatin_i, chColon,
+ chLatin_s, chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a,
+ chLatin_L, chLatin_o, chLatin_c, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull
+ };
+ static const XMLCh noNamespaceSchemaLocation[] = {
+ chLatin_x, chLatin_s, chLatin_i, chColon,
+ chLatin_n, chLatin_o, chLatin_N, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chLatin_p, chLatin_a, chLatin_c, chLatin_e,
+ chLatin_S, chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a,
+ chLatin_L, chLatin_o, chLatin_c, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull
+ };
+ if (targetElement->getParentNode()==nullptr || targetElement->getParentNode()->getNodeType()==DOMNode::DOCUMENT_NODE) {
+ if (m_schemaLocation)
+ targetElement->setAttributeNS(XSI_NS,schemaLocation,m_schemaLocation);
+ if (m_noNamespaceSchemaLocation)
+ targetElement->setAttributeNS(XSI_NS,noNamespaceSchemaLocation,m_noNamespaceSchemaLocation);
+ }
+ }
+
+ static const XMLCh _nil[] = { chLatin_x, chLatin_s, chLatin_i, chColon, chLatin_n, chLatin_i, chLatin_l, chNull };
+
+ if (m_nil != xmlconstants::XML_BOOL_NULL) {
+ switch (m_nil) {
+ case xmlconstants::XML_BOOL_TRUE:
+ targetElement->setAttributeNS(XSI_NS, _nil, xmlconstants::XML_TRUE);
+ break;
+ case xmlconstants::XML_BOOL_ONE:
+ targetElement->setAttributeNS(XSI_NS, _nil, xmlconstants::XML_ONE);
+ break;
+ case xmlconstants::XML_BOOL_FALSE:
+ targetElement->setAttributeNS(XSI_NS, _nil, xmlconstants::XML_FALSE);
+ break;
+ case xmlconstants::XML_BOOL_ZERO:
+ targetElement->setAttributeNS(XSI_NS, _nil, xmlconstants::XML_ZERO);
+ break;
+ }
+ m_log.debug("adding XSI namespace to list of namespaces visibly used by XMLObject");
+ addNamespace(Namespace(XSI_NS, XSI_PREFIX, false, Namespace::VisiblyUsed));