001: /*
002: * The contents of this file are subject to the terms
003: * of the Common Development and Distribution License
004: * (the "License"). You may not use this file except
005: * in compliance with the License.
006: *
007: * You can obtain a copy of the license at
008: * https://jwsdp.dev.java.net/CDDLv1.0.html
009: * See the License for the specific language governing
010: * permissions and limitations under the License.
011: *
012: * When distributing Covered Code, include this CDDL
013: * HEADER in each file and include the License file at
014: * https://jwsdp.dev.java.net/CDDLv1.0.html If applicable,
015: * add the following below this CDDL HEADER, with the
016: * fields enclosed by brackets "[]" replaced with your
017: * own identifying information: Portions Copyright [yyyy]
018: * [name of copyright owner]
019: */
020: package com.sun.xml.xsom;
021:
022: import javax.xml.namespace.NamespaceContext;
023: import java.util.Iterator;
024: import java.util.Collection;
025:
026: /**
027: * Set of {@link XSSchema} objects.
028: *
029: * @author
030: * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
031: */
032: public interface XSSchemaSet {
033: XSSchema getSchema(String targetNamespace);
034:
035: XSSchema getSchema(int idx);
036:
037: int getSchemaSize();
038:
039: Iterator<XSSchema> iterateSchema();
040:
041: /**
042: * Gets all {@link XSSchema}s in a single collection.
043: */
044: Collection<XSSchema> getSchemas();
045:
046: XSType getType(String namespaceURI, String localName);
047:
048: XSSimpleType getSimpleType(String namespaceURI, String localName);
049:
050: XSAttributeDecl getAttributeDecl(String namespaceURI,
051: String localName);
052:
053: XSElementDecl getElementDecl(String namespaceURI, String localName);
054:
055: XSModelGroupDecl getModelGroupDecl(String namespaceURI,
056: String localName);
057:
058: XSAttGroupDecl getAttGroupDecl(String namespaceURI, String localName);
059:
060: XSComplexType getComplexType(String namespaceURI, String localName);
061:
062: XSIdentityConstraint getIdentityConstraint(String namespaceURI,
063: String localName);
064:
065: /** Iterates all element declarations in all the schemas. */
066: Iterator<XSElementDecl> iterateElementDecls();
067:
068: /** Iterates all type definitions in all the schemas. */
069: Iterator<XSType> iterateTypes();
070:
071: /** Iterates all atribute declarations in all the schemas. */
072: Iterator<XSAttributeDecl> iterateAttributeDecls();
073:
074: /** Iterates all attribute group declarations in all the schemas. */
075: Iterator<XSAttGroupDecl> iterateAttGroupDecls();
076:
077: /** Iterates all model group declarations in all the schemas. */
078: Iterator<XSModelGroupDecl> iterateModelGroupDecls();
079:
080: /** Iterates all simple type definitions in all the schemas. */
081: Iterator<XSSimpleType> iterateSimpleTypes();
082:
083: /** Iterates all complex type definitions in all the schemas. */
084: Iterator<XSComplexType> iterateComplexTypes();
085:
086: /** Iterates all notation declarations in all the schemas. */
087: Iterator<XSNotation> iterateNotations();
088:
089: /**
090: * Iterates all identity constraints in all the schemas.
091: */
092: Iterator<XSIdentityConstraint> iterateIdentityConstraints();
093:
094: // conceptually static methods
095: XSComplexType getAnyType();
096:
097: XSSimpleType getAnySimpleType();
098:
099: XSContentType getEmpty();
100:
101: /**
102: * Evaluates a schema component designator against this schema component
103: * and returns the resulting schema components.
104: *
105: * @throws IllegalArgumentException
106: * if SCD is syntactically incorrect.
107: * @param scd
108: * Schema component designator. See {@link SCD} for more details.
109: * @param nsContext
110: * The namespace context in which SCD is evaluated. Cannot be null.
111: * @return
112: * Can be empty but never null.
113: */
114: Collection<XSComponent> select(String scd,
115: NamespaceContext nsContext);
116:
117: /**
118: * Evaluates a schema component designator against this schema component
119: * and returns the first resulting schema component.
120: *
121: * @throws IllegalArgumentException
122: * if SCD is syntactically incorrect.
123: * @param scd
124: * Schema component designator. See {@link SCD} for more details.
125: * @param nsContext
126: * The namespace context in which SCD is evaluated. Cannot be null.
127: * @return
128: * null if the SCD didn't match anything. If the SCD matched more than one node,
129: * the first one will be returned.
130: */
131: XSComponent selectSingle(String scd, NamespaceContext nsContext);
132: }
|