10 Replies - 447 Views - Last Post: 20 June 2019 - 03:08 PM

#1 leirret   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 19-June 19

We are having a problem with a pattern string

Posted 19 June 2019 - 12:03 PM

I am still learning a lot about xml and I have run into a problem I can figure out this is a snippet of the code forming a pattern that keeps throwing errors
<xs:simpleType name="caseNumber">
		<xs:restriction base="xs:string">
			<xs:maxLength value="20"/>
			<xs:minLength value="4"/>
			<xs:pattern value="[A-Z][A-Z][A-Z]([0-9])*"/>
:code:

I figure the last line is giving me the error because I can't match the pattern here is the error I receive

<pay:ErrorSecondary>error: cvc-datatype-valid.1.1: string value '' does not match pattern for caseNumber in namespace http://www.dir.ca.go...ErrorSecondary>

an example of the pattern used is ADJ00000000, how does this not match the pattern?

"[A-Z][A-Z][A-Z]([0-9])*"/>

Thanks in advance

This post has been edited by modi123_1: 19 June 2019 - 12:11 PM
Reason for edit:: In the future, please highlight the text that is code and click the [code] button in the editor.


Is This A Good Question/Topic? 0
  • +

Replies To: We are having a problem with a pattern string

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15160
  • View blog
  • Posts: 60,694
  • Joined: 12-June 08

Re: We are having a problem with a pattern string

Posted 19 June 2019 - 12:06 PM

Please copy/paste the errors here.
Was This Post Helpful? 0
  • +
  • -

#3 leirret   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 19-June 19

Re: We are having a problem with a pattern string

Posted 19 June 2019 - 12:11 PM

<pay:ErrorSecondary>error: cvc-datatype-valid.1.1: string value '' does not match pattern for caseNumber in namespace http://www.dir.ca.go...ErrorSecondary>
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15160
  • View blog
  • Posts: 60,694
  • Joined: 12-June 08

Re: We are having a problem with a pattern string

Posted 19 June 2019 - 12:13 PM

Okay.. let me back up, _WHAT_ is throwing the error?

XML is typically pretty inert.
Was This Post Helpful? 0
  • +
  • -

#5 leirret   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 19-June 19

Re: We are having a problem with a pattern string

Posted 19 June 2019 - 12:29 PM

the state server when it is validating our data

This post has been edited by Skydiver: 20 June 2019 - 03:25 AM
Reason for edit:: Removed unnecessary quote. No need to quote the post above yours.

Was This Post Helpful? 0
  • +
  • -

#6 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 6985
  • View blog
  • Posts: 23,751
  • Joined: 05-May 12

Re: We are having a problem with a pattern string

Posted 19 June 2019 - 07:08 PM

Try:
[A-Z][A-Z][A-Z][0-9]*


Was This Post Helpful? 0
  • +
  • -

#7 leirret   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 19-June 19

Re: We are having a problem with a pattern string

Posted 19 June 2019 - 08:18 PM

The data we sent was ADJ000000 and it did not validate but it should have that is my problem

I have included the XML file and the response for the server

Attached File(s)


This post has been edited by Skydiver: 20 June 2019 - 03:24 AM
Reason for edit:: Removed unnecessary quote. No need to quote the post above yours.

Was This Post Helpful? 0
  • +
  • -

#8 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 6985
  • View blog
  • Posts: 23,751
  • Joined: 05-May 12

Re: We are having a problem with a pattern string

Posted 20 June 2019 - 03:24 AM

leirret: There is no need to quote the post above yours. Just use the big Reply button or the Fast Reply area.

Did you try the the different regular expression I suggested on post #6?
Was This Post Helpful? 0
  • +
  • -

#9 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 6985
  • View blog
  • Posts: 23,751
  • Joined: 05-May 12

Re: We are having a problem with a pattern string

Posted 20 June 2019 - 03:36 AM

