gt:             if (!token.equals(name)) {
context: package org.librera;
  
  /*
  Copyright (c) 2015 JSON.org
  
  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the Software is
  furnished to do so, subject to the following conditions:
  
  The above copyright notice and this permission notice shall be included in all
  copies or substantial portions of the Software.
  
  The Software shall be used for Good, not Evil.
  
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
  */
  
  import java.io.Reader;
  import java.io.StringReader;
  import java.util.Iterator;
  
  /**
   * This provides static methods to convert an XML text into a LinkedJSONObject, and to
   * covert a LinkedJSONObject into an XML text.
   *
   * @author JSON.org
   * @version 2016-08-10
   */
  @SuppressWarnings("boxing")
  public class XML {
  
      /** The Character '&amp;'. */
      public static final Character AMP = '&';
  
      /** The Character '''. */
      public static final Character APOS = '\'';
  
      /** The Character '!'. */
      public static final Character BANG = '!';
  
      /** The Character '='. */
      public static final Character EQ = '=';
  
      /** The Character '>'. */
      public static final Character GT = '>';
  
      /** The Character '&lt;'. */
      public static final Character LT = '<';
  
      /** The Character '?'. */
      public static final Character QUEST = '?';
  
      /** The Character '"'. */
      public static final Character QUOT = '"';
  
      /** The Character '/'. */
      public static final Character SLASH = '/';
  
      /**
       * Null attrubute name
       */
      public static final String NULL_ATTR = "xsi:nil";
  
      /**
       * Creates an iterator for navigating Code Points in a string instead of
       * characters. Once Java7 support is dropped, this can be replaced with
       * <code>
       * string.codePoints()
       * </code>
       * which is available in Java8 and above.
       *
       * @see <a href=
       *      "http://stackoverflow.com/a/21791059/6030888">http://stackoverflow.com/a/21791059/6030888</a>
       */
      private static Iterable<Integer> codePointIterator(final String string) {
          return new Iterable<Integer>() {
              @Override
              public Iterator<Integer> iterator() {
                  return new Iterator<Integer>() {
                      private int nextIndex = 0;
                      private int length = string.length();
  
                      @Override
                      public boolean hasNext() {
                          return this.nextIndex < this.length;
                      }
  
                      @Override
                      public Integer next() {
                          int result = string.codePointAt(this.nextIndex);
                          this.nextIndex += Character.charCount(result);
                          return result;
                      }
  
                      @Override
                      public void remove() {
                          throw new UnsupportedOperationException();
                      }
                  };
              }
          };
      }
  
      /**
       * Replace special characters with XML escapes:
       *
       * <pre>
       * &amp; <small>(ampersand)</small> is replaced by &amp;amp;
       * &lt; <small>(less than)</small> is replaced by &amp;lt;
       * &gt; <small>(greater than)</small> is replaced by &amp;gt;
       * &quot; <small>(double quote)</small> is replaced by &amp;quot;
       * &apos; <small>(single quote / apostrophe)</small> is replaced by &amp;apos;
       * </pre>
       *
       * @param string
       *            The string to be escaped.
       * @return The escaped string.
       */
      public static String escape(String string) {
          StringBuilder sb = new StringBuilder(string.length());
          for (final int cp : codePointIterator(string)) {
              switch (cp) {
              case '&':
                  sb.append("&amp;");
                  break;
              case '<':
                  sb.append("&lt;");
                  break;
              case '>':
                  sb.append("&gt;");
                  break;
              case '"':
                  sb.append("&quot;");
                  break;
              case '\'':
                  sb.append("&apos;");
                  break;
              default:
                  if (mustEscape(cp)) {
                      sb.append("&#x");
                      sb.append(Integer.toHexString(cp));
                      sb.append(';');
                  } else {
                      sb.appendCodePoint(cp);
                  }
              }
          }
          return sb.toString();
      }
  
      /**
       * @param cp code point to test
       * @return true if the code point is not valid for an XML
       */
      private static boolean mustEscape(int cp) {
          /* Valid range from https://www.w3.org/TR/REC-xml/#charsets
           *
           * #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
           *
           * any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
           */
          // isISOControl is true when (cp >= 0 && cp <= 0x1F) || (cp >= 0x7F && cp <= 0x9F)
          // all ISO control characters are out of range except tabs and new lines
          return (Character.isISOControl(cp)
                  && cp != 0x9
                  && cp != 0xA
                  && cp != 0xD
              ) || !(
                  // valid the range of acceptable characters that aren't control
                  (cp >= 0x20 && cp <= 0xD7FF)
                  || (cp >= 0xE000 && cp <= 0xFFFD)
                  || (cp >= 0x10000 && cp <= 0x10FFFF)
              )
          ;
      }
  
      /**
       * Removes XML escapes from the string.
       *
       * @param string
       *            string to remove escapes from
       * @return string with converted entities
       */
      public static String unescape(String string) {
          StringBuilder sb = new StringBuilder(string.length());
          for (int i = 0, length = string.length(); i < length; i++) {
              char c = string.charAt(i);
              if (c == '&') {
                  final int semic = string.indexOf(';', i);
                  if (semic > i) {
                      final String entity = string.substring(i + 1, semic);
                      sb.append(XMLTokener.unescapeEntity(entity));
                      // skip past the entity we just parsed.
                      i += entity.length() + 1;
                  } else {
                      // this shouldn't happen in most cases since the parser
                      // errors on unclosed entries.
                      sb.append(c);
                  }
              } else {
                  // not part of an entity
                  sb.append(c);
              }
          }
          return sb.toString();
      }
  
      /**
       * Throw an exception if the string contains whitespace. Whitespace is not
       * allowed in tagNames and attributes.
       *
       * @param string
       *            A string.
       * @throws org.librera.JSONException Thrown if the string contains whitespace or is empty.
       */
      public static void noSpace(String string) throws org.librera.JSONException {
          int i, length = string.length();
          if (length == 0) {
              throw new org.librera.JSONException("Empty string.");
          }
          for (i = 0; i < length; i += 1) {
              if (Character.isWhitespace(string.charAt(i))) {
                  throw new org.librera.JSONException("'" + string
                          + "' contains a space character.");
              }
          }
      }
  
      /**
       * Scan the content following the named tag, attaching it to the context.
       *
       * @param x
       *            The XMLTokener containing the source string.
       * @param context
       *            The LinkedJSONObject that will include the new material.
       * @param name
       *            The tag name.
       * @return true if the close tag is processed.
       * @throws org.librera.JSONException
       */
      private static boolean parse(XMLTokener x, LinkedJSONObject context, String name, XMLParserConfiguration config)
              throws org.librera.JSONException {
          char c;
          int i;
          LinkedJSONObject jsonobject = null;
          String string;
          String tagName;
          Object token;
  
          // Test for and skip past these forms:
          // <!-- ... -->
          // <! ... >
          // <![ ... ]]>
          // <? ... ?>
          // Report errors for these forms:
          // <>
          // <=
          // <<
  
          token = x.nextToken();
  
          // <!
  
          if (token == BANG) {
              c = x.next();
              if (c == '-') {
                  if (x.next() == '-') {
                      x.skipPast("-->");
                      return false;
                  }
                  x.back();
              } else if (c == '[') {
                  token = x.nextToken();
                  if ("CDATA".equals(token)) {
                      if (x.next() == '[') {
                          string = x.nextCDATA();
                          if (string.length() > 0) {
                              context.accumulate(config.cDataTagName, string);
                          }
                          return false;
                      }
                  }
                  throw x.syntaxError("Expected 'CDATA['");
              }
              i = 1;
              do {
                  token = x.nextMeta();
                  if (token == null) {
                      throw x.syntaxError("Missing '>' after '<!'.");
                  } else if (token == LT) {
                      i += 1;
                  } else if (token == GT) {
                      i -= 1;
                  }
              } while (i > 0);
              return false;
          } else if (token == QUEST) {
  
              // <?
              x.skipPast("?>");
              return false;
          } else if (token == SLASH) {
  
              // Close tag </
  
              token = x.nextToken();
              if (name == null) {
                  throw x.syntaxError("Mismatched close tag " + token);
              }
  