<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7650.21">
<TITLE>Validation of element content against element tags</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P ALIGN=LEFT><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">All,</FONT></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">In an xml file I want to define some regular expression</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">s</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"> (in the schema they can just be string types, unless there is a way to enforce that the content is a valid regular expression</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"></FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">–</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"> is there a regular expression for regular expressions</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">…</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">) and some composite expressions</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"> formed of the basic elements</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"> (probably string lists in the schema)</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">:</FONT></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"><</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">root</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">></FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial"><basic></FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"></SPAN></P>
<UL><UL>
<P ALIGN=LEFT><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"><firstSequence>[1-4][0-9]{2}</firstSequence></FONT></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"><secondSequence>[0-9]{5}</secondSequence></FONT></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"><thirdSequence>([9]+)</thirdSequence></FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"></SPAN></P>
</UL></UL>
<P ALIGN=LEFT><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial"></basic></FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-gb"> </SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial"><composite></FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-gb"> </SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial"><!</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">—</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"> what</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">’</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">s the best way to</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">validate</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"> this?</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">--></FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"></SPAN></P>
<UL><UL>
<P ALIGN=LEFT><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"><compositeOne>thirdSequence firstSequence secondSequence</compositeOne></FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"></SPAN></P>
</UL></UL>
<P ALIGN=LEFT><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"></composite></FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"></</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">root</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">></FONT></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">The issue is in validating the composite content i.e. that elements with those names in the list exist. I’m guessing</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">one</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"> way to do it is</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">, once parsed into</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">an</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">xsd tree</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">,</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"> to traverse the DOM node associated with the ‘</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">basic</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">’</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"> type</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">comparing each</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"> tag local name</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">(firstSequence, secondSequence etc)</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">against the items in the list.</FONT></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">Having found a match</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">I</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"> also want to get back to the xsd type</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"></FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">which looks feasible from reading some of the other posts here</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"> (each element of</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">‘</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">basic</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">’</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"> being of</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">the same</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">type basic_t)</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">:</FONT></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Courier New">DOMNode const*</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Courier New"> matched_basic</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Courier New">_node</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Courier New"> = ..</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Courier New">.</FONT></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Courier New">xml_schema::type& t (</FONT></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Courier New"> *reinterpret_cast<xml_schema::type*> (</FONT></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Courier New"> </FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Courier New">matched_basic</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Courier New">_node</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Courier New">->getUserData(xml_schema::tree_node_key)));</FONT></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Courier New"> </FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Courier New">basic_t</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Courier New">&</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Courier New">b</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Courier New">(</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Courier New"></FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Courier New">dynamic_cast<</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Courier New">basic_t</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Courier New">&>(t)</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Courier New"></FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Courier New">);</FONT></SPAN></P>
<BR>
<P ALIGN=LEFT><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">Is there a</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">fundamentally</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"></FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">different way of going about the list validation</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">–</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"> in an ideal world the content would be validated when the xml is parsed in the first place</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">, which</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">I</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"> realise is unlikely</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"> due to the seemingly bespoke nature of the problem</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">.</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">Any help greatly appreciated.</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"></SPAN></P>
<BR>
<P ALIGN=LEFT><SPAN LANG="en-gb"></SPAN><A NAME=""><SPAN LANG="en-gb"><FONT SIZE=2>Dave Moss</FONT></SPAN></A></P>
<P ALIGN=LEFT><SPAN LANG="en-gb"><FONT SIZE=2>SELEX Communications</FONT></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-gb"><FONT SIZE=2>Grange Road</FONT></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-gb"><FONT SIZE=2>Christchurch </FONT></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-gb"><FONT SIZE=2>Dorset BH23 4JE</FONT></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-gb"><FONT SIZE=2>United Kingdom</FONT></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-gb"><FONT SIZE=2>Tel: + 44 (0) 1202 404841</FONT></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-gb"><FONT SIZE=2>Email:</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT COLOR="#000000" SIZE=2>david.r.moss@selex-comm.com</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-gb"></SPAN></P>
</BODY>
</HTML>