Ejemplo n.º 1
0
TAG_METHOD_IMPL(CWSDLBindingParser, OnHttpBinding)
{
	TRACE_PARSE_ENTRY();

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

			CStringW strVerb;
			if (S_OK == GetAttribute(pAttributes, L"verb", sizeof("verb")-1, strVerb))
			{
				if (SUCCEEDED(pBinding->SetVerb(strVerb)))
				{
					return SkipElement();
				}
			}
		}
	}

	EmitErrorHr(E_OUTOFMEMORY);

	return E_FAIL;
}
Ejemplo n.º 2
0
TAG_METHOD_IMPL(CWSDLOperationParser, OnHttpOperation)
{
	TRACE_PARSE_ENTRY();

	CWSDLPortTypeOperation * pCurr = GetOperation();
	if (pCurr != NULL)
	{
		CHttpOperation *pOperation = pCurr->AddHttpOperation();
		if (pOperation != NULL)
		{
			CStringW strLocation;
			if (S_OK == GetAttribute(pAttributes, L"location", sizeof("location")-1, strLocation))
			{
				if (SUCCEEDED(pOperation->SetLocation(strLocation)))
				{
					return SkipElement();
				}
			}
			OnMissingAttribute(TRUE, L"location", sizeof("location")-1, L"", 0);
		}
	}

	EmitErrorHr(E_OUTOFMEMORY);

	return E_FAIL;
}
Ejemplo n.º 3
0
TAG_METHOD_IMPL(CComplexTypeParser, OnEnumeration)
{
	TRACE_PARSE_ENTRY();

	MarkUnsupported(wszQName, cchQName);
	EmitSkip(wszNamespaceUri, wszLocalName);

	return SkipElement();
}
Ejemplo n.º 4
0
TAG_METHOD_IMPL(CSchemaParser, OnRedefine)
{
	TRACE_PARSE_ENTRY();

	MarkUnsupported(wszQName, cchQName);
	EmitSkip(wszNamespaceUri, wszLocalName);

	return SkipElement();
}
Ejemplo n.º 5
0
TAG_METHOD_IMPL(CSchemaParser, OnImport)
{
	TRACE_PARSE_ENTRY();

	//
	// TODO: do imports here (or delay?)
	//

	return SkipElement();
}
Ejemplo n.º 6
0
void MgWmsLayerDefinitions::GenerateDefinitions(MgUtilDictionary& Dictionary)
{
    MgXmlSynchronizeOnElement ResourceDocument(*m_xmlParser,_("ResourceDocument"));
    if(!ResourceDocument.AtBegin())
        return; // Something is wrong.  We leave.

    while(!ResourceDocument.AtEnd()) {
        STRING sValue; // basic_string
        if(GetElementContents(_("ResourceId"),sValue)) {
            // Okay, the ResourceId is too decorated for our purposes;
            // the outside world doesn't need to know (and clutter up
            // URL command lines with) this syntactic "punctuation" so
            // we just get rid of it.
            // Remove the Library prefix, if present.
            if(sValue.find(_("Library://")) == 0)
                sValue = sValue.substr(10);
            // Remove the LayerDefinition suffix, if present.
            STRING::size_type iEnd = sValue.find(_(".LayerDefinition"));
            if(iEnd != STRING::npos)
                sValue.resize(iEnd);
            // There, that's our Layer Name.
            Dictionary.AddDefinition(_("Layer.Name"),sValue);

            // Until we have "Friendly Name" support, the
            // friendly name will simply be the layer name sans
            // path.
            iEnd = sValue.find_last_of('/');
            if(iEnd != STRING::npos)
                sValue = sValue.substr(iEnd+1); // one past the slash.

            // That's our Layer Title,
            // Note that subsequently-found metadata may override this
            // definition with a real title... one that the user actually
            // wants.  This just provides a default in case no such
            // friendly name exists.... that keeps the list of layer names
            // from being a list of empty strings.
            Dictionary.AddDefinition(_("Layer.Title"),sValue);
        }
        else if(!GetMetadataDefinitions(Dictionary)) {
          SkipElement(NULL);
        }
    }

}
Ejemplo n.º 7
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;
}
Ejemplo n.º 8
0
TAG_METHOD_IMPL(CComplexTypeParser, OnSimpleContent)
{
	TRACE_PARSE_ENTRY();

/*
	CComplexType *pCurr = GetComplexType();

	if (pCurr != NULL)
	{
		if (pCurr->GetElementType() == XSD_COMPLEXTYPE)
		{
			CContent *pElem = pCurr->AddContent();
			pElem->SetParentDocument(pCurr->GetParentDocument());
			pElem->SetParentElement(pCurr);
			pElem->SetElementType(XSD_SIMPLECONTENT);

			CContentParser * p = new CContentParser(GetReader(), this, GetLevel(), pElem);
			if (p != NULL)
			{
				if (g_ParserList.AddHead(p) != NULL)
				{
					return p->GetAttributes(pAttributes);
				}
			}
		}
		else
		{
			return OnUnrecognizedTag(wszNamespaceUri, 
				cchNamespaceUri, wszLocalName, cchLocalName, 
				wszQName, cchQName, pAttributes);
		}
	}

	EmitErrorHr(E_OUTOFMEMORY);

	return E_FAIL;
*/

	MarkUnsupported(wszQName, cchQName);
	EmitSkip(wszNamespaceUri, wszLocalName);
	return SkipElement();
}
Ejemplo n.º 9
0
TAG_METHOD_IMPL(CWSDLMessageParser, OnPart)
{
	TRACE_PARSE_ENTRY();

	CWSDLMessage *pCurr = GetMessage();
	if (pCurr != NULL)
	{
		CWSDLMessagePart *pPart = pCurr->AddPart();
		if (pPart != NULL)
		{
			SetXMLElementInfo(pPart, pCurr, GetLocator());

			CStringW strName;
			if (S_OK == GetAttribute(pAttributes, L"name", sizeof("name")-1, strName))
			{
				pPart->SetName(strName);
				
				CStringW strElement;
				if (S_OK == GetAttribute(pAttributes, L"element", sizeof("element")-1, strElement))
				{
					pPart->SetElement(strElement);
				}
				CStringW strType;
				if (S_OK == GetAttribute(pAttributes, L"type", sizeof("type")-1, strType))
				{
					pPart->SetType(strType);
				}
//				else
//				{
//					OnMissingAttribute(TRUE, L"element", sizeof("element")-1, L"", 0);
//				}

				return SkipElement();
			}
			OnMissingAttribute(TRUE, L"name", sizeof("name")-1, L"", 0);
		}
	}

	EmitErrorHr(E_OUTOFMEMORY);

	return E_FAIL;
}
Ejemplo n.º 10
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;
}
Ejemplo n.º 11
0
TAG_METHOD_IMPL(CSchemaParser, OnAttribute)
{
	TRACE_PARSE_ENTRY();
/*
	// TODO: investigate supporting this stuff
	CSchema *pCurr = GetSchema();

	if (pCurr != NULL)
	{
		CAttribute *pElem = pCurr->AddAttribute();
		if (pElem != NULL)
		{
			pElem->SetParentDocument(pCurr->GetParentDocument());
			pElem->SetParentElement(pCurr);

			CAutoPtr<CAttributeParser> p( new CAttributeParser(GetReader(), this, GetLevel(), pElem) );
			if (p != NULL)
			{
				if (g_ParserList.AddHead(p) != NULL)
				{
					p.Detach();
					return p->GetAttributes(pAttributes);
				}
			}
		}
	}

	EmitErrorHr(E_OUTOFMEMORY);

	return E_FAIL;
*/

	MarkUnsupported(wszQName, cchQName);
	EmitSkip(wszNamespaceUri, wszLocalName);

	//
	// TODO: investigate supporting this
	//

	return SkipElement();
}
Ejemplo n.º 12
0
TAG_METHOD_IMPL(CComplexTypeParser, OnChoice)
{
	TRACE_PARSE_ENTRY();

	MarkUnsupported(wszQName, cchQName);
	EmitString(wszNamespaceUri, wszLocalName);

	CComplexType *pCurr = GetComplexType();
	if (pCurr != NULL)
	{
		if (pCurr->GetElementType() == XSD_COMPLEXTYPE)
		{
			pCurr->SetElementType(XSD_UNSUPPORTED);
			return SkipElement();
		}
		return E_FAIL;
	}

	EmitError(IDS_SDL_INTERNAL);
	return E_FAIL;
}
Ejemplo n.º 13
0
HRESULT CWSDLOperationParser::OnUnrecognizedTag(
	const wchar_t *wszNamespaceUri, int cchNamespaceUri,
	const wchar_t *wszLocalName, int cchLocalName,
	const wchar_t * /*wszQName*/, int /*cchQName*/,
	ISAXAttributes * /*pAttributes*/) throw()
{
	CWSDLPortTypeOperation * pCurr = GetOperation();
	if (pCurr != NULL)
	{
		int nLine;
		int nCol;
		GetLocator()->getLineNumber(&nLine);
		GetLocator()->getColumnNumber(&nCol);
		
		EmitFileWarning(IDS_SDL_SKIP_EXTENSIBILITY, 
			pCurr->GetParentDocument()->GetDocumentUri(), 
			nLine, 
			nCol, 
			0, 
			wszNamespaceUri,
			wszLocalName);
	}
	return SkipElement();
}
Ejemplo n.º 14
0
TAG_METHOD_IMPL(CContentParser, OnAnnotation)
{
	TRACE_PARSE_ENTRY();

	return SkipElement();
}
Ejemplo n.º 15
0
TAG_METHOD_IMPL(CWSDLOperationParser, OnDocumentation)
{
	TRACE_PARSE_ENTRY();

	return SkipElement();
}
Ejemplo n.º 16
0
// Internal function used to get the DICOM header from the current file.
ILboolean iGetDicomHead(DICOMHEAD *Header)
{
	ILushort	GroupNum, ElementNum;
	ILboolean	ReachedData = IL_FALSE;
	ILubyte		Var2, UID[65];

	// Signature should be "DICM" at position 128.
	iseek(128, IL_SEEK_SET);
	if (iread(Header->Signature, 1, 4) != 4)
		return IL_FALSE;

//@TODO: What about the case when we are reading an image with Big Endian data?

	do {
		GroupNum = GetGroupNum(Header);
		ElementNum = GetShort(Header, GroupNum);;

		switch (GroupNum)
		{
			case 0x02:
				switch (ElementNum)
				{
					/*case 0x01:  // Version number
						if (!GetNumericValue(&Header->Version))
							return IL_FALSE;
						if (Header->Version != 0x0100)
							return IL_FALSE;
						break;*/

					case 0x10:
						//@TODO: Look at pg. 60 of 07_05pu.pdf (PS 3.5) for more UIDs.
						if (!GetUID(UID))
							return IL_FALSE;
						if (!strncmp((const char*)UID, "1.2.840.10008.1.2.2", 64))  // Explicit big endian
							Header->BigEndian = IL_TRUE;
                        else if (!strncmp((const char*)UID, "1.2.840.10008.1.2.1", 64))  // Explicit little endian
							Header->BigEndian = IL_FALSE;
                        else if (!strncmp((const char*)UID, "1.2.840.10008.1.2", 64))  // Implicit little endian
							Header->BigEndian = IL_FALSE;
						else 
							return IL_FALSE;  // Unrecognized UID.
						break;

					default:
						if (!SkipElement(Header, GroupNum, ElementNum))  // We do not understand this entry, so we just skip it.
							return IL_FALSE;
				}
				break;

			case 0x28:
				switch (ElementNum)
				{
					case 0x02:  // Samples per pixel
						if (!GetNumericValue(Header, GroupNum, &Header->Samples))
							return IL_FALSE;
						break;

					case 0x08:  // Number of frames, or depth
						if (!GetNumericValue(Header, GroupNum, &Header->Depth))
							return IL_FALSE;
						break;

					case 0x10:  // The number of rows
						if (!GetNumericValue(Header, GroupNum, &Header->Height))
							return IL_FALSE;
						break;

					case 0x11:  // The number of columns
						if (!GetNumericValue(Header, GroupNum, &Header->Width))
							return IL_FALSE;
						break;

					case 0x100:  // Bits allocated per sample
						if (!GetNumericValue(Header, GroupNum, &Header->BitsAllocated))
							return IL_FALSE;
						break;

					case 0x101:  // Bits stored per sample - Do we really need this information?
						if (!GetNumericValue(Header, GroupNum, &Header->BitsStored))
							return IL_FALSE;
						break;

					default:
						if (!SkipElement(Header, GroupNum, ElementNum))  // We do not understand this entry, so we just skip it.
							return IL_FALSE;
				}
				break;

			case 0x7FE0:
				switch (ElementNum)
				{
					case 0x10:  // This element is the actual pixel data.  We are done with the header here.
						if (igetc() != 'O')  // @TODO: Can we assume that this is always 'O'?
							return IL_FALSE;
						Var2 = igetc();
						if (Var2 != 'B' && Var2 != 'W' && Var2 != 'F')  // 'OB', 'OW' and 'OF' accepted for this element.
							return IL_FALSE;
						GetLittleUShort();  // Skip the 2 reserved bytes.
						Header->DataLen = GetInt(Header, GroupNum);//GetLittleUInt();
						ReachedData = IL_TRUE;
						break;
					default:
						if (!SkipElement(Header, GroupNum, ElementNum))  // We do not understand this entry, so we just skip it.
							return IL_FALSE;
				}
				break;

			default:
				if (!SkipElement(Header, GroupNum, ElementNum))  // We do not understand this entry, so we just skip it.
					return IL_FALSE;
		}
	} while (!ieof() && !ReachedData);

	if (ieof())
		return IL_FALSE;

	// Some DICOM images do not have the depth (number of frames) field.
	if (Header->Depth == 0)
		Header->Depth = 1;

	switch (Header->BitsAllocated)
	{
		case 8:
			Header->Type = IL_UNSIGNED_BYTE;
			break;
		case 16:
			Header->Type = IL_UNSIGNED_SHORT;
			break;
		case 32:
			Header->Type = IL_FLOAT;  //@TODO: Is this ever an integer?
			break;
		default:  //@TODO: Any other types we can deal with?
			return IL_FALSE;
	}

	// Cannot handle more than 4 channels in an image.
	if (Header->Samples > 4)
		return IL_FALSE;
	Header->Format = ilGetFormatBpp(Header->Samples);

	return IL_TRUE;
}
Ejemplo n.º 17
0
TAG_METHOD_IMPL(CComplexTypeParser, OnLength)
{
	TRACE_PARSE_ENTRY();
	EmitSkip(wszNamespaceUri, wszLocalName);
	return SkipElement();
}