001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/metaobj/tags/sakai_2-4-1/metaobj-api/api/src/java/org/sakaiproject/metaobj/utils/xml/SchemaNode.java $
003: * $Id: SchemaNode.java 21196 2007-02-09 18:57:43Z john.ellis@rsmart.com $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2004, 2005, 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.sakaiproject.metaobj.utils.xml;
021:
022: import java.io.Serializable;
023: import java.util.Collection;
024: import java.util.List;
025: import java.util.Map;
026:
027: import org.jdom.Attribute;
028: import org.jdom.Element;
029: import org.jdom.Namespace;
030:
031: /**
032: * Created by IntelliJ IDEA.
033: * User: John Ellis
034: * Date: Apr 15, 2004
035: * Time: 11:10:01 AM
036: * To change this template use File | Settings | File Templates.
037: */
038: public interface SchemaNode extends Serializable {
039:
040: /**
041: * Get the namespace for this schema
042: *
043: * @return the target namespace of this xsd schema
044: */
045: public Namespace getTargetNamespace();
046:
047: /**
048: * Validates the passed in node and all children.
049: * Will also normalize any values.
050: *
051: * @param node a jdom element to validate
052: * @return the validated Element wrapped
053: * in a ValidatedNode class
054: */
055: public ValidatedNode validateAndNormalize(Element node);
056:
057: public ValidatedNode validateAndNormalize(Attribute node);
058:
059: /**
060: * Gets the schema object for the named child node.
061: *
062: * @param elementName the name of the schema node to retrive.
063: * @return
064: */
065: public SchemaNode getChild(String elementName);
066:
067: /**
068: * Retuns the max number of times the element
069: * defined by this node can occur in its parent.
070: * The root schema will always return 1 here.
071: *
072: * @return
073: */
074: public int getMaxOccurs();
075:
076: /**
077: * Returns the min number of times the element
078: * defined by this node can occur in its parent.
079: * The root schema will always return 1 here.
080: *
081: * @return
082: */
083: public int getMinOccurs();
084:
085: public String getSchemaNormalizedValue(Object value)
086: throws NormalizationException;
087:
088: public Object getActualNormalizedValue(String value)
089: throws NormalizationException;
090:
091: public String getName();
092:
093: public Class getObjectType();
094:
095: public List getChildren();
096:
097: public Collection getRootChildren();
098:
099: public String getDocumentAnnotation(String source);
100:
101: public String getAppAnnotation(String source);
102:
103: public Map getDocumentAnnotations();
104:
105: public Map getAppAnnotations();
106:
107: public List getEnumeration();
108:
109: public boolean hasEnumerations();
110:
111: public boolean isAttribute();
112:
113: public boolean isDataNode();
114:
115: public Element getSchemaElement();
116:
117: public ElementType getType();
118:
119: public String getLabel();
120:
121: }
|