コード例 #1
0
    public static SlotState parse(final XMLStreamReader reader) throws Exception {
      SlotState object = null;

      String prefix = "";
      String namespaceuri = "";
      try {
        while (!reader.isStartElement() && !reader.isEndElement()) {
          reader.next();
        }

        while (!reader.isEndElement()) {
          if (reader.isStartElement() || reader.hasText()) {
            final String content = reader.getElementText();
            if (content.indexOf(":") > 0) {
              prefix = content.substring(0, content.indexOf(":"));
              namespaceuri = reader.getNamespaceURI(prefix);
              object = SlotState.Factory.fromString(content, namespaceuri);
            } else {
              object = SlotState.Factory.fromString(content, "");
            }
          } else {
            reader.next();
          }
        }
      } catch (final XMLStreamException e) {
        throw new Exception(e);
      }

      return object;
    }
コード例 #2
0
 public static SlotState fromString(
     final XMLStreamReader xmlStreamReader, final String content) {
   if (content.indexOf(":") > -1) {
     final String prefix = content.substring(0, content.indexOf(":"));
     final String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix);
     return SlotState.Factory.fromString(content, namespaceUri);
   } else {
     return SlotState.Factory.fromString(content, "");
   }
 }