public static PerformPrimitiveControl parse(final XMLStreamReader reader) throws Exception {
      final PerformPrimitiveControl object = new PerformPrimitiveControl();
      try {
        while (!reader.isStartElement() && !reader.isEndElement()) {
          reader.next();
        }

        while (!reader.isEndElement()) {
          if (reader.isStartElement()) {
            if (reader.isStartElement()
                && new QName(
                        "http://remotelabs.eng.uts.edu.au/rigclient/protocol",
                        "performPrimitiveControl")
                    .equals(reader.getName())) {
              object.setPerformPrimitiveControl(PrimitiveControlRequestType.Factory.parse(reader));
            } else {
              throw new ADBException("Unexpected subelement " + reader.getLocalName());
            }
          } else {
            reader.next();
          }
        }
      } catch (final XMLStreamException e) {
        throw new Exception(e);
      }
      return object;
    }
Пример #2
0
    public static RigStateType parse(final XMLStreamReader reader) throws Exception {
      RigStateType object = null;
      new HashMap<Object, Object>();

      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 = RigStateType.Factory.fromString(content, namespaceuri);
            } else {
              object = RigStateType.Factory.fromString(content, "");
            }
          } else {
            reader.next();
          }
        }
      } catch (final XMLStreamException e) {
        throw new Exception(e);
      }

      return object;
    }
Пример #3
0
    public static GetStatus parse(final XMLStreamReader reader) throws Exception {
      final GetStatus object = new GetStatus();

      try {
        while (!reader.isStartElement() && !reader.isEndElement()) {
          reader.next();
        }

        while (!reader.isEndElement()) {
          if (reader.isStartElement()) {
            if (reader.isStartElement()
                && new QName("http://remotelabs.eng.uts.edu.au/rigclient/protocol", "getStatus")
                    .equals(reader.getName())) {
              object.setGetStatus(NullType.Factory.parse(reader));
            } else {
              throw new ADBException("Unexpected subelement " + reader.getLocalName());
            }
          } else {
            reader.next();
          }
        }
      } catch (final XMLStreamException e) {
        throw new Exception(e);
      }

      return object;
    }
Пример #4
0
 /**
  * Forwards the given {@link XMLStreamReader} to the specified element or to the end of the
  * enclosing element/document if there is no such element.
  *
  * @param reader reader to forward, must not be <code>null</code>
  * @param elementName element to forward to, must not be <code>null</code>
  * @throws XMLStreamException
  */
 public static boolean skipToElementOnSameLevel(XMLStreamReader reader, QName elementName)
     throws XMLStreamException {
   while (reader.isStartElement() && !elementName.equals(reader.getName())) {
     skipElement(reader);
     nextElement(reader);
   }
   return reader.isStartElement() && elementName.equals(reader.getName());
 }
Пример #5
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 ListMethods parse(javax.xml.stream.XMLStreamReader reader)
        throws java.lang.Exception {
      ListMethods object = new ListMethods();

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

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

        nillableValue =
            reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "nil");
        if ("true".equals(nillableValue) || "1".equals(nillableValue)) {
          // Skip the element and report the null value.  It cannot have subelements.
          while (!reader.isEndElement()) reader.next();

          return object;
        }

        // 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()) {

            if (reader.isStartElement()) {

              // use the QName from the parser as the name for the builder
              javax.xml.namespace.QName startQname1 = reader.getName();

              // We need to wrap the reader so that it produces a fake START_DOCUMENT event
              // this is needed by the builder classes
              org.apache.axis2.databinding.utils.NamedStaxOMBuilder builder1 =
                  new org.apache.axis2.databinding.utils.NamedStaxOMBuilder(
                      new org.apache.axis2.util.StreamWrapper(reader), startQname1);
              object.setListMethods(builder1.getOMElement());

            } // End of if for expected property start element
            else {
              // A start element we are not expecting indicates an invalid parameter was passed
              throw new org.apache.axis2.databinding.ADBException(
                  "Unexpected subelement " + reader.getName());
            }

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

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

      return object;
    }
