Package javax.xml.bind

Examples of javax.xml.bind.JAXBException


    throws JAXBException
  {
    super(context, accessor);
   
    if (accessor.getAnnotation(XmlList.class) != null)
      throw new JAXBException(L.l("@XmlList cannot be used with @XmlElements"));

    XmlElements elements = accessor.getAnnotation(XmlElements.class);

    if (elements.value().length == 0) {
      // XXX special case : equivalent to unannotated
    }

    if (elements.value().length == 1) {
      // XXX special case : equivalent to @XmlElement
    }

    _qnameMap = new LinkedHashMap<Class,QName>();
    Map<QName,Property> qnameToPropertyMap =
      new LinkedHashMap<QName,Property>();
    Map<Class,Property> classToPropertyMap =
      new LinkedHashMap<Class,Property>();

    for (XmlElement element : elements.value()) {
      if (XmlElement.DEFAULT.class.equals(element.type()))
        throw new JAXBException(L.l("@XmlElement annotations in @XmlElements must specify a type"));

      QName qname = qnameFromXmlElement(element);
      Property property = _context.createProperty(element.type());

      qnameToPropertyMap.put(qname, property);
View Full Code Here


  public void putQNames(Map<QName,XmlMapping> map)
    throws JAXBException
  {
    for (QName qname : _qnameMap.values()) {
      if (map.containsKey(qname))
        throw new JAXBException(L.l("Class contains two elements with the same QName {0}", qname));

      map.put(qname, this);
    }
  }
View Full Code Here

      // NOTE!!! The Xerces StAX requires the prefixes to be interned for
      // some reason...
      String namespace = context.getNamespaceURI(prefix.intern());

      if (namespace == null)
        throw new JAXBException(L.l("No known namespace for prefix '{0}'", prefix));

      String localName = text.substring(colon + 1);

      if ("".equals(localName))
        throw new JAXBException(L.l("Malformed QName: empty localName"));

      return new QName(namespace, localName, prefix);
    }
  }
View Full Code Here

      if (xmlSchemaType == null) {
        xmlSchemaType = _accessor.getPackageAnnotation(XmlSchemaType.class);

        if (xmlSchemaType != null) {
          if (XmlSchemaType.DEFAULT.class.equals(xmlSchemaType.type()))
            throw new JAXBException(L.l("@XmlSchemaType with name {0} on package {1} does not specify type", xmlSchemaType.name(), _accessor.getPackage().getName()));

          if (! _accessor.getType().equals(xmlSchemaType.type()))
            xmlSchemaType = null;
        }
      }

      if (xmlSchemaType == null) {
        XmlSchemaTypes xmlSchemaTypes =
          _accessor.getPackageAnnotation(XmlSchemaTypes.class);

        if (xmlSchemaTypes != null) {
          XmlSchemaType[] array = xmlSchemaTypes.value();

          for (int i = 0; i < array.length; i++) {
            xmlSchemaType = array[i];

            if (XmlSchemaType.DEFAULT.class.equals(xmlSchemaType.type()))
              throw new JAXBException(L.l("@XmlSchemaType with name {0} on package {1} does not specify type", xmlSchemaType.name(), _accessor.getPackage().getName()));

            if (_accessor.getType().equals(xmlSchemaType.type()))
              break;

            xmlSchemaType = null;
View Full Code Here

    QName name = JAXBUtil.qnameFromNode(node.getNode());

    ClassSkeleton skeleton = _context.getRootElement(name);

    if (skeleton == null)
      throw new JAXBException(L.l("No root found for element {0}", name));

    return skeleton.bindFrom(binder, existing, node);
  }
View Full Code Here

    if (skeleton == null) {
      Property property = _context.getSimpleTypeProperty(obj.getClass());

      if (property == null)
        throw new JAXBException(L.l("Unknown class {0}", obj.getClass()));

      property.write(m, out, obj, namer); // XXX attributes
    }
    else
      skeleton.write(m, out, obj, null, attributes);
View Full Code Here

    throws IOException, JAXBException
  {
    ClassSkeleton skeleton = _context.findSkeletonForObject(obj);

    if (skeleton == null)
      throw new JAXBException(L.l("Unknown class {0}", obj.getClass()));

    return skeleton.bindTo(binder, node, obj, namer, attributes);
  }
View Full Code Here

      // passing a null makes invoke think that it is receiving a null instance
      // of an Object[].  need an explicit array with a null.
      return (JAXBElement<C>) _createMethod.invoke(_factory, SINGLE_NULL_ARG);
    }
    catch (Exception e) {
      throw new JAXBException(e);
    }
  }
View Full Code Here

    }
  }

  public Object get(Object o) throws JAXBException
  {
    throw new JAXBException(L.l("cannot invoke ArrayComponentAccessor.get()"));
  }
View Full Code Here

    throw new JAXBException(L.l("cannot invoke ArrayComponentAccessor.get()"));
  }

  public void set(Object o, Object value) throws JAXBException
  {
    throw new JAXBException(L.l("cannot invoke ArrayComponentAccessor.set()"));
  }
View Full Code Here

TOP

Related Classes of javax.xml.bind.JAXBException

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.