Package com.skaringa.javaxml.handler

Examples of com.skaringa.javaxml.handler.AttrImpl


  /**
   * @see DocumentOutputHandlerInterface#startElement(String)
   */
  public void startElement(String name) {

    Attributes attrs = new AttrImpl();
    startElement(name, attrs);
  }
View Full Code Here


  /**
   * @see DocumentOutputHandlerInterface#startElement(String)
   */
  public void startElement(String name) throws SerializerException {
    Attributes attrs = new AttrImpl();
    startElement(name, attrs);
  }
View Full Code Here

    ComponentSerializer ser = reg.getSerializer(type);

    output.startDocument();
    output.startElement("xsd:schema");

    AttrImpl attr = new AttrImpl();
    attr.addAttribute("name", ser.getXMLTypeName());
    attr.addAttribute("type", ser.getXMLTypeName());
    attr.addAttribute("nillable", "true");
    output.startElement("xsd:element", attr);
    output.endElement("xsd:element");

    // get and document all used classes
    _dependendClasses.add(type);
View Full Code Here

    boolean omitId = PropertyHelper.parseBoolean(propertyMap,
        PropertyKeys.OMIT_ID);

    boolean isIdRef = false;

    AttrImpl attrs = new AttrImpl();
    if (obj != null) {
      if (omitId) {
        // need to call always writeReplace
        // if object ids and references can't be written
        obj = writeReplaceObject(obj);
      } else {
        // check if this object was already serialized
        Integer id = (Integer) objectIdMap.get(obj);
        if (id != null) {
          // yes, provide only the reference of the object
          // that was already serialized
          isIdRef = true;
        } else {
          // this is the first time this objects is going to be serialized
          // provide an id for this object
          id = new Integer(objectIdMap.size());
          objectIdMap.put(obj, id);
          obj = writeReplaceObject(obj);
        }

        attrs.addAttribute(isIdRef ? "reference" : "id", new StringBuffer("i")
            .append(id).toString());
      }
    }
    if (!omitXsi) {
      attrs.addAttribute(NSConstants.SCHEMA_INSTANCE_NS_NAME,
          NSConstants.SCHEMA_INSTANCE_NS_PREFIX, "type", _xmlTypeName);
    }
    if (obj == null && !omitNil) {
      attrs.addAttribute(NSConstants.SCHEMA_INSTANCE_NS_NAME,
          NSConstants.SCHEMA_INSTANCE_NS_PREFIX, "nil", "true");
    }

    output.startElement(name, attrs);
View Full Code Here

   *      DocumentOutputHandlerInterface)
   */
  public void writeXMLTypeDefinition(Class type, Map propertyMap,
      DocumentOutputHandlerInterface output) throws SerializerException {

    AttrImpl attrs = new AttrImpl();
    attrs.addAttribute("name", _xmlTypeName);
    output.startElement("xsd:complexType", attrs);
    processExtensionType(type, propertyMap, output);
    output.endElement("xsd:complexType");
  }
View Full Code Here

      output.startElement("xsd:complexContent");

      ComponentSerializer ser = SerializerRegistry.getInstance().getSerializer(
          superclass);

      AttrImpl attrs = new AttrImpl();
      attrs.addAttribute("base", ser.getXMLTypeName());
      output.startElement("xsd:extension", attrs);

      processFieldTypes(type, propertyMap, output);

      output.endElement("xsd:extension");
      output.endElement("xsd:complexContent");
    } else {
      // it must be java.lang.Object!
      // provide the attributes id and reference
      AttrImpl attrs = new AttrImpl();
      attrs.addAttribute("name", "id");
      attrs.addAttribute("type", "xsd:ID");
      output.startElement("xsd:attribute", attrs);
      output.endElement("xsd:attribute");

      attrs = new AttrImpl();
      attrs.addAttribute("name", "reference");
      attrs.addAttribute("type", "xsd:IDREF");
      output.startElement("xsd:attribute", attrs);
      output.endElement("xsd:attribute");
    }
  }
View Full Code Here

        // serialize member
        ComponentSerializer ser = SerializerRegistry.getInstance()
            .getSerializer(fieldType);

        AttrImpl attrs = new AttrImpl();
        attrs.addAttribute("name", fieldName);
        attrs.addAttribute("type", ser.getXMLTypeName());
        attrs.addAttribute("nillable", "true");
        attrs.addAttribute("minOccurs", "0");

        output.startElement("xsd:element", attrs);
        output.endElement("xsd:element");
      }
View Full Code Here

    boolean omitXsi =
      PropertyHelper.parseBoolean(propertyMap, PropertyKeys.OMIT_XSI_TYPE);
    boolean omitNil =
      PropertyHelper.parseBoolean(propertyMap, PropertyKeys.OMIT_XSI_NIL);

    AttrImpl attrs = new AttrImpl();
    if (!omitXsi) {
      attrs.addAttribute(
        NSConstants.SCHEMA_INSTANCE_NS_NAME,
        NSConstants.SCHEMA_INSTANCE_NS_PREFIX,
        "type",
        type);
    }
    if (obj == null && !omitNil) {
      attrs.addAttribute(
        NSConstants.SCHEMA_INSTANCE_NS_NAME,
        NSConstants.SCHEMA_INSTANCE_NS_PREFIX,
        "nil",
        "true");
    }
View Full Code Here

    String componentElementName,
    Class componentElementType,
    DocumentOutputHandlerInterface output)
    throws SerializerException {

    AttrImpl attrs = new AttrImpl();
    attrs.addAttribute("name", getXMLTypeName());
    output.startElement("xsd:complexType", attrs);

    output.startElement("xsd:sequence");

    attrs = new AttrImpl();
    attrs.addAttribute("name", componentElementName);
    attrs.addAttribute("minOccurs", "0");
    attrs.addAttribute("maxOccurs", "unbounded");

    if (componentElementType == null) {
      attrs.addAttribute("type", "xsd:anyType");
    }
    else {
      ComponentSerializer ser =
        SerializerRegistry.getInstance().getSerializer(componentElementType);
      attrs.addAttribute("type", ser.getXMLTypeName());
    }

    attrs.addAttribute("nillable", "true");

    output.startElement("xsd:element", attrs);
    output.endElement("xsd:element");

    output.endElement("xsd:sequence");
View Full Code Here

   */
  protected final void writeXMLExtensionDef(
    DocumentOutputHandlerInterface output,
    String baseType)
    throws SerializerException {
    AttrImpl attr = new AttrImpl();
    attr.addAttribute("name", getXMLTypeName());
    output.startElement("xsd:complexType", attr);

    output.startElement("xsd:complexContent");

    attr = new AttrImpl();
    attr.addAttribute("base", baseType);
    output.startElement("xsd:extension", attr);

    output.endElement("xsd:extension");

    output.endElement("xsd:complexContent");
View Full Code Here

TOP

Related Classes of com.skaringa.javaxml.handler.AttrImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.