Пример #6
0
  /**
   * Parse the
   *
   * <p>elements
   *
   * @return a list of tokens from the dictionary's entry
   * @throws javax.xml.stream.XMLStreamException
   */
  EntryToken procTransduction() throws XMLStreamException {
    ArrayList<Integer> lhs = new ArrayList<Integer>();
    ArrayList<Integer> rhs = new ArrayList<Integer>();
    skipUntil("", COMPILER_LEFT_ELEM);
    reader.next();
    String name = "";
    while (true) {
      if (reader.isEndElement() && reader.getLocalName().equals(COMPILER_LEFT_ELEM)) {
        break;
      }
      if (reader.isStartElement()) {
        name = reader.getLocalName();
        readString(lhs, name);
        reader.next();
      } else if (reader.isCharacters()) {
        readString(lhs, "");
        reader.next();
      } else if (reader.isEndElement()) {
        reader.next();
      } else {
        throw new RuntimeException(
            "Error ("
                + reader.getLocation().getLineNumber()
                + ","
                + reader.getLocation().getColumnNumber()
                + "): unexpected type of event.");
      }
    }
    skipUntil(name, COMPILER_RIGHT_ELEM);
    reader.next();
    while (true) {
      if (reader.isEndElement() && reader.getLocalName().equals(COMPILER_RIGHT_ELEM)) {
        break;
      }
      if (reader.isStartElement()) {
        name = reader.getLocalName();
        readString(rhs, name);
        reader.next();
      } else if (reader.isCharacters()) {
        readString(rhs, "");
        reader.next();
      } else if (reader.isEndElement()) {
        reader.next();
      } else {
        throw new RuntimeException(
            "Error ("
                + reader.getLocation().getLineNumber()
                + ","
                + reader.getLocation().getColumnNumber()
                + "): unexpected type of event.");
      }
    }

    skipUntil(name, COMPILER_PAIR_ELEM);
    EntryToken e = new EntryToken();
    e.setSingleTransduction(lhs, rhs);
    return e;
  }
Пример #7
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 LifecycleManager parse(javax.xml.stream.XMLStreamReader reader)
        throws java.lang.Exception {
      LifecycleManager object = null;

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

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

        if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type") != null) {
          java.lang.String fullTypeName =
              reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
          if (fullTypeName != null) {
            java.lang.String nsPrefix = null;
            if (fullTypeName.indexOf(":") > -1) {
              nsPrefix = fullTypeName.substring(0, fullTypeName.indexOf(":"));
            }
            nsPrefix = nsPrefix == null ? "" : nsPrefix;

            java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":") + 1);

            if (!"LifecycleManager".equals(type)) {
              // find namespace for the prefix
              java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
              return (LifecycleManager)
                  org.apache.axis2.transaction.xsd.ExtensionMapper.getTypeObject(
                      nsUri, type, reader);
            }

            throw new org.apache.axis2.databinding.ADBException(
                "The an abstract class can not be instantiated !!!");
          }
        }

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

        reader.next();

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

        if (reader.isStartElement())
          // A start element we are not expecting indicates a trailing invalid property
          throw new org.apache.axis2.databinding.ADBException(
              "Unexpected subelement " + reader.getName());

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

      return object;
    }
Пример #8
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 DebugLevel parse(javax.xml.stream.XMLStreamReader reader)
        throws java.lang.Exception {
      DebugLevel 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<org.apache.axiom.om.OMAttribute>();

      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()) {

            nillableValue =
                reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "nil");
            if ("true".equals(nillableValue) || "1".equals(nillableValue)) {
              throw new org.apache.axis2.databinding.ADBException(
                  "The element: " + "DebugLevel" + "  cannot be null");
            }

            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 = DebugLevel.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 = DebugLevel.Factory.fromString(content, "");
            }

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

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

      return object;
    }
