示例#1
0
ATTR_METHOD_IMPL(CElementParser, OnMaxOccurs)
{
    TRACE_PARSE_ENTRY();

    if (cchValue==sizeof("unbounded")-1 && !wcsncmp(wszValue, L"unbounded", cchValue))
    {
        CElement * pCurr = GetElement();
        if (pCurr != NULL)
        {
            pCurr->SetMaxOccurs(MAXOCCURS_UNBOUNDED);
            return S_OK;
        }
        return E_FAIL;
    }

    int nMaxOccurs = 0;
    nMaxOccurs = _wtoi(wszValue);
    if (nMaxOccurs >= 0)
    {
        //
        // maxOccurs must be >= 0
        //

        CElement * pCurr = GetElement();
        if (pCurr != NULL)
        {
            pCurr->SetMaxOccurs(nMaxOccurs);
            return S_OK;
        }
    }

    EmitInvalidValue("maxOccurs", wszValue);

    return E_FAIL;
}
示例#2
0
ATTR_METHOD_IMPL(CContentParser, OnMixed)
{
	TRACE_PARSE_ENTRY();

	CContent *pCurr = GetContent();
	if (pCurr != NULL)
	{
		if (SUCCEEDED(pCurr->SetMixed(wszValue, cchValue)))
		{
			return S_OK;
		}
		EmitInvalidValue("mixed", wszValue);
	}

	EmitErrorHr(E_OUTOFMEMORY);

	return E_FAIL;
}
示例#3
0
TAG_METHOD_IMPL(CWSDLOperationParser, OnSoapOperation)
{
	TRACE_PARSE_ENTRY();

	CWSDLPortTypeOperation * pCurr = GetOperation();
	if (pCurr != NULL)
	{
		CSoapOperation *pOperation = pCurr->AddSoapOperation();
		if (pOperation != NULL)
		{
			CStringW strSoapAction;
			if (S_OK == GetAttribute(pAttributes, L"soapAction", sizeof("soapAction")-1, strSoapAction))
			{
				pOperation->SetSoapAction(strSoapAction);
			}

			const wchar_t *wszStyle;
			int cchStyle;
			HRESULT hr = S_OK;
			if (S_OK == GetAttribute(pAttributes, L"style", sizeof("style")-1, &wszStyle, &cchStyle))
			{
				hr = pOperation->SetStyle(wszStyle, cchStyle);
				if (FAILED(hr))
				{
					EmitInvalidValue("style", wszStyle);
				}
			}

			if (SUCCEEDED(hr))
			{
				return SkipElement();
			}
			else
			{
				OnMissingAttribute(TRUE, L"style", sizeof("style")-1, L"", 0);
			}
		}

	}

	EmitErrorHr(E_OUTOFMEMORY);

	return E_FAIL;
}
示例#4
0
TAG_METHOD_IMPL(CWSDLBindingParser, OnSoapBinding)
{
	TRACE_PARSE_ENTRY();

	CWSDLBinding * pCurr = GetBinding();
	if (pCurr != NULL)
	{
		CSoapBinding *pBinding = pCurr->AddSoapBinding();
		if (pBinding != NULL)
		{
			SetXMLElementInfo(pBinding, pCurr, GetLocator());

			CStringW strTransport;
			if (S_OK == GetAttribute(pAttributes, L"transport", sizeof("transport")-1, strTransport))
			{
				pBinding->SetTransport(strTransport);
			}

			const wchar_t *wszStyle;
			int cchStyle;
			HRESULT hr = S_OK;
			if (S_OK == GetAttribute(pAttributes, L"style", sizeof("style")-1, &wszStyle, &cchStyle))
			{
				hr = pBinding->SetStyle(wszStyle, cchStyle);
				if (FAILED(hr))
				{
					EmitInvalidValue("style", wszStyle);
				}
			}

			if (SUCCEEDED(hr))
			{
				return SkipElement();
			}
		}

	}

	EmitErrorHr(E_OUTOFMEMORY);

	return E_FAIL;
}
示例#5
0
ATTR_METHOD_IMPL(CElementParser, OnNillable)
{
    TRACE_PARSE_ENTRY();

    CElement * pCurr = GetElement();
    if (pCurr != NULL)
    {
        bool bVal;
        HRESULT hr = GetBooleanValue(&bVal, wszValue, cchValue);
        if (SUCCEEDED(hr))
        {
            pCurr->SetNullable(bVal);
            return S_OK;
        }

        EmitInvalidValue("nillable", wszValue);
    }

    EmitErrorHr(E_OUTOFMEMORY);
    return E_FAIL;
}
示例#6
0
ATTR_METHOD_IMPL(CComplexTypeParser, OnDerivedBy)
{
	TRACE_PARSE_ENTRY();

	CComplexType * pCurr = GetComplexType();
	if (pCurr != NULL)
	{
		HRESULT hr = S_OK;
		if (pCurr->GetElementType() == XSD_COMPLEXTYPE)
		{
			if (FAILED(pCurr->SetDerivedBy(wszValue, cchValue)))
			{
				EmitInvalidValue("derivedBy", wszValue);
				hr = E_FAIL;
			}
		}
		return hr;
	}

	return E_FAIL;
}
示例#7
0
ATTR_METHOD_IMPL(CElementParser, OnMinOccurs)
{
    TRACE_PARSE_ENTRY();

    int nMinOccurs = _wtoi(wszValue);
    if (nMinOccurs >= 0)
    {
        //
        // minOccurs must be >= 0
        //

        CElement * pCurr = GetElement();
        if (pCurr != NULL)
        {
            pCurr->SetMinOccurs(nMinOccurs);
            return S_OK;
        }
    }

    EmitInvalidValue("minOccurs", wszValue);

    return E_FAIL;
}