title: How to write XSD to validate escaped xml data pattern
body: <p>I got a specific xml data below</p>
  
  <pre><code>&lt;l7:ApiPlans xmlns:l7="http://ns.xcompany.com/2012/04/api-management"&gt;
    &lt;l7:ApiPlan&gt;
  &lt;l7:PlanPolicy&gt;
  
  &amp;lt;wsp:Policy xmlns:L7p="http://www.xcompany.com/ws/policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy"&amp;gt;
  &amp;lt;wsp:All wsp:Usage="Required"&amp;gt;
      &amp;lt;wsp:All wsp:Usage="Required"&amp;gt;
            ...... some other welformed xml
  &amp;lt;/wsp:All&amp;gt;
      &amp;lt;/wsp:All&amp;gt;
  &amp;lt;/wsp:Policy&amp;gt;
      &lt;/l7:PlanPolicy&gt;
    &lt;/l7:ApiPlan&gt;
  &lt;/l7:ApiPlans&gt;
  </code></pre>
  
  <p>That I need to write an XSD (if possible) to validate that PlanPolicy starts with </p>
  
  <pre><code>&amp;lt;wsp:Policy xmlns:L7p="http://www.xcompany.com/ws/policy"     
  xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy"&amp;gt;
  &amp;lt;wsp:All wsp:Usage="Required"&amp;gt;
      &amp;lt;wsp:All wsp:Usage="Required"&amp;gt;
  </code></pre>
  
  <p>and ends with </p>
  
  <pre><code> &amp;lt;/wsp:All&amp;gt;
          &amp;lt;/wsp:All&amp;gt;
      &amp;lt;/wsp:Policy&amp;gt;
  </code></pre>
  
  <p>So far I have this,</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://ns.xcompany.com/2012/04/api-management" xmlns:l7="http://ns.xcompany.com/2012/04/api-management"&gt;
  &lt;xs:element name="ApiPlans"&gt;
      &lt;xs:complexType&gt;
          &lt;xs:sequence&gt;
              &lt;xs:element maxOccurs="unbounded" ref="l7:ApiPlan"/&gt;
          &lt;/xs:sequence&gt;
      &lt;/xs:complexType&gt;
  &lt;/xs:element&gt;
  &lt;xs:element name="ApiPlan"&gt;
      &lt;xs:complexType&gt;
          &lt;xs:sequence&gt;               
              &lt;xs:element ref="l7:PlanPolicy"/&gt;
          &lt;/xs:sequence&gt;
      &lt;/xs:complexType&gt;
  &lt;/xs:element&gt;
  &lt;xs:element name="PlanPolicy" type="policyDataType"/&gt;
  &lt;simpleType name="policyDataType"&gt;
      &lt;restriction base="xs:string"&gt;
           &lt;minLength value="1"&gt;&lt;/minLength&gt;
          &lt;pattern value="(&amp;lt;).*(&amp;gt;).*(&amp;lt;).*(&amp;gt;)"&gt;&lt;/pattern&gt;
      &lt;/restriction&gt;
  &lt;/simpleType&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>Is that possible? And as a side question, How do you define in pattern: new lines(CR/LF), tab and quotes.</p>
  
  <p>Thanks in advance</p>