Пример #9
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 hr.ponge.pfa.axis.core.operations.CreateDocumentReq parse(
        javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception {
      hr.ponge.pfa.axis.core.operations.CreateDocumentReq object =
          new hr.ponge.pfa.axis.core.operations.CreateDocumentReq();
      int event;
      java.lang.String nillableValue = null;
      java.lang.String prefix = "";
      java.lang.String namespaceuri = "";
      try {
        while ((!(reader.isStartElement())) && (!(reader.isEndElement()))) reader.next();
        if ((reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"))
            != null) {
          java.lang.String fullTypeName =
              reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
          if (fullTypeName != null) {
            java.lang.String nsPrefix = null;
            if ((fullTypeName.indexOf(":")) > (-1)) {
              nsPrefix = fullTypeName.substring(0, fullTypeName.indexOf(":"));
            }
            nsPrefix = nsPrefix == null ? "" : nsPrefix;
            java.lang.String type = fullTypeName.substring(((fullTypeName.indexOf(":")) + 1));
            if (!("CreateDocumentReq".equals(type))) {
              java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
              return ((hr.ponge.pfa.axis.core.operations.CreateDocumentReq)
                  (hr.ponge.pfa.axis.ExtensionMapper.getTypeObject(nsUri, type, reader)));
            }
          }
        }
        java.util.Vector handledAttributes = new java.util.Vector();
        reader.next();
        while ((!(reader.isStartElement())) && (!(reader.isEndElement()))) reader.next();
        if ((reader.isStartElement())
            && (new javax.xml.namespace.QName(
                    "http://ponge.hr/pfa/axis/core/operations", "document")
                .equals(reader.getName()))) {
          object.setDocument(hr.ponge.pfa.axis.core.Document.Factory.parse(reader));
          reader.next();
        } else {
          throw new org.apache.axis2.databinding.ADBException(
              ("Unexpected subelement " + (reader.getName())));
        }
        while ((!(reader.isStartElement())) && (!(reader.isEndElement()))) reader.next();
        if (reader.isStartElement())
          throw new org.apache.axis2.databinding.ADBException(
              ("Unexpected subelement " + (reader.getName())));

      } catch (javax.xml.stream.XMLStreamException e) {
        throw new java.lang.Exception(e);
      }
      return object;
    }
Пример #10
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 ClassificationReason_type0 parse(javax.xml.stream.XMLStreamReader reader)
        throws java.lang.Exception {
      ClassificationReason_type0 object = new ClassificationReason_type0();

      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()) {

            if (reader.isStartElement() || reader.hasText()) {

              nillableValue =
                  reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "nil");
              if ("true".equals(nillableValue) || "1".equals(nillableValue)) {
                throw new org.apache.axis2.databinding.ADBException(
                    "The element: " + "classificationReason_type0" + "  cannot be null");
              }

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

              object.setClassificationReason_type0(
                  org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));

            } // End of if for expected property start element
            else {
              // A start element we are not expecting indicates an invalid parameter was passed
              throw new org.apache.axis2.databinding.ADBException(
                  "Unexpected subelement " + reader.getName());
            }

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

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

      return object;
    }
    /**
     * 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 EnumMWSAttributeFormCategories_type0 parse(
        javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception {
      EnumMWSAttributeFormCategories_type0 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 =
                  EnumMWSAttributeFormCategories_type0.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 = EnumMWSAttributeFormCategories_type0.Factory.fromString(content, "");
            }

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

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

      return object;
    }
Пример #12
0
  @Override
  public WikiObject read(XMLStreamReader xmlReader) throws XMLStreamException, FilterException {
    WikiObject wikiObject = new WikiObject();

    for (xmlReader.nextTag(); xmlReader.isStartElement(); xmlReader.nextTag()) {
      String elementName = xmlReader.getLocalName();
      if (elementName.equals(XARClassModel.ELEMENT_CLASS)) {
        wikiObject.wikiClass = this.classReader.read(xmlReader);
      } else if (elementName.equals(XARObjectPropertyModel.ELEMENT_PROPERTY)) {
        wikiObject.properties.add(readObjectProperty(xmlReader, wikiObject.wikiClass));
      } else {
        String value = xmlReader.getElementText();

        EventParameter parameter = XARObjectModel.OBJECT_PARAMETERS.get(elementName);

        if (parameter != null) {
          Object wsValue = convert(parameter.type, value);
          if (wsValue != null) {
            wikiObject.parameters.put(parameter.name, wsValue);
          }
        }
      }
    }

    return wikiObject;
  }
Пример #13
0
  @SuppressWarnings("unchecked")
  protected ExtensionElement parseExtensionElement(XMLStreamReader xtr) throws Exception {
    ExtensionElement extensionElement = new ExtensionElement();
    extensionElement.setName(xtr.getLocalName());
    if (StringUtils.isNotEmpty(xtr.getNamespaceURI())) {
      extensionElement.setNamespace(xtr.getNamespaceURI());
    }
    if (StringUtils.isNotEmpty(xtr.getPrefix())) {
      extensionElement.setNamespacePrefix(xtr.getPrefix());
    }

    BpmnXMLUtil.addCustomAttributes(xtr, extensionElement, defaultElementAttributes);

    boolean readyWithExtensionElement = false;
    while (readyWithExtensionElement == false && xtr.hasNext()) {
      xtr.next();
      if (xtr.isCharacters()) {
        if (StringUtils.isNotEmpty(xtr.getText().trim())) {
          extensionElement.setElementText(xtr.getText().trim());
        }
      } else if (xtr.isStartElement()) {
        ExtensionElement childExtensionElement = parseExtensionElement(xtr);
        extensionElement.addChildElement(childExtensionElement);
      } else if (xtr.isEndElement()
          && extensionElement.getName().equalsIgnoreCase(xtr.getLocalName())) {
        readyWithExtensionElement = true;
      }
    }
    return extensionElement;
  }
Пример #14
0
  public void parse(XMLStreamReader xtr, BpmnModel model) throws Exception {

    String id = xtr.getAttributeValue(null, ATTRIBUTE_DI_BPMNELEMENT);
    while (xtr.hasNext()) {
      xtr.next();
      if (xtr.isStartElement() && ELEMENT_DI_BOUNDS.equalsIgnoreCase(xtr.getLocalName())) {
        GraphicInfo graphicInfo = new GraphicInfo();
        graphicInfo.x = Double.valueOf(xtr.getAttributeValue(null, ATTRIBUTE_DI_X)).intValue();
        graphicInfo.y = Double.valueOf(xtr.getAttributeValue(null, ATTRIBUTE_DI_Y)).intValue();
        FlowElement flowElement = model.getMainProcess().getFlowElement(id);
        if (flowElement instanceof Event) {
          graphicInfo.width = 30;
          graphicInfo.height = 30;
        } else {
          graphicInfo.width =
              Double.valueOf(xtr.getAttributeValue(null, ATTRIBUTE_DI_WIDTH)).intValue();
          graphicInfo.height =
              Double.valueOf(xtr.getAttributeValue(null, ATTRIBUTE_DI_HEIGHT)).intValue();
        }

        model.addGraphicInfo(id, graphicInfo);
        break;
      } else if (xtr.isEndElement() && ELEMENT_DI_SHAPE.equalsIgnoreCase(xtr.getLocalName())) {
        break;
      }
    }
  }
Пример #15
0
  public WikiClass read(XMLStreamReader xmlReader) throws XMLStreamException, WikiStreamException {
    WikiClass wikiClass = new WikiClass();

    for (xmlReader.nextTag(); xmlReader.isStartElement(); xmlReader.nextTag()) {
      String elementName = xmlReader.getLocalName();

      if (wikiClass.name == null && XARClassModel.ELEMENT_NAME.equals(elementName)) {
        wikiClass.name = xmlReader.getElementText();
      } else if (XARClassModel.CLASS_PARAMETERS.containsKey(elementName)) {
        String value = xmlReader.getElementText();

        EventParameter parameter = XARClassModel.CLASS_PARAMETERS.get(elementName);

        if (parameter != null) {
          Object wsValue = convert(parameter.type, value);
          if (wsValue != null) {
            wikiClass.parameters.put(parameter.name, wsValue);
          }
        }
      } else {
        wikiClass.addProperty((WikiClassProperty) this.propertyReader.read(xmlReader));
      }
    }

    return wikiClass;
  }
Пример #16
0
  protected void parseChildElements(
      String elementName, BaseElement parentElement, XMLStreamReader xtr) {
    Map<String, BaseChildElementParser> childParsers =
        new HashMap<String, BaseChildElementParser>();
    childParsers.putAll(genericChildParserMap);
    if (childElementParsers != null) {
      childParsers.putAll(childElementParsers);
    }

    boolean readyWithChildElements = false;
    try {
      while (readyWithChildElements == false && xtr.hasNext()) {
        xtr.next();
        if (xtr.isStartElement()) {
          if (childParsers.containsKey(xtr.getLocalName())) {
            childParsers.get(xtr.getLocalName()).parseChildElement(xtr, parentElement);
          }

        } else if (xtr.isEndElement() && elementName.equalsIgnoreCase(xtr.getLocalName())) {
          readyWithChildElements = true;
        }
      }
    } catch (Exception e) {
      LOGGER.log(Level.WARNING, "Error parsing child elements for " + elementName, e);
    }
  }
Пример #17
0
  Pair<Stroke, Continuation<Stroke>> parseStroke(XMLStreamReader in) throws XMLStreamException {
    in.require(START_ELEMENT, null, "Stroke");

    Stroke base = new Stroke();
    Continuation<Stroke> contn = null;

    while (!(in.isEndElement() && in.getLocalName().equals("Stroke"))) {
      in.nextTag();

      if (in.getLocalName().endsWith("Parameter")) {
        contn = parseParameter(contn, in, base);
      } else if (in.getLocalName().equals("GraphicFill")) {
        contn = parseGraphicFill(contn, in, base);
      } else if (in.getLocalName().equals("GraphicStroke")) {
        contn = parseGraphicStroke(contn, in, base);
      } else if (in.isStartElement()) {
        LOG.error("Found unknown element '{}', skipping.", in.getLocalName());
        skipElement(in);
      }
    }

    in.require(END_ELEMENT, null, "Stroke");

    return new Pair<Stroke, Continuation<Stroke>>(base, contn);
  }
Пример #18
0
 /**
  * Post: reader will be unchanged or on success at {@link XMLStreamConstants #END_ELEMENT} of the
  * matching element or at {@link XMLStreamConstants #START_ELEMENT} of the next element if
  * requested.
  *
  * @param reader pointing to the current element.
  * @param elementName of the current element.
  * @param defaultValue to return if the current name was not the one given or the value could not
  *     be parsed as a integer.
  * @param nextElemOnSucces if true the reader will be moved to the next tag if the retrieval was
  *     successful.
  * @return the text of the current element (which should have element name) parsed as a integer.
  * @throws XMLStreamException from {@link XMLStreamReader#getElementText()}.
  */
 public static int getElementTextAsInteger(
     XMLStreamReader reader, QName elementName, int defaultValue, boolean nextElemOnSucces)
     throws XMLStreamException {
   int value = defaultValue;
   if (elementName.equals(reader.getName()) && reader.isStartElement()) {
     String s = reader.getElementText();
     if (s != null) {
       try {
         value = Integer.parseInt(s);
         if (nextElemOnSucces) {
           nextElement(reader);
         }
       } catch (NumberFormatException nfe) {
         LOG.debug(
             reader.getLocation()
                 + ") Value "
                 + s
                 + " in element: "
                 + elementName
                 + " was not a parsable integer, returning integer value: "
                 + defaultValue);
       }
     }
   }
   return value;
 }
