001: /**
002: * Redistribution and use of this software and associated documentation
003: * ("Software"), with or without modification, are permitted provided
004: * that the following conditions are met:
005: *
006: * 1. Redistributions of source code must retain copyright
007: * statements and notices. Redistributions must also contain a
008: * copy of this document.
009: *
010: * 2. Redistributions in binary form must reproduce the
011: * above copyright notice, this list of conditions and the
012: * following disclaimer in the documentation and/or other
013: * materials provided with the distribution.
014: *
015: * 3. The name "Exolab" must not be used to endorse or promote
016: * products derived from this Software without prior written
017: * permission of Intalio, Inc. For written permission,
018: * please contact info@exolab.org.
019: *
020: * 4. Products derived from this Software may not be called "Exolab"
021: * nor may "Exolab" appear in their names without prior written
022: * permission of Intalio, Inc. Exolab is a registered
023: * trademark of Intalio, Inc.
024: *
025: * 5. Due credit should be given to the Exolab Project
026: * (http://www.exolab.org/).
027: *
028: * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS
029: * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
030: * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
031: * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
032: * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
033: * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
034: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
035: * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
036: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
037: * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
038: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
039: * OF THE POSSIBILITY OF SUCH DAMAGE.
040: *
041: * Copyright 1999-2003 (C) Intalio Inc. All Rights Reserved.
042: *
043: * $Id: ElementDecl.java 6993 2007-05-14 09:22:37Z wguttmn $
044: */package org.exolab.castor.xml.schema;
045:
046: import org.exolab.castor.xml.*;
047: import org.exolab.castor.xml.validators.ValidationUtils;
048:
049: import java.util.Enumeration;
050: import java.util.Vector;
051:
052: /**
053: * An XML Schema ElementDecl
054: * @author <a href="mailto:kvisco@intalio.com">Keith Visco</a>
055: * @version $Revision: 6993 $ $Date: 2006-04-25 15:08:23 -0600 (Tue, 25 Apr 2006) $
056: **/
057: public class ElementDecl extends Particle implements Referable {
058: /** SerialVersionUID */
059: private static final long serialVersionUID = -7804351635137964219L;
060:
061: //-------------------/
062: //- Class Variables -/
063: //-------------------/
064:
065: /**
066: * Error message for a null argument
067: **/
068: private static String NULL_ARGUMENT = "A null argument was passed to the constructor of "
069: + ElementDecl.class.getName();
070:
071: //--------------------/
072: //- Member Variables -/
073: //--------------------/
074:
075: /**
076: * The block attribute for this element definition.
077: **/
078: private BlockList _block = null;
079:
080: /**
081: * collection of Identity Constraints
082: **/
083: private Vector _constraints = null;
084:
085: /**
086: * The default value for this element definition. Only
087: * useful for simpleContent.
088: **/
089: private String _default = null;
090:
091: /**
092: * The name of a reference to a top-level element declaration
093: **/
094: private String _elementRefName = null;
095:
096: /**
097: * The top-level element declaration this element reference points to
098: **/
099: private ElementDecl _referencedElement = null;
100:
101: /**
102: * The final value for this element definition.
103: **/
104: private FinalList _final = null;
105:
106: /**
107: * The fixed value for this element definition. Only
108: * used for simpleContent.
109: **/
110: private String _fixed = null;
111:
112: /**
113: * The form type for this element definition.
114: * Specifies whether names should be qualified or unqualified.
115: * Uses the default Form from the parent Schema if unspecified.
116: **/
117: private Form _form = null;
118:
119: /**
120: * The unique ID for this element definition (optional).
121: **/
122: private String _id = null;
123:
124: /**
125: * Flag indicating whether or not this Element declaration is
126: * abstract
127: **/
128: private boolean _isAbstract = false;
129:
130: /**
131: * The element name
132: **/
133: private String _name = null;
134:
135: /**
136: * Flag indicating whether or not the element value may be null.
137: **/
138: private boolean _nillable = false;
139:
140: /**
141: * The parent for this ElementDecl
142: **/
143: private Structure _parent = null;
144:
145: /**
146: * The parent schema that this element declaration belongs to
147: **/
148: private Schema _schema = null;
149:
150: /**
151: * The substitutionGroup for this element definition.
152: **/
153: private String _substitutionGroup = null;
154:
155: /**
156: * The XMLType for this element declaration
157: **/
158: private XMLType _xmlType = null;
159:
160: /**
161: * Creates a new default element definition
162: * @param schema the XML Schema to which this element declaration
163: * belongs
164: * <BR />This element definition will not be valid until a name has
165: * been set
166: **/
167: public ElementDecl(Schema schema) {
168: this (schema, null);
169: } //-- ElementDecl
170:
171: /**
172: * Creates a new default element definition
173: * @param schema the XML Schema to which this Element Declaration
174: * belongs
175: * @param name the name of the Element being declared
176: **/
177: public ElementDecl(Schema schema, String name) {
178: super ();
179: setName(name);
180: if (schema == null) {
181: String err = NULL_ARGUMENT + "; 'schema' must not be null.";
182: throw new IllegalArgumentException(err);
183: }
184: setSchema(schema);
185: _constraints = new Vector(3);
186: } //-- ElementDecl
187:
188: /**
189: * Adds the given IdentityConstraint to this element definition.
190: *
191: * @param constraint the IdentityConstraint to add.
192: **/
193: public void addIdentityConstraint(IdentityConstraint constraint) {
194: if (constraint == null)
195: return;
196: _constraints.addElement(constraint);
197: } //-- addIdentityConstraint
198:
199: /**
200: * Returns the value of the 'block' attribute for this element
201: *
202: * @return the value of the block attribute.
203: **/
204: public BlockList getBlock() {
205: return _block;
206: } //-- getBlock
207:
208: /**
209: * Returns the default value of this element definition.
210: *
211: * @return the default value of this element definition,
212: * or null if no default was specified.
213: **/
214: public String getDefaultValue() {
215: if (isReference()) {
216: ElementDecl elem = getReference();
217: if (elem != null)
218: return elem.getDefaultValue();
219: }
220: return _default;
221: } //-- getDefaultValue
222:
223: /**
224: * Returns the value of the 'final' attribute for this element
225: * definition.
226: *
227: * @return the FinalList for this element definition.
228: **/
229: public FinalList getFinal() {
230: return _final;
231: } //-- getFinal
232:
233: /**
234: * Returns the fixed value of this element definition.
235: *
236: * @return the fixed value of this element definition,
237: * or null if no default was specified.
238: */
239: public String getFixedValue() {
240: if (isReference()) {
241: ElementDecl elem = getReference();
242: if (elem != null)
243: return elem.getFixedValue();
244: }
245: return _fixed;
246: } //-- getFixedValue
247:
248: /**
249: * Returns the Form for this element definition. The Form object species
250: * whether or not names are qualified or unqualified in the scope of
251: * this element definition. If null, the Form should be obtained from the
252: * parent Schema.
253: *
254: * @return the Form for this element definition, or null if not set.
255: **/
256: public Form getForm() {
257: return _form;
258: } //-- getForm
259:
260: /**
261: * Returns the 'id' for this element definition.
262: *
263: * @return the 'id' for this element definition.
264: **/
265: public String getId() {
266: return _id;
267: } //-- getId
268:
269: /**
270: * Returns an Enumeration of IdentityConstraint objects contained within
271: * this element definition.
272: *
273: * @return an Enumeration of IdentityConstraint objects contained within
274: * this element definition.
275: **/
276: public Enumeration getIdentityConstraints() {
277: return _constraints.elements();
278: } //-- getIdentityConstraints
279:
280: /**
281: * Returns the name of this Element declaration. The name of the
282: * referenced element is returned if the 'ref' attribute was used.
283: * The name returned will be an NCName (no namespace prefix will
284: * be included with the name).
285: *
286: * @return the name of this element declaration
287: */
288: public String getName() {
289: return getName(false);
290: } //-- getName
291:
292: /**
293: * Returns the name of this Element declaration. The name
294: * returned, if not null, will be an NCName.
295: *
296: * @param ignoreRef if false the name of the referenced
297: * element (if specified) is returned, otherwise the
298: * localname (may be null).
299: *
300: * @return the name of this element declaration
301: **/
302: public String getName(boolean ignoreRef) {
303: if (isReference() && ignoreRef == false) {
304: String localName = _elementRefName;
305: //-- check for namespace prefix
306: int idx = localName.indexOf(':');
307: if (idx > 0) {
308: localName = localName.substring(idx + 1);
309: }
310: return localName;
311: }
312: return _name;
313: } //-- getName
314:
315: /**
316: * Returns the parent of this ElementDecl, this value may be null if
317: * no parent has been set.
318: *
319: * @return the parent Structure of this ElementDecl
320: **/
321: public Structure getParent() {
322: return _parent;
323: } //-- getParent
324:
325: /**
326: * Returns the XMLType (ComplexType or SimpleType) of this ElementDecl.
327: * @return the XMLType of this ElementDecl
328: **/
329: public XMLType getType() {
330:
331: XMLType result = null;
332:
333: if (isReference()) {
334: ElementDecl element = getReference();
335: if (element != null) {
336: return element.getType();
337: }
338: return null;
339: }
340:
341: if (_xmlType == null)
342: return null;
343: //1--Anonymous types
344: if (_xmlType.getName() == null)
345: return _xmlType.getType();
346: //--we look in the parent schema if we have redefinitions of types.
347: result = _xmlType.getType();
348:
349: //-- the current XML schema might have a MasterSchema where all the
350: //-- type definitions have a higher priority [this is useful when
351: //-- resolving redefined types for instance].
352: if (result != null) {
353: Schema tempSchema = result.getSchema().getMasterSchema();
354: if (tempSchema != null) {
355: XMLType tempType = tempSchema.getType(result.getName());
356: if (tempType != null) {
357: result = tempType;
358: }
359: }
360: }
361: return result;
362: } //-- getXMLType
363:
364: /**
365: * Returns the ElementDecl that this element definition references.
366: * This will return null if this element definition does not reference
367: * a different element definition.
368: * @return the ElementDecl that this element definition references
369: **/
370: public ElementDecl getReference() {
371: if (_referencedElement != null) {
372: return _referencedElement;
373: }
374:
375: ElementDecl result = null;
376: if (_elementRefName != null) {
377: result = _schema.getElementDecl(_elementRefName);
378: if (result == null) {
379: String err = "Unable to find element referenced :\" ";
380: err += getName();
381: err += "\"";
382: throw new IllegalStateException(err);
383: }
384: _referencedElement = result;
385: }
386: return result;
387: } //-- getReference
388:
389: /**
390: * Returns the actual reference name of this AttributeDecl, or null
391: * if this AttributeDecl is not a reference. The name returned, if not
392: * null, will be a QName, possibly containing the namespace prefix.
393: *
394: * @return the reference name
395: */
396: public String getReferenceName() {
397: return _elementRefName;
398: } //-- getReference
399:
400: /**
401: * Returns the Id used to Refer to this Object
402: *
403: * @return the Id used to Refer to this Object
404: * @see Referable
405: **/
406: public String getReferenceId() {
407: if (_name != null)
408: return "element:" + _name;
409: return null;
410: } //-- getReferenceId
411:
412: /**
413: * Returns the XML Schema to which this element declaration belongs.
414: * @return the XML Schema to which this element declaration belongs.
415: **/
416: public Schema getSchema() {
417: return _schema;
418: } //-- getSchema
419:
420: /**
421: * Returns the substitutionGroup for this element declaration, or
422: * null if it's absent; if this {@link ElementDecl} instance is a reference
423: * to a global element definition, return its substitution group
424: *
425: * @return the substitutionGroup membership for this element
426: * declaration, or null if absent.
427: **/
428: public String getSubstitutionGroup() {
429: if (isReference()) {
430: return getReference().getSubstitutionGroup();
431: }
432: return _substitutionGroup;
433: } //-- getSubstitutionGroup
434:
435: /**
436: * Returns an enumeration of the elements that can be substitute to
437: * this element declaration.
438: * @return an enumeration of the elements that can be substitute to
439: * this element declaration.
440: */
441: public Enumeration getSubstitutionGroupMembers() {
442: Vector result = new Vector();
443: Enumeration enumeration = _schema.getElementDecls();
444: while (enumeration.hasMoreElements()) {
445: ElementDecl temp = (ElementDecl) enumeration.nextElement();
446: String subName = temp.getSubstitutionGroup();
447: if (subName != null) {
448: // no namespace(s) or default namespace in use
449: if (subName.equals(_name)) {
450: result.add(temp);
451: }
452: // namespace(s) incl. prefix in use
453: // TODO: find a better way of dealing with a namespace prefix
454: else if (subName.endsWith(_name)
455: && subName.indexOf(":") > 0) {
456: result.add(temp);
457: }
458: }
459: }
460: return result.elements();
461: }
462:
463: /**
464: * Returns true if this element definition is abstract
465: * @return true if this element definition is abstract
466: **/
467: public boolean isAbstract() {
468: if (isReference()) {
469: return _referencedElement.isAbstract();
470: }
471: return _isAbstract;
472: } //-- isAbstract
473:
474: /**
475: * Returns whether or not instances of this element definition
476: * may appear with no content.
477: *
478: * @return true if instances of this element definition
479: * may appear with no content, otherwise false.
480: **/
481: public boolean isNillable() {
482: if (isReference()) {
483: return _referencedElement.isNillable();
484: }
485: return _nillable;
486: } //-- isNullable
487:
488: /**
489: * Returns true if this element definition simply references another
490: * element Definition
491: * @return true if this element definition is a reference
492: **/
493: public boolean isReference() {
494: return (_elementRefName != null);
495: } //-- isReference
496:
497: /**
498: * Sets whether or not this element definition is abstract
499: * @param isAbstract a boolean when true indicates that this
500: * element definition should be abstract
501: **/
502: public void setAbstract(boolean isAbstract) {
503: _isAbstract = isAbstract;
504: } //-- isAbstract
505:
506: /**
507: * Returns true if this element has children (i.e if it
508: * holds attributes or elements).
509: * @return true if this element has children (i.e if it
510: * holds attributes or elements).
511: */
512: public boolean hasChildren() {
513: XMLType type = getType();
514: if (type instanceof SimpleType)
515: return false;
516:
517: if (type instanceof ComplexType) {
518: //complexContent ->sure to have children
519: if (((ComplexType) type).isComplexContent())
520: return true;
521: //else check for contentModel group
522: else if (((ComplexType) type).getParticleCount() != 0)
523: return true;
524: //else check for attributes
525: else {
526: java.util.Enumeration temp = ((ComplexType) type)
527: .getAttributeDecls();
528: return temp.hasMoreElements();
529: }
530: }
531:
532: return false;
533: } //-- hasChildren
534:
535: /**
536: * Removes the given IdentityConstraint from this element definition.
537: *
538: * @param constraint the IdentityConstraint to remove.
539: * @return true if the IdentityConstraint was contained within this
540: * element defintion.
541: **/
542: public boolean removeIdentityConstraint(
543: IdentityConstraint constraint) {
544: if (constraint == null)
545: return false;
546: return _constraints.removeElement(constraint);
547: } //-- removeIdentityConstraint
548:
549: /**
550: * Sets the value of the 'block' attribute for this element
551: *
552: * @param block the value of the block attribute for this
553: * element definition.
554: **/
555: public void setBlock(BlockList block) {
556: _block = block;
557: } //-- setBlock
558:
559: /**
560: * Sets the value of the 'block' attribute for this element
561: *
562: * @param block the value of the block attribute for this
563: * element definition.
564: **/
565: public void setBlock(String block) {
566: if (block == null)
567: _block = null;
568: else
569: _block = new BlockList(block);
570: } //-- setBlock
571:
572: /**
573: * Sets the default value for this element definition.
574: *
575: * @param value the default value for this element definition.
576: **/
577: public void setDefaultValue(String value) {
578: this ._default = value;
579: } //-- setDefaultValue
580:
581: /**
582: * Sets the value of the 'final' attribute for this element
583: * definition.
584: *
585: * @param finalList the value of the final attribute for this
586: * element definition.
587: **/
588: public void setFinal(FinalList finalList) {
589: _final = finalList;
590: } //-- setFinal
591:
592: /**
593: * Sets the value of the 'final' attribute for this element
594: * definition.
595: *
596: * @param finalValue the value of the final attribute for this
597: * element definition.
598: **/
599: public void setFinal(String finalValue) {
600: if (finalValue == null)
601: _final = null;
602: else
603: _final = new FinalList(finalValue);
604: } //-- setFinal
605:
606: /**
607: * Sets the fixed value for this element definition.
608: *
609: * @param value the fixed value for this element definition.
610: **/
611: public void setFixedValue(String value) {
612: this ._fixed = value;
613: } //-- setDefaultValue
614:
615: /**
616: * Sets the Form for this element definition. The Form object species
617: * whether or not names are qualified or unqualified in the scope of
618: * this element definition. If null, the Form is to be obtained from the
619: * parent Schema.
620: *
621: * @param form the Form type for this element definition.
622: **/
623: public void setForm(Form form) {
624: _form = form;
625: } //-- setForm
626:
627: /**
628: * Sets the Id for this element definition.
629: *
630: * @param id the Id for this element definition.
631: **/
632: public void setId(String id) {
633: _id = id;
634: } //-- setId
635:
636: /**
637: * Sets the name of the element that this Element definition defines.
638: *
639: * @param name the name of the defined element
640: **/
641: public void setName(String name) {
642:
643: if ((name == null) || (ValidationUtils.isNCName(name))) {
644: _name = name;
645: } else {
646: String err = "error: '" + name + "' is not a valid NCName.";
647: throw new IllegalArgumentException(err);
648: }
649: } //-- setName
650:
651: /**
652: * Sets whether or not instances of this element definition may
653: * contain empty content
654: *
655: * @param nillable the flag when true indicates that instances
656: * of this element definition may appear with empty content
657: **/
658: public void setNillable(boolean nillable) {
659: _nillable = nillable;
660: } //-- setNillable
661:
662: /**
663: * Sets the parent for this ElementDecl.
664: *
665: * @param parent the parent Structure for this ElementDecl
666: **/
667: protected void setParent(Structure parent) {
668: if (parent != null) {
669: switch (parent.getStructureType()) {
670: case Structure.GROUP:
671: case Structure.MODELGROUP:
672: case Structure.SCHEMA:
673: break;
674: default:
675: String error = "Invalid parent for element.";
676: throw new IllegalArgumentException(error);
677: }
678: }
679: _parent = parent;
680: } //-- setParent
681:
682: /**
683: * Sets the reference for this element definition
684: * @param reference the Element definition that this definition references
685: **/
686: public void setReference(ElementDecl reference) {
687: if (reference == null) {
688: _elementRefName = null;
689: _referencedElement = null;
690: } else {
691: if (reference.getSchema() == this .getSchema()) {
692: _elementRefName = reference.getName();
693: _referencedElement = reference;
694: } else {
695: String qName = reference.getName();
696: String nsURI = reference.getSchema()
697: .getTargetNamespace();
698: if (nsURI != null) {
699: String prefix = getSchema().getNamespacePrefix(
700: nsURI);
701: if ((prefix != null) && (prefix.length() > 0))
702: qName = prefix + ":" + qName;
703: }
704: _elementRefName = qName;
705: _referencedElement = reference;
706: }
707: }
708: } //-- setReference
709:
710: /**
711: * Sets the name which this element declaration refers to
712: * @param referenceName the name of the element definition that this
713: * definition references
714: **/
715: public void setReferenceName(String referenceName) {
716: if ((referenceName == null)
717: || (ValidationUtils.isQName(referenceName))) {
718: _elementRefName = referenceName;
719: } else {
720: String err = "error: '" + referenceName
721: + "' is not a valid QName.";
722: throw new IllegalArgumentException(err);
723: }
724: } //-- setReference
725:
726: /**
727: * Sets the substitutionGroup for this element definition.
728: *
729: * @param substitutionGroup the substitutionGroup for this
730: * element definition.
731: **/
732: public void setSubstitutionGroup(String substitutionGroup) {
733: _substitutionGroup = substitutionGroup;
734: } //-- setSubstitutionGroup
735:
736: /**
737: * Sets the XMLType for this Element declaration.
738: * @param type the XMLType for this element declaration.
739: * <BR />
740: * <B>Note:</B> This method is mutually exclusive with
741: * #setTypeReference, if a reference has previously been
742: * set it will be ignored.
743: **/
744: public void setType(XMLType type) {
745: //-- reset parent of current type
746: if (_xmlType != null) {
747: _xmlType.setParent(null);
748: }
749: if (type != null) {
750: type.setParent(this );
751: }
752:
753: _xmlType = type;
754: } //-- setType
755:
756: /**
757: * Sets the type of this element to be a reference.
758: */
759: public void setTypeReference(String name) {
760: TypeReference reference = new TypeReference();
761: reference.setName(name);
762: reference.setSchema(_schema);
763: setType(reference);
764: }
765:
766: //-------------------------------/
767: //- Implementation of Structure -/
768: //-------------------------------/
769:
770: /**
771: * Returns the type of this Schema Structure
772: * @return the type of this Schema Structure
773: **/
774: public short getStructureType() {
775: return Structure.ELEMENT;
776: } //-- getStructureType
777:
778: /**
779: * Checks the validity of this element definition.
780: *
781: * @throws ValidationException when this element definition
782: * is invalid.
783: **/
784: public void validate() throws ValidationException {
785:
786: //-- If this element merely references another element definition
787: //-- just check that we can resolve the reference
788: if (_elementRefName != null) {
789: if (_schema.getElementDecl(_elementRefName) == null) {
790: String err = "<element ref=\"" + _elementRefName
791: + "\"> " + "is not resolvable.";
792: throw new ValidationException(err);
793: }
794: return;
795: }
796:
797: if (_name == null) {
798: String err = "<element> is missing required 'name' or "
799: + "'ref' attribute.";
800: throw new ValidationException(err);
801: }
802:
803: //--check that the particle information is not present on top level
804: //--element
805:
806: //--do you really allow parent to be null???
807: if (getParent() != null) {
808: if (getParent().getStructureType() == Structure.SCHEMA) {
809: if (isMinOccursSet()) {
810: String err = "'minOccurs' declaration is prohibited on top level element '/"
811: + getName() + "'.";
812: throw new ValidationException(err);
813: }
814: if (isMaxOccursSet()) {
815: String err = "'maxOccurs' declaration is prohibited on top level element '/"
816: + getName() + "'.";
817: throw new ValidationException(err);
818: }
819: }
820: }
821:
822: //-- If type is anonymous, make sure the type is valid.
823: //-- To prevent excess validation, we ONLY validate
824: //-- if the type is anonymous, because otherwise
825: //-- the Schema itself will validate the type.
826: XMLType type = getType();
827: if (type != null) {
828: if (type.isComplexType()) {
829: ComplexType complexType = (ComplexType) type;
830: if (!complexType.isTopLevel()) {
831: complexType.validate();
832: }
833: } else if (type.isSimpleType()) {
834: SimpleType simpleType = (SimpleType) type;
835: if (simpleType.getParent() != simpleType.getSchema()) {
836: simpleType.validate();
837: }
838: //-- print warning message if ID, IDREF, IDREFS, NMTOKEN, NTOKENS are
839: //-- used as element type
840: int typeCode = simpleType.getTypeCode();
841: switch (typeCode) {
842: case SimpleTypesFactory.ID_TYPE:
843: case SimpleTypesFactory.IDREF_TYPE:
844: case SimpleTypesFactory.IDREFS_TYPE:
845: case SimpleTypesFactory.NMTOKENS_TYPE:
846: case SimpleTypesFactory.NMTOKEN_TYPE:
847: String err = "Warning : For XML Compatibility "
848: + simpleType.getName()
849: + " should be used only as attributes\n.";
850: //--Future versions will log the message
851: System.out.println(err);
852: break;
853: default:
854: break;
855:
856: }
857: }
858: //-- anyType
859: else {
860: //-- nothing to validate anyType is always valid.
861: }
862:
863: }
864:
865: } //-- validate
866:
867: /**
868: * Sets the XMl schema to where this element has been defined
869: * @param schema The defining XML schema
870: */
871: private void setSchema(final Schema schema) {
872: _schema = schema;
873: }
874:
875: } //-- Element
|