Regular expression in circuit check

I need an xml scheme that checks empty node and node with 8 digits for true. Therefore, I defined an XML schema with the following simple type:

<xs:simpleType name="LeererStringOder8Zeichen">
    <xs:restriction base="xs:string">
        <xs:pattern value="(^$|\d{8})"/>
    </xs:restriction>
</xs:simpleType>

I tried this regex using java.util.regex and the Xerces inner class RegularExpression. Both have returned. But when I use this simple type in my WS (implemented using CXF), I get a validation error when I send an empty string (e.g.). What for? Does anyone know how to change my scheme so that it accepts an empty tag and a tag containing 8 digits?

Thanks for the help, Andreas

+4
source share
2 answers

@dbank, XSD , $ ^ . "" XSD ( ) , XSD.

, 8 , (\d{8})?

+1

:

<xs:simpleType name="LeererStringOder8Zeichen">
    <xs:restriction base="xs:string">
        <xs:pattern value="|\d{8}"/>
    </xs:restriction>
</xs:simpleType>

|\d{8} , . ( |[0-9]{8}.)

, (^$|\d{8}) ( , - ^(|\d{8})$) , - XML Schema :

, , . XML- . , .

, , -, , .

+5

All Articles