I must be going blind. In post #7, the response returned was:
<dwc:DWCPacket xsi:schemaLocation="http://www.dir.ca.gov/dwc/EAMS/PresentTermSolution/Schemas/DWCPacket http://www.dir.ca.gov/dwc/EAMS/PresentTermSolution/Schemas/DWCPacket.xsd" xmlns:dwc="http://www.dir.ca.gov/dwc/EAMS/PresentTermSolution/Schemas/DWCPacket" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.dir.ca.gov/dwc/EAMS/PresentTermSolution/Schemas/Payloads/EAMSPacketReceiveResponse" xmlns:pay="http://www.dir.ca.gov/dwc/EAMS/PresentTermSolution/Schemas/Common/PayloadFields">
  <dwc:DwcPacketHeader>
    <dwc:VersionNumber>1.4</dwc:VersionNumber>
    <dwc:PacketId>1000104-20190619-9006</dwc:PacketId>
    <dwc:TransportProtocol>SFTP</dwc:TransportProtocol>
    <dwc:PacketType>REQ</dwc:PacketType>
    <dwc:ClientUserId>1000104</dwc:ClientUserId>
  </dwc:DwcPacketHeader>
  <dwc:DwcPayloadInformation>
    <dwc:ServiceName>IN1</dwc:ServiceName>
    <dwc:PayloadFormat>XML</dwc:PayloadFormat>
    <dwc:PayloadSchema>SubmitFormsToEams</dwc:PayloadSchema>
  </dwc:DwcPayloadInformation>
  <dwc:DwcPacketHeaderSource>
    <dwc:LogicalSystem>EAMS</dwc:LogicalSystem>
    <dwc:Environment>TST</dwc:Environment>
  </dwc:DwcPacketHeaderSource>
  <dwc:DwcPacketHeaderTarget>
    <dwc:LogicalSystem>EAMS</dwc:LogicalSystem>
    <dwc:Environment>TST</dwc:Environment>
  </dwc:DwcPacketHeaderTarget>
  <dwc:DwcPacketPayload>
    <EAMSPacketReceiveResponse>
      <HeaderSection>
        <VersionNumber>1.4</VersionNumber>
      </HeaderSection>
      <Message>Packet has been received.</Message>
    </EAMSPacketReceiveResponse>
  </dwc:DwcPacketPayload>
  <dwc:DwcPacketExceptions>
    <dwc:Exception>
      <pay:ErrorCode>10000</pay:ErrorCode>
      <pay:ErrorPrimary>Invalid File Error</pay:ErrorPrimary>
      <pay:ErrorSecondary>This file is a duplicate, therefore EAMS rejected it.</pay:ErrorSecondary>
    </dwc:Exception>
    <dwc:Exception>
      <pay:ErrorCode>10000</pay:ErrorCode>
      <pay:ErrorPrimary>Invalid File Error</pay:ErrorPrimary>
      <pay:ErrorSecondary>Duplicate Packet ID</pay:ErrorSecondary>
    </dwc:Exception>
  </dwc:DwcPacketExceptions>
</dwc:DWCPacket>



I'm not seeing anythere regarding the pattern not matching.

Now as for the original problem. Please recall that XML is case sensitive. In your post #1, it seems like it is talking about an element name "caseNumber". From what I can see from post #7, you were sending "CaseNumber":
<CaseNumber>ADJ10801422</CaseNumber>


Was This Post Helpful? 0
  • +
  • -

#10 leirret   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 19-June 19

Re: We are having a problem with a pattern string

Posted 20 June 2019 - 04:38 AM

View PostSkydiver, on 20 June 2019 - 03:24 AM, said:

leirret: There is no need to quote the post above yours. Just use the big Reply button or the Fast Reply area.

Did you try the the different regular expression I suggested on post #6?

no it is on my i posted the wrong one

i just posted the correct one

Attached File(s)


Was This Post Helpful? 0
  • +
  • -

#11 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 6985
  • View blog
  • Posts: 23,751
  • Joined: 05-May 12

Re: We are having a problem with a pattern string

Posted 20 June 2019 - 03:08 PM

See last paragraph of post #9. I think that the element name should be <caseNumber>, not <CaseNumber>

Yup, I was right according to CommonFields.xsd:
:
<xs:simpleType name="caseNumber">
  <xs:restriction base="xs:string">
    <xs:maxLength value="20"/>
    <xs:minLength value="4"/>
    <xs:pattern value="[A-Z][A-Z][A-Z]([0-9])*"/>
  </xs:restriction>
</xs:simpleType>
:



which also matches up with your post #1.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1