Package com.skaringa.javaxml.serializers

Examples of com.skaringa.javaxml.serializers.SerializerRegistry


      throw new SerializerException(
        "wrong context: obj needs to be of type Class, but is: "
          + obj.getClass().getName());
    }

    SerializerRegistry reg = SerializerRegistry.getInstance();

    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);
    Set usedClasses = new HashSet();

    Iterator it = _dependendClasses.iterator();
    while (it.hasNext()) {
      Class aClass = (Class) it.next();
      ser = reg.getSerializer(aClass);
      ser.addUsedClasses(aClass, usedClasses);
    }

    documentUsedClasses(usedClasses, output);
View Full Code Here


  private void documentUsedClasses(
    Collection theClasses,
    DocumentOutputHandlerInterface output)
    throws SerializerException {

    SerializerRegistry reg = SerializerRegistry.getInstance();
    Iterator it = theClasses.iterator();
    while (it.hasNext()) {
      Class type = (Class) it.next();
      ComponentSerializer ser = reg.getSerializer(type);

      ser.writeXMLTypeDefinition(type, getPropertyMap(), output);
    }
  }
View Full Code Here

TOP

Related Classes of com.skaringa.javaxml.serializers.SerializerRegistry

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.