Пример #19
0
  public void parse(XMLStreamReader xtr, BpmnModel model) throws Exception {

    String id = xtr.getAttributeValue(null, ATTRIBUTE_DI_BPMNELEMENT);
    GraphicInfo graphicInfo = new GraphicInfo();
    BpmnXMLUtil.addXMLLocation(graphicInfo, xtr);
    while (xtr.hasNext()) {
      xtr.next();
      if (xtr.isStartElement() && ELEMENT_DI_BOUNDS.equalsIgnoreCase(xtr.getLocalName())) {
        graphicInfo.setX(Double.valueOf(xtr.getAttributeValue(null, ATTRIBUTE_DI_X)).intValue());
        graphicInfo.setY(Double.valueOf(xtr.getAttributeValue(null, ATTRIBUTE_DI_Y)).intValue());
        graphicInfo.setWidth(
            Double.valueOf(xtr.getAttributeValue(null, ATTRIBUTE_DI_WIDTH)).intValue());
        graphicInfo.setHeight(
            Double.valueOf(xtr.getAttributeValue(null, ATTRIBUTE_DI_HEIGHT)).intValue());

        String strIsExpanded = xtr.getAttributeValue(null, ATTRIBUTE_DI_IS_EXPANDED);
        if ("true".equalsIgnoreCase(strIsExpanded)) {
          graphicInfo.setExpanded(true);
        }

        model.addGraphicInfo(id, graphicInfo);
        break;
      } else if (xtr.isEndElement() && ELEMENT_DI_SHAPE.equalsIgnoreCase(xtr.getLocalName())) {
        break;
      }
    }
  }
