Inserting single-occurrence XML elements with children simplified
This commit is contained in:
parent
68aec5dfb4
commit
452fa4b9dc
@ -668,7 +668,7 @@ void eap::config_connection::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *
|
|||||||
|
|
||||||
// Create <EAPIdentityProviderList> node.
|
// Create <EAPIdentityProviderList> node.
|
||||||
com_obj<IXMLDOMElement> pXmlElIdentityProviderList;
|
com_obj<IXMLDOMElement> pXmlElIdentityProviderList;
|
||||||
if (FAILED(hr = eapxml::create_element(pDoc, bstr(L"EAPIdentityProviderList"), namespace_eapmetadata, &pXmlElIdentityProviderList)))
|
if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:EAPIdentityProviderList"), bstr(L"EAPIdentityProviderList"), namespace_eapmetadata, &pXmlElIdentityProviderList)))
|
||||||
throw com_runtime_error(hr, __FUNCTION__ " Error creating <EAPIdentityProviderList> element.");
|
throw com_runtime_error(hr, __FUNCTION__ " Error creating <EAPIdentityProviderList> element.");
|
||||||
|
|
||||||
for (provider_list::const_iterator provider = m_providers.cbegin(), provider_end = m_providers.cend(); provider != provider_end; ++provider) {
|
for (provider_list::const_iterator provider = m_providers.cbegin(), provider_end = m_providers.cend(); provider != provider_end; ++provider) {
|
||||||
@ -683,9 +683,6 @@ void eap::config_connection::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *
|
|||||||
if (FAILED(hr = pXmlElIdentityProviderList->appendChild(pXmlElIdentityProvider, NULL)))
|
if (FAILED(hr = pXmlElIdentityProviderList->appendChild(pXmlElIdentityProvider, NULL)))
|
||||||
throw com_runtime_error(hr, __FUNCTION__ " Error appending <EAPIdentityProvider> element.");
|
throw com_runtime_error(hr, __FUNCTION__ " Error appending <EAPIdentityProvider> element.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FAILED(hr = pConfigRoot->appendChild(pXmlElIdentityProviderList, NULL)))
|
|
||||||
throw com_runtime_error(hr, __FUNCTION__ " Error appending <EAPIdentityProviderList> element.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ void eap::credentials_tls::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pC
|
|||||||
|
|
||||||
// <ClientCertificate>
|
// <ClientCertificate>
|
||||||
com_obj<IXMLDOMElement> pXmlElClientCertificate;
|
com_obj<IXMLDOMElement> pXmlElClientCertificate;
|
||||||
if (FAILED(hr = eapxml::create_element(pDoc, bstr(L"ClientCertificate"), namespace_eapmetadata, &pXmlElClientCertificate)))
|
if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:ClientCertificate"), bstr(L"ClientCertificate"), namespace_eapmetadata, &pXmlElClientCertificate)))
|
||||||
throw com_runtime_error(hr, __FUNCTION__ " Error creating <ClientCertificate> element.");
|
throw com_runtime_error(hr, __FUNCTION__ " Error creating <ClientCertificate> element.");
|
||||||
|
|
||||||
if (m_cert) {
|
if (m_cert) {
|
||||||
@ -111,9 +111,6 @@ void eap::credentials_tls::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pC
|
|||||||
if (FAILED(hr = eapxml::put_element_base64(pDoc, pXmlElClientCertificate, bstr(L"cert-data"), namespace_eapmetadata, m_cert->pbCertEncoded, m_cert->cbCertEncoded)))
|
if (FAILED(hr = eapxml::put_element_base64(pDoc, pXmlElClientCertificate, bstr(L"cert-data"), namespace_eapmetadata, m_cert->pbCertEncoded, m_cert->cbCertEncoded)))
|
||||||
throw com_runtime_error(hr, __FUNCTION__ " Error creating <cert-data> element.");
|
throw com_runtime_error(hr, __FUNCTION__ " Error creating <cert-data> element.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FAILED(hr = pConfigRoot->appendChild(pXmlElClientCertificate, NULL)))
|
|
||||||
throw com_runtime_error(hr, __FUNCTION__ " Error appending <ClientCertificate> element.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,14 +99,11 @@ void eap::credentials_ttls::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *p
|
|||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
// <InnerAuthenticationMethod>
|
// <InnerAuthenticationMethod>
|
||||||
winstd::com_obj<IXMLDOMElement> pXmlElInnerAuthenticationMethod;
|
com_obj<IXMLDOMElement> pXmlElInnerAuthenticationMethod;
|
||||||
if (FAILED(hr = eapxml::create_element(pDoc, winstd::bstr(L"InnerAuthenticationMethod"), namespace_eapmetadata, &pXmlElInnerAuthenticationMethod)))
|
if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:InnerAuthenticationMethod"), bstr(L"InnerAuthenticationMethod"), namespace_eapmetadata, &pXmlElInnerAuthenticationMethod)))
|
||||||
throw com_runtime_error(hr, __FUNCTION__ " Error creating <InnerAuthenticationMethod> element.");
|
throw com_runtime_error(hr, __FUNCTION__ " Error creating <InnerAuthenticationMethod> element.");
|
||||||
|
|
||||||
m_inner->save(pDoc, pXmlElInnerAuthenticationMethod);
|
m_inner->save(pDoc, pXmlElInnerAuthenticationMethod);
|
||||||
|
|
||||||
if (FAILED(hr = pConfigRoot->appendChild(pXmlElInnerAuthenticationMethod, NULL)))
|
|
||||||
throw com_runtime_error(hr, __FUNCTION__ " Error appending <InnerAuthenticationMethod> element.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user