You've already forked lazarus-ccr
Transform inline error text to ResourceString
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1355 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -168,7 +168,7 @@ type
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
uses ws_parser_imp, dom_cursors, parserutils, xsd_consts
|
uses ws_parser_imp, dom_cursors, parserutils, xsd_consts, wst_consts
|
||||||
{$IFDEF FPC}
|
{$IFDEF FPC}
|
||||||
,wst_fpc_xml
|
,wst_fpc_xml
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -192,13 +192,11 @@ constructor TCustomXsdSchemaParser.Create(
|
|||||||
);
|
);
|
||||||
begin
|
begin
|
||||||
if ( ADoc = nil ) then
|
if ( ADoc = nil ) then
|
||||||
raise EXsdParserAssertException.Create('Invalid DOM document.');
|
raise EXsdParserAssertException.Create(SERR_InvalidDomDocument);
|
||||||
if ( ASchemaNode = nil ) then
|
if ( ASchemaNode = nil ) then
|
||||||
raise EXsdParserAssertException.Create('Invalid schema node.');
|
raise EXsdParserAssertException.Create(SERR_InvalidSchemaNode);
|
||||||
if ( ASymbols = nil ) then
|
if ( ASymbols = nil ) then
|
||||||
raise EXsdParserAssertException.Create('Invalid Symbol table.');
|
raise EXsdParserAssertException.Create(SERR_InvalidSymbolTable);
|
||||||
if ( ASchemaNode = nil ) then
|
|
||||||
raise EXsdParserAssertException.Create('Invalid schema node.');
|
|
||||||
|
|
||||||
FDoc := ADoc;
|
FDoc := ADoc;
|
||||||
FParentContext := Pointer(AParentContext);
|
FParentContext := Pointer(AParentContext);
|
||||||
@ -493,7 +491,7 @@ var
|
|||||||
else
|
else
|
||||||
typNd := FindNamedNode(crsSchemaChild,localTypeName);
|
typNd := FindNamedNode(crsSchemaChild,localTypeName);
|
||||||
if not Assigned(typNd) then
|
if not Assigned(typNd) then
|
||||||
raise EXsdTypeNotFoundException.CreateFmt('Type definition not found 1 : "%s"',[AName]);
|
raise EXsdTypeNotFoundException.CreateFmt(SERR_TypeDefinitionNotFound,['1',AName]);
|
||||||
if AnsiSameText(ExtractNameFromQName(typNd.NodeName),s_element) then begin
|
if AnsiSameText(ExtractNameFromQName(typNd.NodeName),s_element) then begin
|
||||||
crs := CreateCursorOn(CreateAttributesCursor(typNd,cetRttiNode),ParseFilter(Format('%s = %s',[s_NODE_NAME,QuotedStr(s_type)]),TDOMNodeRttiExposer));
|
crs := CreateCursorOn(CreateAttributesCursor(typNd,cetRttiNode),ParseFilter(Format('%s = %s',[s_NODE_NAME,QuotedStr(s_type)]),TDOMNodeRttiExposer));
|
||||||
crs.Reset();
|
crs.Reset();
|
||||||
@ -514,12 +512,12 @@ var
|
|||||||
oldTypeNode := typNd;
|
oldTypeNode := typNd;
|
||||||
typNd := FindNamedNode(crsSchemaChild,ExtractNameFromQName(nd.NodeValue));
|
typNd := FindNamedNode(crsSchemaChild,ExtractNameFromQName(nd.NodeValue));
|
||||||
if not Assigned(typNd) then
|
if not Assigned(typNd) then
|
||||||
raise EXsdTypeNotFoundException.CreateFmt('Type definition not found 2 : "%s"',[AName]);
|
raise EXsdTypeNotFoundException.CreateFmt(SERR_TypeDefinitionNotFound,['2',AName]);
|
||||||
embededType := False;
|
embededType := False;
|
||||||
if ( typNd = oldTypeNode ) then begin
|
if ( typNd = oldTypeNode ) then begin
|
||||||
typNd := FindNamedNode(crsSchemaChild,ExtractNameFromQName(nd.NodeValue),2);
|
typNd := FindNamedNode(crsSchemaChild,ExtractNameFromQName(nd.NodeValue),2);
|
||||||
if not Assigned(typNd) then
|
if not Assigned(typNd) then
|
||||||
raise EXsdTypeNotFoundException.CreateFmt('Type definition not found 2.1 : "%s"',[AName]);
|
raise EXsdTypeNotFoundException.CreateFmt(SERR_TypeDefinitionNotFound,['2.1',AName]);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end else begin
|
end else begin
|
||||||
@ -529,7 +527,7 @@ var
|
|||||||
crs := CreateCursorOn(CreateChildrenCursor(typNd,cetRttiNode),ParseFilter(locStrFilter,TDOMNodeRttiExposer));
|
crs := CreateCursorOn(CreateChildrenCursor(typNd,cetRttiNode),ParseFilter(locStrFilter,TDOMNodeRttiExposer));
|
||||||
crs.Reset();
|
crs.Reset();
|
||||||
if not crs.MoveNext() then begin
|
if not crs.MoveNext() then begin
|
||||||
raise EXsdTypeNotFoundException.CreateFmt('Type definition not found 3 : "%s"',[AName]);
|
raise EXsdTypeNotFoundException.CreateFmt(SERR_TypeDefinitionNotFound,['3',AName]);
|
||||||
end;
|
end;
|
||||||
typNd := (crs.GetCurrent() as TDOMNodeRttiExposer).InnerObject;
|
typNd := (crs.GetCurrent() as TDOMNodeRttiExposer).InnerObject;
|
||||||
typName := ExtractNameFromQName(AName);
|
typName := ExtractNameFromQName(AName);
|
||||||
@ -604,7 +602,7 @@ begin
|
|||||||
if not FImportParsed then
|
if not FImportParsed then
|
||||||
ParseImportDocuments();
|
ParseImportDocuments();
|
||||||
sct := nil;
|
sct := nil;
|
||||||
DoOnMessage(mtInfo, Format('Parsing "%s" ...',[AName]));
|
DoOnMessage(mtInfo, Format(SERR_Parsing,[AName]));
|
||||||
try
|
try
|
||||||
embededType := False;
|
embededType := False;
|
||||||
aliasType := nil;
|
aliasType := nil;
|
||||||
@ -613,7 +611,7 @@ begin
|
|||||||
typeModule := FModule;
|
typeModule := FModule;
|
||||||
end else begin
|
end else begin
|
||||||
if not FindNameSpace(shortNameSpace,longNameSpace) then
|
if not FindNameSpace(shortNameSpace,longNameSpace) then
|
||||||
raise EXsdParserAssertException.CreateFmt('Unable to resolve namespace, short name = "%s".',[shortNameSpace]);
|
raise EXsdParserAssertException.CreateFmt(SERR_UnableToResolveNamespace,[shortNameSpace]);
|
||||||
typeModule := SymbolTable.FindModule(longNameSpace);
|
typeModule := SymbolTable.FindModule(longNameSpace);
|
||||||
end;
|
end;
|
||||||
if ( typeModule = nil ) then
|
if ( typeModule = nil ) then
|
||||||
@ -648,7 +646,7 @@ begin
|
|||||||
SymbolTable.RegisterExternalAlias(Result,SymbolTable.GetExternalName(frwType));
|
SymbolTable.RegisterExternalAlias(Result,SymbolTable.GetExternalName(frwType));
|
||||||
end;
|
end;
|
||||||
end else begin
|
end else begin
|
||||||
raise EXsdTypeNotFoundException.CreateFmt('Type node found but unable to parse it : "%s"',[AName]);
|
raise EXsdTypeNotFoundException.CreateFmt(SERR_TypeNodeFoundButUnableToParseIt,[AName]);
|
||||||
end;
|
end;
|
||||||
end else begin
|
end else begin
|
||||||
Result := CreateTypeAlias(aliasType);
|
Result := CreateTypeAlias(aliasType);
|
||||||
@ -777,10 +775,10 @@ var
|
|||||||
ls : TStrings;
|
ls : TStrings;
|
||||||
begin
|
begin
|
||||||
if ( FSchemaNode.Attributes = nil ) or ( GetNodeListCount(FSchemaNode.Attributes) = 0 ) then
|
if ( FSchemaNode.Attributes = nil ) or ( GetNodeListCount(FSchemaNode.Attributes) = 0 ) then
|
||||||
raise EXsdParserAssertException.CreateFmt('The Schema node must have at least the "%s" attribute.',[s_targetNamespace]);
|
raise EXsdParserAssertException.CreateFmt(SERR_SchemaNodeRequiredAttribute,[s_targetNamespace]);
|
||||||
nd := FSchemaNode.Attributes.GetNamedItem(s_targetNamespace);
|
nd := FSchemaNode.Attributes.GetNamedItem(s_targetNamespace);
|
||||||
if ( nd = nil ) then
|
if ( nd = nil ) then
|
||||||
raise EXsdParserAssertException.CreateFmt('The Schema node must have at least the "%s" attribute.',[s_targetNamespace]);
|
raise EXsdParserAssertException.CreateFmt(SERR_SchemaNodeRequiredAttribute,[s_targetNamespace]);
|
||||||
FTargetNameSpace := nd.NodeValue;
|
FTargetNameSpace := nd.NodeValue;
|
||||||
if IsStrEmpty(FModuleName) then
|
if IsStrEmpty(FModuleName) then
|
||||||
FModuleName := ExtractIdentifier(FTargetNameSpace);
|
FModuleName := ExtractIdentifier(FTargetNameSpace);
|
||||||
@ -795,10 +793,10 @@ begin
|
|||||||
prntCtx := GetParentContext();
|
prntCtx := GetParentContext();
|
||||||
if ( FXSShortNames = nil ) then begin
|
if ( FXSShortNames = nil ) then begin
|
||||||
if ( prntCtx = nil ) then
|
if ( prntCtx = nil ) then
|
||||||
raise EXsdParserAssertException.CreateFmt('Invalid Schema document, namespace not found :'#13'%s.',[s_xs]);
|
raise EXsdParserAssertException.CreateFmt(SERR_InvalidSchemaDoc_NamespaceNotFound,[s_xs]);
|
||||||
FXSShortNames := prntCtx.FindShortNamesForNameSpace(s_xs);
|
FXSShortNames := prntCtx.FindShortNamesForNameSpace(s_xs);
|
||||||
if ( FXSShortNames = nil ) then
|
if ( FXSShortNames = nil ) then
|
||||||
raise EXsdParserAssertException.CreateFmt('Invalid Schema document, namespace not found ( short names ) :'#13'%s.',[s_xs]);
|
raise EXsdParserAssertException.CreateFmt(SERR_InvalidSchemaDoc_NamespaceNotFoundShort,[s_xs]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if Assigned(prntCtx) then begin
|
if Assigned(prntCtx) then begin
|
||||||
|
@ -46,6 +46,7 @@ resourcestring
|
|||||||
SERR_InvalidCollectionLength = 'Invalid collection length : %d.';
|
SERR_InvalidCollectionLength = 'Invalid collection length : %d.';
|
||||||
SERR_InvalidComplexSimpleTypeDef_NoRestOrExt = 'Invalid "complexeType.simpleType" definition : restriction/extension not found.';
|
SERR_InvalidComplexSimpleTypeDef_NoRestOrExt = 'Invalid "complexeType.simpleType" definition : restriction/extension not found.';
|
||||||
SERR_InvalidDataTypeInContext = 'Invalid data type in this context : "%s".';
|
SERR_InvalidDataTypeInContext = 'Invalid data type in this context : "%s".';
|
||||||
|
SERR_InvalidDomDocument = 'Invalid DOM document.';
|
||||||
SERR_InvalidElementDef_MissingNameOrRef = 'Invalid <element> definition : missing "name" or "ref" attribute.';
|
SERR_InvalidElementDef_MissingNameOrRef = 'Invalid <element> definition : missing "name" or "ref" attribute.';
|
||||||
SERR_InvalidElementDef_EmptyName = 'Invalid <element> definition : empty "name".';
|
SERR_InvalidElementDef_EmptyName = 'Invalid <element> definition : empty "name".';
|
||||||
SERR_InvalidElementDef_EmptyType = 'Invalid <element> definition : empty "type".';
|
SERR_InvalidElementDef_EmptyType = 'Invalid <element> definition : empty "type".';
|
||||||
@ -62,6 +63,10 @@ resourcestring
|
|||||||
SERR_InvalidParameterProc = 'Invalid parameter : "%s"; Procedure = "%s".';
|
SERR_InvalidParameterProc = 'Invalid parameter : "%s"; Procedure = "%s".';
|
||||||
SERR_InvalidParameters = 'Invalid parameters.';
|
SERR_InvalidParameters = 'Invalid parameters.';
|
||||||
SERR_InvalidPoolParametersArgs = 'Invalid pool arguments Min = %d; Max = %d .';
|
SERR_InvalidPoolParametersArgs = 'Invalid pool arguments Min = %d; Max = %d .';
|
||||||
|
SERR_InvalidSchemaDoc_NamespaceNotFound = 'Invalid Schema document, namespace not found : %s.';
|
||||||
|
SERR_InvalidSchemaDoc_NamespaceNotFoundShort = 'Invalid Schema document, namespace not found ( short names ) : %s.';
|
||||||
|
SERR_InvalidSchemaNode = 'Invalid schema node.';
|
||||||
|
SERR_InvalidSymbolTable = 'Invalid Symbol table.';
|
||||||
SERR_InvalidTypeDef_AttributeNotFound = 'Invalid type definition, attributes not found : "%s".';
|
SERR_InvalidTypeDef_AttributeNotFound = 'Invalid type definition, attributes not found : "%s".';
|
||||||
SERR_InvalidTypeDef_BaseAttributeNotFound = 'Invalid extention/restriction of type "%s" : "base" attribute not found.';
|
SERR_InvalidTypeDef_BaseAttributeNotFound = 'Invalid extention/restriction of type "%s" : "base" attribute not found.';
|
||||||
SERR_InvalidTypeDef_NamedAttributeNotFound = 'Invalid type definition, unable to find the "%s" attribute : "%s".';
|
SERR_InvalidTypeDef_NamedAttributeNotFound = 'Invalid type definition, unable to find the "%s" attribute : "%s".';
|
||||||
@ -76,14 +81,19 @@ resourcestring
|
|||||||
SERRE_ObjectCreationTimeOut = 'Unable to create the object : Timeout expired.';
|
SERRE_ObjectCreationTimeOut = 'Unable to create the object : Timeout expired.';
|
||||||
SERR_OperationNotAllowedOnActivePool = 'Operation not allowed on an active pool.';
|
SERR_OperationNotAllowedOnActivePool = 'Operation not allowed on an active pool.';
|
||||||
SERR_ParamaterNotFound = 'Parameter non found : "%s".';
|
SERR_ParamaterNotFound = 'Parameter non found : "%s".';
|
||||||
|
SERR_Parsing = 'Parsing "%s" ...';
|
||||||
SERR_RecordExtendedRttiNotFound = 'Record extended RTTI informations not found in type registry : "%s".';
|
SERR_RecordExtendedRttiNotFound = 'Record extended RTTI informations not found in type registry : "%s".';
|
||||||
SERR_RootObjectCannotBeNIL = 'The root object cannot be NIL.';
|
SERR_RootObjectCannotBeNIL = 'The root object cannot be NIL.';
|
||||||
|
SERR_SchemaNodeRequiredAttribute = 'The Schema node must have at least the "%s" attribute.';
|
||||||
SERR_SerializerInitializationException = 'Unable to initialize the serializer of that type : "%s".';
|
SERR_SerializerInitializationException = 'Unable to initialize the serializer of that type : "%s".';
|
||||||
SERR_ServiceNotFound = 'Service not found : "%s".';
|
SERR_ServiceNotFound = 'Service not found : "%s".';
|
||||||
SERR_ScopeNotFound = 'Scope not found : "%s".';
|
SERR_ScopeNotFound = 'Scope not found : "%s".';
|
||||||
|
SERR_TypeDefinitionNotFound = 'Type definition not found %s : "%s"';
|
||||||
|
SERR_TypeNodeFoundButUnableToParseIt = 'Type node found but unable to parse it : "%s"';
|
||||||
SERR_TypeNotRegistered = 'Type not registered : "%s".';
|
SERR_TypeNotRegistered = 'Type not registered : "%s".';
|
||||||
SERR_TypeStyleNotSupported = 'This type style is not supported : "%s".';
|
SERR_TypeStyleNotSupported = 'This type style is not supported : "%s".';
|
||||||
SERR_UnableToFindNameTagInNode = 'Unable to find the <name> tag in the type/element node attributes.';
|
SERR_UnableToFindNameTagInNode = 'Unable to find the <name> tag in the type/element node attributes.';
|
||||||
|
SERR_UnableToResolveNamespace = 'Unable to resolve namespace, short name = "%s".';
|
||||||
SERR_UnexpectedEndOfData = 'Unexpected end of data.';
|
SERR_UnexpectedEndOfData = 'Unexpected end of data.';
|
||||||
SERR_UnknownProperty = 'Unknown property : "%s".';
|
SERR_UnknownProperty = 'Unknown property : "%s".';
|
||||||
SERR_UnsupportedOperation = 'Unsupported operation : "%s".';
|
SERR_UnsupportedOperation = 'Unsupported operation : "%s".';
|
||||||
|
Reference in New Issue
Block a user