Пример #20
0
  private Collection<Object> processFile(
      Mode mode,
      Set<String> xmlRootElements,
      Map<String, Class<?>> entityClasses,
      XMLStreamReader xmlStreamReader,
      Collection<Object> batch)
      throws Exception {
    do {
      xmlStreamReader.nextTag();
    } while (xmlRootElements.contains(xmlStreamReader.getLocalName()));

    do {
      final Class<?> entityClass = entityClasses.get(xmlStreamReader.getLocalName());
      try {
        final Object entity = extractEntity(xmlStreamReader, entityClass);
        batch.add(entity);

        if (batch.size() == batchSize) {
          batch = processBatch(mode, batch);
        }
      } catch (Throwable e) {
        LOGGER.error("{} Error", mode, e);
      }
    } while (xmlStreamReader.isStartElement() && xmlStreamReader.hasNext());

    return batch;
  }
    /**
     * 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 ReleaseAddressTypeChoice_type0 parse(javax.xml.stream.XMLStreamReader reader)
        throws java.lang.Exception {
      ReleaseAddressTypeChoice_type0 object = new ReleaseAddressTypeChoice_type0();

      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();

        if (reader.isStartElement()
            && new javax.xml.namespace.QName("http://ec2.amazonaws.com/doc/2012-08-15/", "publicIp")
                .equals(reader.getName())) {

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

          object.setPublicIp(
              org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));

          reader.next();

        } // End of if for expected property start element
        else if (reader.isStartElement()
            && new javax.xml.namespace.QName(
                    "http://ec2.amazonaws.com/doc/2012-08-15/", "allocationId")
                .equals(reader.getName())) {

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

          object.setAllocationId(
              org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));

          reader.next();
        } // End of if for expected property start element

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

      return object;
    }
    /**
     * 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 UploadDataResponseType parse(javax.xml.stream.XMLStreamReader reader)
        throws java.lang.Exception {
      UploadDataResponseType object = new UploadDataResponseType();

      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()) {

            if (reader.isStartElement()
                && new javax.xml.namespace.QName(
                        "http://mcs.ucsc.com/SensorService/", "UploadDataResponseType")
                    .equals(reader.getName())) {

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

              object.setUploadDataResponseType(
                  org.apache.axis2.databinding.utils.ConverterUtil.convertToBoolean(content));

            } // End of if for expected property start element
            else {
              // A start element we are not expecting indicates an invalid parameter was passed
              throw new org.apache.axis2.databinding.ADBException(
                  "Unexpected subelement " + reader.getLocalName());
            }

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

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

      return object;
    }
    /**
     * 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 SyncMSISDNChangeResponseE parse(javax.xml.stream.XMLStreamReader reader)
        throws java.lang.Exception {
      SyncMSISDNChangeResponseE object = new SyncMSISDNChangeResponseE();

      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()) {

            if (reader.isStartElement()
                && new javax.xml.namespace.QName(
                        "http://www.csapi.org/schema/parlayx/data/sync/v1_0/local",
                        "syncMSISDNChangeResponse")
                    .equals(reader.getName())) {

              object.setSyncMSISDNChangeResponse(
                  org.csapi.www.schema.parlayx.data.sync.v1_0.local.SyncMSISDNChangeResponse.Factory
                      .parse(reader));

            } // End of if for expected property start element
            else {
              // A start element we are not expecting indicates an invalid parameter was passed
              throw new org.apache.axis2.databinding.ADBException(
                  "Unexpected subelement " + reader.getLocalName());
            }

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

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

      return object;
    }
    /**
     * 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 RevokeSecurityGroupIngressResponse parse(javax.xml.stream.XMLStreamReader reader)
        throws java.lang.Exception {
      RevokeSecurityGroupIngressResponse object = new RevokeSecurityGroupIngressResponse();

      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()) {

            if (reader.isStartElement()
                && new javax.xml.namespace.QName(
                        "http://ec2.amazonaws.com/doc/2010-11-15/",
                        "RevokeSecurityGroupIngressResponse")
                    .equals(reader.getName())) {

              object.setRevokeSecurityGroupIngressResponse(
                  com.amazon.ec2.RevokeSecurityGroupIngressResponseType.Factory.parse(reader));

            } // End of if for expected property start element
            else {
              // A start element we are not expecting indicates an invalid parameter was passed
              throw new org.apache.axis2.databinding.ADBException(
                  "Unexpected subelement " + reader.getLocalName());
            }

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

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

      return object;
    }
Пример #25
0
 /**
  * Parse the <i> elements
  *
  * @return a list of tokens from the dictionary's entry
  * @throws javax.xml.stream.XMLStreamException
  */
 EntryToken procIdentity() throws XMLStreamException {
   ArrayList<Integer> both_sides = new ArrayList<Integer>();
   if (!(reader.isStartElement() && reader.isEndElement())) {
     // not an emoty node
   }
   String name = "";
   reader.next();
   while (true) {
     if (reader.isEndElement() && reader.getLocalName().equals(COMPILER_IDENTITY_ELEM)) {
       break;
     }
     if (reader.isStartElement()) {
       name = reader.getLocalName();
       readString(both_sides, name);
       reader.next();
     } else if (reader.isCharacters()) {
       readString(both_sides, "");
       reader.next();
     } else if (reader.isEndElement()) {
       reader.next();
     } else {
       throw new RuntimeException(
           "Error ("
               + reader.getLocation().getLineNumber()
               + ","
               + reader.getLocation().getColumnNumber()
               + "): unexpected type of event.");
     }
   }
   /*
    * while (true) {
    * reader.next();
    * int type = reader.getEventType();
    * if (type == XMLStreamConstants.END_ELEMENT || type == XMLStreamConstants.START_ELEMENT) {
    * name = reader.getLocalName();
    * }
    * if (name.equals(COMPILER_IDENTITY_ELEM)) {
    * break;
    * }
    * readString(both_sides, name);
    * }
    */
   EntryToken e = new EntryToken();
   e.setSingleTransduction(both_sides, both_sides);
   return e;
 }
  public void parse() {
    String bundlePath = null;
    if (bundle.getBundleFile() != null)
      bundlePath = FilenameNormalization.normalize(bundle.getBundleFile().getAbsolutePath());

    try {
      while (reader.hasNext()) {
        final int next = reader.next();
        if (next != XMLStreamConstants.START_ELEMENT) continue;

        final String tagName = reader.getName().getLocalPart();
        if (tagName.equals(TAG_LIBRARY)) {
          if (reader.isStartElement()) {
            library = new BundleLibrary(reader.getAttributeValue(null, "name"));
            bundle.addLibrary(library);
          } else if (reader.isEndElement()) {

            library = null;
          }
        } else if (library != null) {
          final String containerType = tagName;
          final String categoryType = reader.getAttributeValue(null, "type");
          BundleContainer container =
              (BundleContainer) library.getContainer(IBundleContainer.Type.toType(containerType));

          if (container == null) {
            container =
                (BundleContainer) library.addContainer(IBundleContainer.Type.toType(containerType));
          }

          IBundleCategory category =
              container.addCategory(IBundleCategory.Type.toType(categoryType));

          category.addFile(bundlePath, reader.getAttributeValue(null, "path"));
        } else if (tagName.equals("versions")) {
          version = (BundleVersion) bundle.getVersion();
        } else if (tagName.equals("bundle")) {
          version.setBundleVersion(reader.getAttributeValue(null, "version"));
        } else if (tagName.equals("randori")) {
          version.setRandoriVersion(reader.getAttributeValue(null, "version"));
          version.setRandoriBuild(reader.getAttributeValue(null, "build"));
          version.setRandoriMinSupportedVersion(
              reader.getAttributeValue(null, "minimumSupportedVersion"));
        } else if (tagName.equals("compiler")) {
          version.setCompilerName(reader.getAttributeValue(null, "name"));
          version.setCompilerVersion(reader.getAttributeValue(null, "version"));
        } else if (tagName.equals("version")) {

        }
      }
    } catch (XMLStreamException e) {
      File bundleFile = bundle.getBundleFile();
      final String file =
          (bundleFile != null) ? FilenameNormalization.normalize(bundleFile.getAbsolutePath()) : "";
      bundle.addProblem(
          new FileInLibraryIOProblem(BundleReader.MANIFEST_XML, file, e.getLocalizedMessage()));
    }
  }
