Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - RegEx not right in my XmlSchema [Thread Next] Re: RegEx not right in my XmlSchemaTo: NULL Date: 10/1/2007 9:22:00 PM Amongst other things you need to escape the regex according to XML rules < to & l t ;, & to & a m p ; etc. (spaces here just for readability). -- Joe Fawcett (MVP - XML) http://joe.fawcett.name "billr" <billr@d...> wrote in message news:D7A1054D-0B83-4C32-A06D-B44B6306F382@m...... >I apologise if this has gone to the wrong disvussion group, however, I'm > really not sure to which group it actually should be posted. So, here's my > plight ... > > The following is my RegEx expression > > \<\!\[CDATA\[\s*(\d*|\w*|\W*|\s*|.*|>*)*\s*\]\]\> > > The following is my dataset > > <![CDATA[<P ALIGN=\"LEFT\"><FONT FACE=\"Yell Corpid > Regular\" SIZE=\"25\" COLOR=\"#FF0000\" LETTERSPACING=\"0\" > KERNING=\"0\">title text here...</FONT></P>]]> > > So far, so good, all's well that ends well and all. Except, when I use the > RegEx as a pattern in my XSD, for example ... > > <xs:simpleType name="CDATAContentElementType"> > <xs:restriction base="TextType"> > <xs:pattern value="\<\!\[CDATA\[\s*(\d*|\w*|\W*|\s*|.*|>*)*\s*\]\]\>" > /> > </xs:restriction> > </xs:simpleType> > > *note, in this post the pattern above might not render exactly as > described > ... the pattern uses the escape sequence & gt; > > Having this defined I write some XML (you might notice the CDATA is > exactly > the same as above) > > <content><![CDATA[<P ALIGN=\"LEFT\"><FONT FACE=\"Yell Corpid Regular\" > SIZE=\"25\" COLOR=\"#FF0000\" LETTERSPACING=\"0\" KERNING=\"0\">title text > here...</FONT></P>]]></content> > > However, within VisualStudio IDE it is reported that ... > > The 'xxx.xsd:content' element is invalid - The value '<cdata contents go > here>' is invalid according to its datatype > 'xxx.xsd:CDATAContentElementType' > - The Pattern constraint failed. > > So, I think that maybe there is a problem with my RegEx, but I can find no > information as to what is wrong with it. Clearly there is a difference > between RegEx and RegEx for Xml, but I don't know what ti is :o( > > Please, please help a man almost reduced to tears ;o) > > -- > Of all words of tongue and pen, the saddest are: "It might have been" > > Bill.Richards @ greyskin .co .uk > http://greyskin.co.uk | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
