~ubuntu-branches/ubuntu/quantal/simple-xml/quantal

« back to all changes in this revision

Viewing changes to src/org/simpleframework/xml/core/Composite.java

  • Committer: Bazaar Package Importer
  • Author(s): Sylvestre Ledru, Fabian Köster
  • Date: 2010-03-05 19:44:34 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100305194434-d9mwhyioc9npo9it
Tags: 2.3.2-1
* Standards-Version updated to version 3.8.4

[ Fabian Köster ]
* New upstream release
* Correct license information in debian/pom.xml
* Exclude generated Javadoc from orig-tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
509
509
      Label label = map.take(name);
510
510
      
511
511
      if(label == null) {
512
 
         if(map.isStrict() && revision.isEqual()) {              
513
 
            throw new AttributeException("Attribute '%s' does not exist at %s", name, line);
 
512
         if(map.isStrict(context) && revision.isEqual()) {              
 
513
            throw new AttributeException("Attribute '%s' does not have a match at %s", name, line);
514
514
         }            
515
515
      } else {
516
516
         read(node, source, label);
541
541
      if(label == null) {
542
542
         Position line = node.getPosition();
543
543
         
544
 
         if(map.isStrict() && revision.isEqual()) {              
545
 
            throw new ElementException("Element '%s' does not exist at %s", name, line);
 
544
         if(map.isStrict(context) && revision.isEqual()) {              
 
545
            throw new ElementException("Element '%s' does not have a match at %s", name, line);
546
546
         } else {
547
547
            node.skip();                 
548
548
         }
570
570
    
571
571
      if(object == null) {     
572
572
         Position line = node.getPosition();
573
 
         Class type = source.getClass();
 
573
         Class expect = type.getType();
574
574
         
 
575
         if(source != null) {
 
576
            expect = source.getClass();
 
577
         }
575
578
         if(label.isRequired() && revision.isEqual()) {              
576
 
            throw new ValueRequiredException("Empty value for %s in %s at %s", label, type, line);
 
579
            throw new ValueRequiredException("Empty value for %s in %s at %s", label, expect, line);
577
580
         }
578
581
      } else {
579
582
         if(object != label.getEmpty(context)) {      
800
803
      Label label = map.take(name);
801
804
      
802
805
      if(label == null) {
803
 
         if(map.isStrict() && revision.isEqual()) {              
 
806
         if(map.isStrict(context) && revision.isEqual()) {              
804
807
            throw new AttributeException("Attribute '%s' does not exist at %s", name, line);
805
808
         }            
806
809
      } else {
830
833
      if(label == null) {
831
834
         Position line = node.getPosition();
832
835
         
833
 
         if(map.isStrict() && revision.isEqual()) {              
 
836
         if(map.isStrict(context) && revision.isEqual()) {              
834
837
            throw new ElementException("Element '%s' does not exist at %s", name, line);
835
838
         } else {
836
839
            node.skip();                 
1120
1123
    * done using the <code>Converter</code> acquired from the contact
1121
1124
    * label. If the type of the contact value is not of the same
1122
1125
    * type as the XML schema class a "class" attribute is appended.
 
1126
    * <p>
 
1127
    * If the element being written is inline, then this will not 
 
1128
    * check to see if there is a "class" attribute specifying the
 
1129
    * name of the class. This is because inline elements do not have
 
1130
    * an outer class and thus could never have an override.
1123
1131
    * 
1124
1132
    * @param value this is the value to be set as an element
1125
1133
    * @param node this is the XML element to write the element to
1134
1142
         Type contact = label.getContact(); 
1135
1143
         Class type = contact.getType();
1136
1144
 
 
1145
         if(!label.isInline()) {
 
1146
            writeNamespaces(next, type, label);
 
1147
         }
1137
1148
         if(label.isInline() || !isOverridden(next, value, contact)) {
1138
1149
            Converter convert = label.getConverter(context);
1139
1150
            boolean data = label.isData();
1140
1151
            
1141
1152
            next.setData(data);
1142
 
            writeNamespaces(next, type, label);
1143
1153
            writeElement(next, value, convert);
1144
1154
         }
1145
1155
      }