code: public Duration newDurationYearMonth(final String lexicalRepresentation) {
          if (lexicalRepresentation == null) {
              throw new NullPointerException("lexicalRepresentation == null");
          }
          // The lexical representation must match the pattern [^DT]*.
          int length = lexicalRepresentation.length();
          for (int i = 0; i < length; ++i) {
              char c = lexicalRepresentation.charAt(i);
              if (c == 'D' || c == 'T') {
                  throw new IllegalArgumentException("Invalid yearMonthDuration value: " + lexicalRepresentation);
              }
          }
          return newDuration(lexicalRepresentation);
      }
docs: <p>Create a <code>Duration</code> of type <code>xdt:yearMonthDuration</code> by parsing its <code>String</code> representation,
  "<em>PnYnM</em>", <a href="http://www.w3.org/TR/xpath-datamodel#dt-yearMonthDuration">
  XQuery 1.0 and XPath 2.0 Data Model, xdt:yearMonthDuration</a>.</p>
  
  <p>The datatype <code>xdt:yearMonthDuration</code> is a subtype of <code>xs:duration</code>
  whose lexical representation contains only year and month components.
  This datatype resides in the namespace {@link javax.xml.XMLConstants#W3C_XPATH_DATATYPE_NS_URI}.</p>
  
  <p>Both values are set and available from the created {@link Duration}</p>
  
  <p>The XML Schema specification states that values can be of an arbitrary size.
  Implementations may chose not to or be incapable of supporting arbitrarily large and/or small values.
  An {@link UnsupportedOperationException} will be thrown with a message indicating implementation limits
  if implementation capacities are exceeded.</p>
  
  @param lexicalRepresentation Lexical representation of a duration.
  
  @return New <code>Duration</code> created using the specified <code>lexicalRepresentation</code>.
  
  @throws IllegalArgumentException If the <code>lexicalRepresentation</code> does not conform to the specification.
  @throws UnsupportedOperationException If implementation cannot support requested values.
  @throws NullPointerException If <code>lexicalRepresentation</code> is <code>null</code>.