Пример #27
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 FaultInstanceOut parse(javax.xml.stream.XMLStreamReader reader)
        throws java.lang.Exception {
      FaultInstanceOut object = new FaultInstanceOut();

      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()) {

            if (reader.isStartElement()
                && new javax.xml.namespace.QName(
                        "http://wso2.org/bps/management/schema", "faultInstanceOut")
                    .equals(reader.getName())) {

              object.setFaultInstanceOut(
                  org.wso2.bps.management.schema.InstanceInfoType.Factory.parse(reader));

            } // End of if for expected property start element
            else {
              // A start element we are not expecting indicates an invalid parameter was passed
              throw new org.apache.axis2.databinding.ADBException(
                  "Unexpected subelement " + reader.getLocalName());
            }

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

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

      return object;
    }
Пример #28
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 ReferenceParameters parse(javax.xml.stream.XMLStreamReader reader)
        throws java.lang.Exception {
      ReferenceParameters object = new ReferenceParameters();

      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()) {

            if (reader.isStartElement()
                && new javax.xml.namespace.QName(
                        "http://www.w3.org/2005/08/addressing", "ReferenceParameters")
                    .equals(reader.getName())) {

              object.setReferenceParameters(
                  org.w3.www._2005._08.addressing.ReferenceParametersType.Factory.parse(reader));

            } // End of if for expected property start element
            else {
              // A start element we are not expecting indicates an invalid parameter was passed
              throw new org.apache.axis2.databinding.ADBException(
                  "Unexpected subelement " + reader.getLocalName());
            }

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

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

      return object;
    }
    /**
     * 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 NamedIDHierarchyE parse(javax.xml.stream.XMLStreamReader reader)
        throws java.lang.Exception {
      NamedIDHierarchyE object = new NamedIDHierarchyE();

      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()) {

            if (reader.isStartElement()
                && new javax.xml.namespace.QName(
                        "urn:base.ws.rightnow.com/v1_2", "NamedIDHierarchy")
                    .equals(reader.getName())) {

              object.setNamedIDHierarchy(
                  com.rightnow.ws.base.NamedIDHierarchy.Factory.parse(reader));

            } // End of if for expected property start element
            else {
              // A start element we are not expecting indicates an invalid parameter was passed
              throw new org.apache.axis2.databinding.ADBException(
                  "Unexpected subelement " + reader.getLocalName());
            }

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

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

      return object;
    }
Пример #30
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 RequestSOAPHeaderE parse(javax.xml.stream.XMLStreamReader reader)
        throws java.lang.Exception {
      RequestSOAPHeaderE object = new RequestSOAPHeaderE();

      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()) {

            if (reader.isStartElement()
                && new javax.xml.namespace.QName(
                        "http://www.huawei.com.cn/schema/common/v2_1", "RequestSOAPHeader")
                    .equals(reader.getName())) {

              object.setRequestSOAPHeader(
                  vms.cn.com.huawei.www.schema.common.v2_1.RequestSOAPHeader.Factory.parse(reader));

            } // End of if for expected property start element
            else {
              // A start element we are not expecting indicates an invalid parameter was passed
              throw new org.apache.axis2.databinding.ADBException(
                  "Unexpected subelement " + reader.getLocalName());
            }

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

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

      return object;
    }