L
Leslie Isaacs
Hello All
This is a re-post of a problem I posted a while ago, but to which I got no
suggestions: hopefully I'll be more lucky this time!?
I have the following code in a Private Sub:
If InStr([ResponseXML], "element") > 0 Then
errorfield = "Invalid " & Mid([ResponseXML], InStr([ResponseXML],
"element"), InStr(InStr(InStr([ResponseXML], "element"), [ResponseXML], "'")
+ 1, [ResponseXML], "'") - InStr([ResponseXML], "element") + 1)
Else
....
Most of the time this works fine, but for some datastring values of
[ResponseXML] I get
Invalid procedure call or argument
and the code stops on the 'errorfield = ...' expression. This has occurred
where [ResponseXML] does contain the string "element" (obviously - otherwise
the code wouldn't get past the condition into the expression!). The curious
thing is that if I use the exact same errorfield expression in a query, on
the same value of [ResponseXML], it returns the expected result (which is
<Invalid Element 'TaxCodeAtLeaving'> - without the <>s). I could understand
it if I'd just got duff syntax, but the fact that the query works ...?
In case it helps, one value of [ResponseXML] where this problem occurs is
below.
Hope someone can help
Many thanks
Leslie Isaacs
Problem value of [ResponseXML] follows:
....................HTTP Text: 200 OK
Request: submit_poll
Response: submit_error
CorrelationID: C3CFE512E3EB40D0B93A3A43A01348B1
Info: : The submission of this document has failed due to departmental
specific business logic in the Body tag.
The submission of this document has failed due to departmental specific
business logic in the Body tag.
<?xml version="1.0"?><GovTalkMessage
xmlns="http://www.govtalk.gov.uk/CM/envelope"><EnvelopeVersion>1.0</EnvelopeVersion><Header><MessageDetails><Class>IR-PAYE-MOV</Class><Qualifier>error</Qualifier><Function>submit</Function><TransactionID></TransactionID><CorrelationID>C3CFE512E3EB40D0B93A3A43A01348B1</CorrelationID><ResponseEndPoint
PollInterval="10">https://secure.gateway.gov.uk/poll</ResponseEndPoint><GatewayTimestamp>2009-11-12T15:55:39.662</GatewayTimestamp></MessageDetails><SenderDetails
/></Header><GovTalkDetails><Keys
/><GovTalkErrors><Error><RaisedBy>Department</RaisedBy><Number>3001</Number><Type>business</Type><Text>The
submission of this document has failed due to departmental specific business
logic in the Body tag.</Text></Error></GovTalkErrors></GovTalkDetails><Body>
<ErrorResponse xmlns="http://www.govtalk.gov.uk/CM/errorresponse"
SchemaVersion="2.0">
<Application>
<MessageCount>2</MessageCount>
</Application>
<Error>
<RaisedBy>ChRIS</RaisedBy>
<Number>4085</Number>
<Type>schema</Type>
<Text>Value '0NT' doesn't have the correct format</Text>
<Location>/hd:GovTalkMessage[1]/hd:Body[1]/mov:IRenvelope[1]/mov:InYearMovements[1]/mov45Part1[1]/mov:TaxCodeAtLeaving[1]</Location>
<Application>
<Messages xmlns="http://www.govtalk.gov.uk/validation/messages/1">
<ServiceMessage>
<UserText number="7674">Tax code entered is not a valid code.</UserText>
</ServiceMessage>
<DeveloperMessage>cvc-pattern-valid: Value '0NT' is not facet-valid with
respect to pattern
'([1-9][0-9]{0,5}[LPTVY])|(BR)|(0T)|(NT)|(FT)|(D0)|([K][1-9][0-9]{0,5})' for
type '_intermediate_TaxCodeStructure'.</DeveloperMessage>
</Messages>
</Application>
</Error>
<Error>
<RaisedBy>ChRIS</RaisedBy>
<Number>4052</Number>
<Type>schema</Type>
<Text>Element 'TaxCodeAtLeaving' must only have valid text as its
content</Text>
<Location>/hd:GovTalkMessage[1]/hd:Body[1]/mov:IRenvelope[1]/mov:InYearMovements[1]/mov45Part1[1]/mov:TaxCodeAtLeaving[1]</Location>
<Application>
<Messages xmlns="http://www.govtalk.gov.uk/validation/messages/1">
<ServiceMessage>
<UserText number="7674">Tax code entered is not a valid code.</UserText>
</ServiceMessage>
<DeveloperMessage>cvc-complex-type.2.2: Element 'TaxCodeAtLeaving' must have
no element [children], and the value must be valid.</DeveloperMessage>
</Messages>
</Application>
</Error>
</ErrorResponse>
</Body>
</GovTalkMessage>
This is a re-post of a problem I posted a while ago, but to which I got no
suggestions: hopefully I'll be more lucky this time!?
I have the following code in a Private Sub:
If InStr([ResponseXML], "element") > 0 Then
errorfield = "Invalid " & Mid([ResponseXML], InStr([ResponseXML],
"element"), InStr(InStr(InStr([ResponseXML], "element"), [ResponseXML], "'")
+ 1, [ResponseXML], "'") - InStr([ResponseXML], "element") + 1)
Else
....
Most of the time this works fine, but for some datastring values of
[ResponseXML] I get
Invalid procedure call or argument
and the code stops on the 'errorfield = ...' expression. This has occurred
where [ResponseXML] does contain the string "element" (obviously - otherwise
the code wouldn't get past the condition into the expression!). The curious
thing is that if I use the exact same errorfield expression in a query, on
the same value of [ResponseXML], it returns the expected result (which is
<Invalid Element 'TaxCodeAtLeaving'> - without the <>s). I could understand
it if I'd just got duff syntax, but the fact that the query works ...?
In case it helps, one value of [ResponseXML] where this problem occurs is
below.
Hope someone can help
Many thanks
Leslie Isaacs
Problem value of [ResponseXML] follows:
....................HTTP Text: 200 OK
Request: submit_poll
Response: submit_error
CorrelationID: C3CFE512E3EB40D0B93A3A43A01348B1
Info: : The submission of this document has failed due to departmental
specific business logic in the Body tag.
The submission of this document has failed due to departmental specific
business logic in the Body tag.
<?xml version="1.0"?><GovTalkMessage
xmlns="http://www.govtalk.gov.uk/CM/envelope"><EnvelopeVersion>1.0</EnvelopeVersion><Header><MessageDetails><Class>IR-PAYE-MOV</Class><Qualifier>error</Qualifier><Function>submit</Function><TransactionID></TransactionID><CorrelationID>C3CFE512E3EB40D0B93A3A43A01348B1</CorrelationID><ResponseEndPoint
PollInterval="10">https://secure.gateway.gov.uk/poll</ResponseEndPoint><GatewayTimestamp>2009-11-12T15:55:39.662</GatewayTimestamp></MessageDetails><SenderDetails
/></Header><GovTalkDetails><Keys
/><GovTalkErrors><Error><RaisedBy>Department</RaisedBy><Number>3001</Number><Type>business</Type><Text>The
submission of this document has failed due to departmental specific business
logic in the Body tag.</Text></Error></GovTalkErrors></GovTalkDetails><Body>
<ErrorResponse xmlns="http://www.govtalk.gov.uk/CM/errorresponse"
SchemaVersion="2.0">
<Application>
<MessageCount>2</MessageCount>
</Application>
<Error>
<RaisedBy>ChRIS</RaisedBy>
<Number>4085</Number>
<Type>schema</Type>
<Text>Value '0NT' doesn't have the correct format</Text>
<Location>/hd:GovTalkMessage[1]/hd:Body[1]/mov:IRenvelope[1]/mov:InYearMovements[1]/mov45Part1[1]/mov:TaxCodeAtLeaving[1]</Location>
<Application>
<Messages xmlns="http://www.govtalk.gov.uk/validation/messages/1">
<ServiceMessage>
<UserText number="7674">Tax code entered is not a valid code.</UserText>
</ServiceMessage>
<DeveloperMessage>cvc-pattern-valid: Value '0NT' is not facet-valid with
respect to pattern
'([1-9][0-9]{0,5}[LPTVY])|(BR)|(0T)|(NT)|(FT)|(D0)|([K][1-9][0-9]{0,5})' for
type '_intermediate_TaxCodeStructure'.</DeveloperMessage>
</Messages>
</Application>
</Error>
<Error>
<RaisedBy>ChRIS</RaisedBy>
<Number>4052</Number>
<Type>schema</Type>
<Text>Element 'TaxCodeAtLeaving' must only have valid text as its
content</Text>
<Location>/hd:GovTalkMessage[1]/hd:Body[1]/mov:IRenvelope[1]/mov:InYearMovements[1]/mov45Part1[1]/mov:TaxCodeAtLeaving[1]</Location>
<Application>
<Messages xmlns="http://www.govtalk.gov.uk/validation/messages/1">
<ServiceMessage>
<UserText number="7674">Tax code entered is not a valid code.</UserText>
</ServiceMessage>
<DeveloperMessage>cvc-complex-type.2.2: Element 'TaxCodeAtLeaving' must have
no element [children], and the value must be valid.</DeveloperMessage>
</Messages>
</Application>
</Error>
</ErrorResponse>
</Body>
</GovTalkMessage>