Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9237457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:32:22+00:00 2026-06-18T07:32:22+00:00

I’m creating an XML file based on someone else’s XSD specification, but I just

  • 0

I’m creating an XML file based on someone else’s XSD specification, but I just can’t figure out why it doesn’t validate.

Here’s the rule:

<xs:simpleType name="NonEmptyStringType">
    <xs:restriction base="xs:string">
        <xs:minLength value="1" />
        <xs:pattern value="[^\t\n\r]*[^\s][^\t\n\r]*" />
    </xs:restriction>
</xs:simpleType>

in which I read the pattern as follows:

  • [^\t\n\r]* match anything that is not tabs, newlines or spaces returns 0 or more times
  • [^\s] match anything that is not a space
  • [^\t\n\r]* match anything that is not tabs, newlines or spaces returns 0 or more times

and following example of one of the many mismatching xml:

        <Zipcode>3506 RT</Zipcode>

It’s not matching 3506 RT (or 3506RT for that matter, and many other things I would expect to match) according to xmllint, with the following error:

element Zipcode: Schemas validity error : Element '{http://www.reeleezee.nl/taxonomy/1.23}Zipcode': [facet 'pattern'] The value '3506 RT' is not accepted by the pattern '[^\t\n\r]*[^\s][^\t\n\r]*'.

Any hints on what I’m not interpreting right? (I don’t understand the strictness of their NonEmptyStringType btw, I would just use .+)


As requested, here’s the zipcode declaration:

<xs:element name="Zipcode" minOccurs="0" nillable="true" rse:CanIgnore="true">
    <xs:annotation>
        <xs:documentation>Postcode</xs:documentation>
    </xs:annotation>
    <xs:simpleType>
        <xs:restriction base="NonEmptyStringType">
            <xs:maxLength value="10" />
        </xs:restriction>
    </xs:simpleType>
</xs:element>

as you can see, this links back to the pattern in NonEmptyStringType (first rule posted above)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T07:32:23+00:00Added an answer on June 18, 2026 at 7:32 am

    This regex looks fine to me. I think it’s a bug in your validation tool… they are often buggy in edge-cases.

    OK, just checked: xerces accepts it; xmllint fails (I see you were using xmllint). I’ve found several times in the past that xerces is correct, and xmllint has problems in unusual cases. And this regex is unusual. (I have to say, I actually love xmllint, it’s really fast, but the xsd spec is huge, complex and confusing, and the xmllint folks haven’t nailed all the edge cases yet).

    The two online validators I tried also accept it: http://www.utilities-online.info/xsdvalidation and http://www.freeformatter.com/xml-validator-xsd.html

    BTW: for xerces, I downloaded their java version, and found their class jaxp.SourceValidator the best tool for validating. But I believe it’s the same code already in java.


    EDIT I did some more tests in xerces, to ensure that the regex can fail (i.e. it is active). It fails if there is a \n anywhere. (same for \t, though I didn’t test \r).

    Checking the spec, \s is defined as [#x20\t\n\r]
    (in this table). That makes it clear that the regex is saying you can’t have \t, \n or \r anywhere. But you can have as many literal space characters (#x20) as you like, provided they aren’t all space characters (i.e. there is at least one non-space char, to match that [^\s] – btw could notate that as \S). Xerces confirms this: all spaces gives an error.

    Maybe they want to allow space literals (both padding and interspersing), provided there is some value in there (i.e. not all spaces).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
In my XML file chapters tag has more chapter tag.i need to display chapters
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm parsing an XML file, the creators of it stuck in a bunch social
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
I have a small JavaScript validation script that validates inputs based on Regex. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.