Ejemplo n.º 1
0
 public static TimeZone fromString(
     javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) {
   if (content.indexOf(":") > -1) {
     java.lang.String prefix = content.substring(0, content.indexOf(":"));
     java.lang.String namespaceUri =
         xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix);
     return TimeZone.Factory.fromString(content, namespaceUri);
   } else {
     return TimeZone.Factory.fromString(content, "");
   }
 }
Ejemplo n.º 2
0
    /**
     * static method to create the object Precondition: If this object is an element, the current or
     * next start element starts this object and any intervening reader events are ignorable If this
     * object is not an element, it is a complex type and the reader is at the event just after the
     * outer start element Postcondition: If this object is an element, the reader is positioned at
     * its end element If this object is a complex type, the reader is positioned at the end element
     * of its outer element
     */
    public static TimeZone parse(javax.xml.stream.XMLStreamReader reader)
        throws java.lang.Exception {
      TimeZone object = null;
      // initialize a hash map to keep values
      java.util.Map attributeMap = new java.util.HashMap();
      java.util.List extraAttributeList = new java.util.ArrayList();

      int event;
      java.lang.String nillableValue = null;
      java.lang.String prefix = "";
      java.lang.String namespaceuri = "";
      try {

        while (!reader.isStartElement() && !reader.isEndElement()) reader.next();

        // Note all attributes that were handled. Used to differ normal attributes
        // from anyAttributes.
        java.util.Vector handledAttributes = new java.util.Vector();

        while (!reader.isEndElement()) {
          if (reader.isStartElement() || reader.hasText()) {

            java.lang.String content = reader.getElementText();

            if (content.indexOf(":") > 0) {
              // this seems to be a Qname so find the namespace and send
              prefix = content.substring(0, content.indexOf(":"));
              namespaceuri = reader.getNamespaceURI(prefix);
              object = TimeZone.Factory.fromString(content, namespaceuri);
            } else {
              // this seems to be not a qname send and empty namespace incase of it is
              // check is done in fromString method
              object = TimeZone.Factory.fromString(content, "");
            }

          } else {
            reader.next();
          }
        } // end of while loop

      } catch (javax.xml.stream.XMLStreamException e) {
        throw new java.lang.Exception(e);
      }

      return object;
    }