コード例 #1
0
    public SOAPHandler onStartChild(
        String namespace,
        String localName,
        String prefix,
        Attributes attributes,
        DeserializationContext context)
        throws SAXException {
      QName typeQName = context.getTypeFromAttributes(namespace, localName, attributes);
      Deserializer dser = context.getDeserializerForType(typeQName);

      if (dser == null) dser = new DeserializerImpl();

      SOAPConstants soapConstants = context.getSOAPConstants();
      String href = attributes.getValue(soapConstants.getAttrHref());

      if (href != null) {
        Object ref = context.getObjectByRef(href);

        ItemHandler handler = new ItemHandler(md);

        addChildDeserializer(handler);

        return handler;
      }

      addChildDeserializer(dser);
      return (SOAPHandler) dser;
    }
コード例 #2
0
  /**
   * onStartChild is called on each child element.
   *
   * @param namespace is the namespace of the child element
   * @param localName is the local name of the child element
   * @param prefix is the prefix used on the name of the child element
   * @param attributes are the attributes of the child element
   * @param context is the deserialization context.
   * @return is a Deserializer to use to deserialize a child (must be a derived class of
   *     SOAPHandler) or null if no deserialization should be performed.
   */
  public SOAPHandler onStartChild(
      String namespace,
      String localName,
      String prefix,
      Attributes attributes,
      DeserializationContext context)
      throws SAXException {

    if (log.isDebugEnabled()) {
      log.debug("Enter: MapDeserializer::onStartChild()");
    }

    if (localName.equals("item")) {

      // liferay - changes started
      // check if 'href' attribute is present. if so, process it
      // with BigItemHandler (see bellow)
      SOAPConstants soapConstants = context.getSOAPConstants();
      String href = attributes.getValue(soapConstants.getAttrHref());

      if (href != null) {
        Object ref = context.getObjectByRef(href);

        BigItemHandler handler = new BigItemHandler(this);

        addChildDeserializer(handler);

        return handler;
      }
      // liferay - end of changes

      ItemHandler handler = new ItemHandler(this);

      // This item must be complete before we're complete...
      addChildDeserializer(handler);

      if (log.isDebugEnabled()) {
        log.debug("Exit: MapDeserializer::onStartChild()");
      }

      return handler;
    }

    return this;
  }