title: Selecting nodes with XPath for binding a subset of classes with JAXB
body: <p><strong>Simplified Question:</strong>
  What's the XPath to select all XML nodes with an attribute that ends with the string "Notification". The first and third nodes in this snippet:</p>
  
  <pre><code> &lt;events&gt;
     &lt;event name="CreatedNotification" /&gt;
     &lt;event name="InfoLog" /&gt;
     &lt;event name="UpdatedNotification" /&gt;
   &lt;/events&gt;
  </code></pre>
  
  <p><strong>Detailed Question:</strong></p>
  
  <p>I want to select multiple complexTypes from a xsd schema for binding with JAXB. This works for a single class: OrderStateChangeNotification</p>
  
  <pre><code>&lt;jxb:bindings schemaLocation="apiv2.xsd"&gt;
    &lt;jxb:bindings node="//xs:complexType[@name='OrderStateChangeNotification']"&gt;
      &lt;inheritance:implements&gt;com.google.checkout.sdk.notifications.Notification&lt;/inheritance:implements&gt; 
    &lt;/jxb:bindings&gt;
  &lt;/jxb:bindings&gt;
  </code></pre>
  
  <p>Here is the relevant snippet from the schema schema file:</p>
  
  <pre><code>  &lt;xs:complexType name="OrderStateChangeNotification"&gt;
      &lt;xs:all&gt;
        &lt;xs:element name="new-fulfillment-order-state" type="tns:FulfillmentOrderState" /&gt;
        &lt;xs:element name="new-financial-order-state" type="tns:FinancialOrderState" /&gt;
        &lt;xs:element name="previous-fulfillment-order-state" type="tns:FulfillmentOrderState" /&gt;
        &lt;xs:element name="previous-financial-order-state" type="tns:FinancialOrderState" /&gt;
        &lt;xs:element name="reason" type="xs:string" minOccurs="0" /&gt;
        &lt;xs:element name="timestamp" type="xs:dateTime" /&gt;
        &lt;xs:element name="google-order-number" type="xs:token" /&gt;
        &lt;xs:element name="order-summary" type="tns:OrderSummary" minOccurs="0" /&gt;
      &lt;/xs:all&gt;
      &lt;xs:attribute name="serial-number" type="xs:string" use="required" /&gt;
    &lt;/xs:complexType&gt;
  
    &lt;xs:complexType name="ChargeAmountNotification"&gt;
      &lt;xs:all&gt;
        &lt;xs:element name="timestamp" type="xs:dateTime" /&gt;
        &lt;xs:element name="latest-charge-amount" type="tns:Money" /&gt;
        &lt;xs:element name="latest-charge-fee" type="tns:FeeStructure" minOccurs="0" /&gt;
        &lt;xs:element name="total-charge-amount" type="tns:Money" /&gt;
        &lt;xs:element name="latest-promotion-charge-amount" type="tns:Money" minOccurs="0" /&gt;
        &lt;xs:element name="google-order-number" type="xs:token" /&gt;
        &lt;xs:element name="order-summary" type="tns:OrderSummary" minOccurs="0" /&gt;
      &lt;/xs:all&gt;
      &lt;xs:attribute name="serial-number" type="xs:string" use="required" /&gt;
    &lt;/xs:complexType&gt;
  </code></pre>
  
  <p>I want the binding to apply to all notification objects. They all end in with "Notification"</p>
  
  <p>I've tried changing the XPath from</p>
  
  <pre><code>//xs:complexType[@name='OrderStateChangeNotification']
  </code></pre>
  
  <p>to</p>
  
  <pre><code>//xs:complexType[substring(name(), string-length(name()) - 12) = 'Notification']
  </code></pre>
  
  <p>but it didn't work.</p>
  
  <p>Another approach is to try and select all nodes with the children "order-summary" and "serial-number" as I know only Notification objects have these.</p>
  
  <p><strong>UPDATE:</strong>
  The solution by @Lee Greco correctly selectes the nodes I wanted, but unfortunatly, the inheritance plugin is not compatible with multiple nodes:</p>
  
  <pre><code>[ERROR] XPath evaluation of "//xs:complexType[substring(@name, string-length(@name)-string-length('Notification')+1)='Notification']" results in too many (8) target nodes
  </code></pre>
  
  <p>I ended up just enumerating them separately.</p>