Java源码示例:com.sun.org.apache.xerces.internal.xs.XSObject

示例1
private void expandRelatedComponents(XSObject component, Vector componentList, Map<String, Vector> dependencies) {
    short componentType = component.getType();
    switch (componentType) {
    case XSConstants.TYPE_DEFINITION :
        expandRelatedTypeComponents((XSTypeDefinition) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.ATTRIBUTE_DECLARATION :
        expandRelatedAttributeComponents((XSAttributeDeclaration) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.ATTRIBUTE_GROUP :
        expandRelatedAttributeGroupComponents((XSAttributeGroupDefinition) component, componentList, component.getNamespace(), dependencies);
    case XSConstants.ELEMENT_DECLARATION :
        expandRelatedElementComponents((XSElementDeclaration) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.MODEL_GROUP_DEFINITION :
        expandRelatedModelGroupDefinitionComponents((XSModelGroupDefinition) component, componentList, component.getNamespace(), dependencies);
    case XSConstants.ATTRIBUTE_USE :
        //expandRelatedAttributeUseComponents((XSAttributeUse)component, componentList, dependencies);
    case XSConstants.NOTATION_DECLARATION :
    case XSConstants.IDENTITY_CONSTRAINT :
    default :
        break;
    }
}
 
示例2
private XSObjectListImpl getGlobalElements() {
    final SymbolHash[] tables = new SymbolHash[fGrammarCount];
    int length = 0;

    for (int i = 0; i < fGrammarCount; i++) {
        tables[i] = fGrammarList[i].fAllGlobalElemDecls;
        length += tables[i].getLength();
    }

    if (length == 0) {
        return XSObjectListImpl.EMPTY_LIST;
    }

    final XSObject[] components = new XSObject[length];

    int start = 0;
    for (int i = 0; i < fGrammarCount; i++) {
        tables[i].getValues(components, start);
        start += tables[i].getLength();
    }

    return new XSObjectListImpl(components, length);
}
 
示例3
/**
 * Retrieves an <code>XSObject</code> specified by local name and
 * namespace URI.
 * <br>Per XML Namespaces, applications must use the value <code>null</code> as the
 * <code>namespace</code> parameter for methods if they wish to specify
 * no namespace.
 * @param namespace The namespace URI of the <code>XSObject</code> to
 *   retrieve, or <code>null</code> if the <code>XSObject</code> has no
 *   namespace.
 * @param localName The local name of the <code>XSObject</code> to
 *   retrieve.
 * @return A <code>XSObject</code> (of any type) with the specified local
 *   name and namespace URI, or <code>null</code> if they do not
 *   identify any object in this map.
 */
public XSObject itemByName(String namespace, String localName) {
    for (int i = 0; i < fNSNum; i++) {
        if (isEqual(namespace, fNamespaces[i])) {
            // when this map is created from SymbolHash's
            // get the component from SymbolHash
            if (fMaps != null) {
                return (XSObject)fMaps[i].get(localName);
            }
            // Otherwise (it's created from an array)
            // go through the array to find a matching name
            XSObject ret;
            for (int j = 0; j < fLength; j++) {
                ret = fArray[j];
                if (ret.getName().equals(localName)) {
                    return ret;
                }
            }
            return null;
        }
    }
    return null;
}
 
示例4
private XSObjectListImpl getGlobalElements() {
    final SymbolHash[] tables = new SymbolHash[fGrammarCount];
    int length = 0;

    for (int i = 0; i < fGrammarCount; i++) {
        tables[i] = fGrammarList[i].fAllGlobalElemDecls;
        length += tables[i].getLength();
    }

    if (length == 0) {
        return XSObjectListImpl.EMPTY_LIST;
    }

    final XSObject[] components = new XSObject[length];

    int start = 0;
    for (int i = 0; i < fGrammarCount; i++) {
        tables[i].getValues(components, start);
        start += tables[i].getLength();
    }

    return new XSObjectListImpl(components, length);
}
 
示例5
private void expandRelatedComponents(XSObject component, Vector componentList, Map<String, Vector> dependencies) {
    short componentType = component.getType();
    switch (componentType) {
    case XSConstants.TYPE_DEFINITION :
        expandRelatedTypeComponents((XSTypeDefinition) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.ATTRIBUTE_DECLARATION :
        expandRelatedAttributeComponents((XSAttributeDeclaration) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.ATTRIBUTE_GROUP :
        expandRelatedAttributeGroupComponents((XSAttributeGroupDefinition) component, componentList, component.getNamespace(), dependencies);
    case XSConstants.ELEMENT_DECLARATION :
        expandRelatedElementComponents((XSElementDeclaration) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.MODEL_GROUP_DEFINITION :
        expandRelatedModelGroupDefinitionComponents((XSModelGroupDefinition) component, componentList, component.getNamespace(), dependencies);
    case XSConstants.ATTRIBUTE_USE :
        //expandRelatedAttributeUseComponents((XSAttributeUse)component, componentList, dependencies);
    case XSConstants.NOTATION_DECLARATION :
    case XSConstants.IDENTITY_CONSTRAINT :
    default :
        break;
    }
}
 
示例6
/**
 * Construct an XSNamedMap implementation one namespace from an array
 *
 * @param array     containing all components
 * @param length    number of components
 */
public XSNamedMapImpl(XSObject[] array, int length) {
    if (length == 0) {
        fNamespaces = null;
        fMaps = null;
        fNSNum = 0;
        fArray = array;
        fLength = 0;
        return;
    }
    // because all components are from the same target namesapce,
    // get the namespace from the first one.
    fNamespaces = new String[]{array[0].getNamespace()};
    fMaps = null;
    fNSNum = 1;
    // copy elements to the Vector
    fArray = array;
    fLength = length;
}
 
示例7
private XSObjectListImpl getGlobalElements() {
    final SymbolHash[] tables = new SymbolHash[fGrammarCount];
    int length = 0;

    for (int i = 0; i < fGrammarCount; i++) {
        tables[i] = fGrammarList[i].fAllGlobalElemDecls;
        length += tables[i].getLength();
    }

    if (length == 0) {
        return XSObjectListImpl.EMPTY_LIST;
    }

    final XSObject[] components = new XSObject[length];

    int start = 0;
    for (int i = 0; i < fGrammarCount; i++) {
        tables[i].getValues(components, start);
        start += tables[i].getLength();
    }

    return new XSObjectListImpl(components, length);
}
 
示例8
/**
 * Retrieves an <code>XSObject</code> specified by local name and
 * namespace URI.
 * <br>Per XML Namespaces, applications must use the value <code>null</code> as the
 * <code>namespace</code> parameter for methods if they wish to specify
 * no namespace.
 * @param namespace The namespace URI of the <code>XSObject</code> to
 *   retrieve, or <code>null</code> if the <code>XSObject</code> has no
 *   namespace.
 * @param localName The local name of the <code>XSObject</code> to
 *   retrieve.
 * @return A <code>XSObject</code> (of any type) with the specified local
 *   name and namespace URI, or <code>null</code> if they do not
 *   identify any object in this map.
 */
public XSObject itemByName(String namespace, String localName) {
    for (int i = 0; i < fNSNum; i++) {
        if (isEqual(namespace, fNamespaces[i])) {
            // when this map is created from SymbolHash's
            // get the component from SymbolHash
            if (fMaps != null) {
                return (XSObject)fMaps[i].get(localName);
            }
            // Otherwise (it's created from an array)
            // go through the array to find a matching name
            XSObject ret;
            for (int j = 0; j < fLength; j++) {
                ret = fArray[j];
                if (ret.getName().equals(localName)) {
                    return ret;
                }
            }
            return null;
        }
    }
    return null;
}
 
示例9
/**
 * Returns the <code>index</code>th item in the collection or
 * <code>null</code> if <code>index</code> is greater than or equal to
 * the number of objects in the list. The index starts at 0.
 * @param index  index into the collection.
 * @return  The <code>XSObject</code> at the <code>index</code>th
 *   position in the <code>XSObjectList</code>, or <code>null</code> if
 *   the index specified is not valid.
 */
public synchronized XSObject item(int index) {
    if (fArray == null) {
        // calculate the total number of elements
        getLength();
        fArray = new XSObject[fLength];
        int pos = 0;
        // get components from all SymbolHashes
        for (int i = 0; i < fNSNum; i++) {
            pos += fMaps[i].getValues(fArray, pos);
        }
    }
    if (index < 0 || index >= fLength) {
        return null;
    }
    return fArray[index];
}
 
示例10
/**
 * Construct an XSNamedMap implementation one namespace from an array
 *
 * @param array     containing all components
 * @param length    number of components
 */
public XSNamedMapImpl(XSObject[] array, int length) {
    if (length == 0) {
        fNamespaces = null;
        fMaps = null;
        fNSNum = 0;
        fArray = array;
        fLength = 0;
        return;
    }
    // because all components are from the same target namesapce,
    // get the namespace from the first one.
    fNamespaces = new String[]{array[0].getNamespace()};
    fMaps = null;
    fNSNum = 1;
    // copy elements to the Vector
    fArray = array;
    fLength = length;
}
 
示例11
/**
 * Construct an XSNamedMap implementation one namespace from an array
 *
 * @param array     containing all components
 * @param length    number of components
 */
public XSNamedMapImpl(XSObject[] array, int length) {
    if (length == 0) {
        fNamespaces = null;
        fMaps = null;
        fNSNum = 0;
        fArray = array;
        fLength = 0;
        return;
    }
    // because all components are from the same target namesapce,
    // get the namespace from the first one.
    fNamespaces = new String[]{array[0].getNamespace()};
    fMaps = null;
    fNSNum = 1;
    // copy elements to the Vector
    fArray = array;
    fLength = length;
}
 
示例12
/**
 * Returns the <code>index</code>th item in the collection or
 * <code>null</code> if <code>index</code> is greater than or equal to
 * the number of objects in the list. The index starts at 0.
 * @param index  index into the collection.
 * @return  The <code>XSObject</code> at the <code>index</code>th
 *   position in the <code>XSObjectList</code>, or <code>null</code> if
 *   the index specified is not valid.
 */
public synchronized XSObject item(int index) {
    if (fArray == null) {
        // calculate the total number of elements
        getLength();
        fArray = new XSObject[fLength];
        int pos = 0;
        // get components from all SymbolHashes
        for (int i = 0; i < fNSNum; i++) {
            pos += fMaps[i].getValues(fArray, pos);
        }
    }
    if (index < 0 || index >= fLength) {
        return null;
    }
    return fArray[index];
}
 
示例13
private XSObjectListImpl getGlobalElements() {
    final SymbolHash[] tables = new SymbolHash[fGrammarCount];
    int length = 0;

    for (int i = 0; i < fGrammarCount; i++) {
        tables[i] = fGrammarList[i].fAllGlobalElemDecls;
        length += tables[i].getLength();
    }

    if (length == 0) {
        return XSObjectListImpl.EMPTY_LIST;
    }

    final XSObject[] components = new XSObject[length];

    int start = 0;
    for (int i = 0; i < fGrammarCount; i++) {
        tables[i].getValues(components, start);
        start += tables[i].getLength();
    }

    return new XSObjectListImpl(components, length);
}
 
示例14
private void expandRelatedComponents(XSObject component, Vector componentList, Map<String, Vector> dependencies) {
    short componentType = component.getType();
    switch (componentType) {
    case XSConstants.TYPE_DEFINITION :
        expandRelatedTypeComponents((XSTypeDefinition) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.ATTRIBUTE_DECLARATION :
        expandRelatedAttributeComponents((XSAttributeDeclaration) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.ATTRIBUTE_GROUP :
        expandRelatedAttributeGroupComponents((XSAttributeGroupDefinition) component, componentList, component.getNamespace(), dependencies);
    case XSConstants.ELEMENT_DECLARATION :
        expandRelatedElementComponents((XSElementDeclaration) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.MODEL_GROUP_DEFINITION :
        expandRelatedModelGroupDefinitionComponents((XSModelGroupDefinition) component, componentList, component.getNamespace(), dependencies);
    case XSConstants.ATTRIBUTE_USE :
        //expandRelatedAttributeUseComponents((XSAttributeUse)component, componentList, dependencies);
    case XSConstants.NOTATION_DECLARATION :
    case XSConstants.IDENTITY_CONSTRAINT :
    default :
        break;
    }
}
 
示例15
private void expandRelatedComponents(XSObject component, Vector componentList, Map<String, Vector> dependencies) {
    short componentType = component.getType();
    switch (componentType) {
    case XSConstants.TYPE_DEFINITION :
        expandRelatedTypeComponents((XSTypeDefinition) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.ATTRIBUTE_DECLARATION :
        expandRelatedAttributeComponents((XSAttributeDeclaration) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.ATTRIBUTE_GROUP :
        expandRelatedAttributeGroupComponents((XSAttributeGroupDefinition) component, componentList, component.getNamespace(), dependencies);
    case XSConstants.ELEMENT_DECLARATION :
        expandRelatedElementComponents((XSElementDeclaration) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.MODEL_GROUP_DEFINITION :
        expandRelatedModelGroupDefinitionComponents((XSModelGroupDefinition) component, componentList, component.getNamespace(), dependencies);
    case XSConstants.ATTRIBUTE_USE :
        //expandRelatedAttributeUseComponents((XSAttributeUse)component, componentList, dependencies);
    case XSConstants.NOTATION_DECLARATION :
    case XSConstants.IDENTITY_CONSTRAINT :
    default :
        break;
    }
}
 
示例16
/**
 * Retrieves an <code>XSObject</code> specified by local name and
 * namespace URI.
 * <br>Per XML Namespaces, applications must use the value <code>null</code> as the
 * <code>namespace</code> parameter for methods if they wish to specify
 * no namespace.
 * @param namespace The namespace URI of the <code>XSObject</code> to
 *   retrieve, or <code>null</code> if the <code>XSObject</code> has no
 *   namespace.
 * @param localName The local name of the <code>XSObject</code> to
 *   retrieve.
 * @return A <code>XSObject</code> (of any type) with the specified local
 *   name and namespace URI, or <code>null</code> if they do not
 *   identify any object in this map.
 */
public XSObject itemByName(String namespace, String localName) {
    for (int i = 0; i < fNSNum; i++) {
        if (isEqual(namespace, fNamespaces[i])) {
            // when this map is created from SymbolHash's
            // get the component from SymbolHash
            if (fMaps != null) {
                return (XSObject)fMaps[i].get(localName);
            }
            // Otherwise (it's created from an array)
            // go through the array to find a matching name
            XSObject ret;
            for (int j = 0; j < fLength; j++) {
                ret = fArray[j];
                if (ret.getName().equals(localName)) {
                    return ret;
                }
            }
            return null;
        }
    }
    return null;
}
 
示例17
private XSObjectListImpl getGlobalElements() {
    final SymbolHash[] tables = new SymbolHash[fGrammarCount];
    int length = 0;

    for (int i = 0; i < fGrammarCount; i++) {
        tables[i] = fGrammarList[i].fAllGlobalElemDecls;
        length += tables[i].getLength();
    }

    if (length == 0) {
        return XSObjectListImpl.EMPTY_LIST;
    }

    final XSObject[] components = new XSObject[length];

    int start = 0;
    for (int i = 0; i < fGrammarCount; i++) {
        tables[i].getValues(components, start);
        start += tables[i].getLength();
    }

    return new XSObjectListImpl(components, length);
}
 
示例18
private void expandRelatedComponents(XSObject component, Vector componentList, Map<String, Vector> dependencies) {
    short componentType = component.getType();
    switch (componentType) {
    case XSConstants.TYPE_DEFINITION :
        expandRelatedTypeComponents((XSTypeDefinition) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.ATTRIBUTE_DECLARATION :
        expandRelatedAttributeComponents((XSAttributeDeclaration) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.ATTRIBUTE_GROUP :
        expandRelatedAttributeGroupComponents((XSAttributeGroupDefinition) component, componentList, component.getNamespace(), dependencies);
    case XSConstants.ELEMENT_DECLARATION :
        expandRelatedElementComponents((XSElementDeclaration) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.MODEL_GROUP_DEFINITION :
        expandRelatedModelGroupDefinitionComponents((XSModelGroupDefinition) component, componentList, component.getNamespace(), dependencies);
    case XSConstants.ATTRIBUTE_USE :
        //expandRelatedAttributeUseComponents((XSAttributeUse)component, componentList, dependencies);
    case XSConstants.NOTATION_DECLARATION :
    case XSConstants.IDENTITY_CONSTRAINT :
    default :
        break;
    }
}
 
示例19
/**
 * getSchemaDocument method uses XMLInputSource to parse a schema document.
 * @param schemaNamespace
 * @param schemaSource
 * @param mustResolve
 * @param referType
 * @param referElement
 * @return A schema Element.
 */
private Element getSchemaDocument(XSInputSource schemaSource, XSDDescription desc) {

    SchemaGrammar[] grammars = schemaSource.getGrammars();
    short referType = desc.getContextType();

    if (grammars != null && grammars.length > 0) {
        Vector expandedGrammars = expandGrammars(grammars);
        // check for existing grammars in our bucket
        // and if there exist any, and namespace growth is
        // not enabled - we do nothing
        if (fNamespaceGrowth || !existingGrammars(expandedGrammars)) {
            addGrammars(expandedGrammars);
            if (referType == XSDDescription.CONTEXT_PREPARSE) {
                desc.setTargetNamespace(grammars[0].getTargetNamespace());
            }
        }
    }
    else {
        XSObject[] components = schemaSource.getComponents();
        if (components != null && components.length > 0) {
            Map<String, Vector> importDependencies = new HashMap();
            Vector expandedComponents = expandComponents(components, importDependencies);
            if (fNamespaceGrowth || canAddComponents(expandedComponents)) {
                addGlobalComponents(expandedComponents, importDependencies);
                if (referType == XSDDescription.CONTEXT_PREPARSE) {
                    desc.setTargetNamespace(components[0].getNamespace());
                }
            }
        }
    }
    return null;
}
 
示例20
private void addGlobalComponents(Vector components, Map<String, Vector> importDependencies) {
    final XSDDescription desc = new XSDDescription();
    final int size = components.size();

    for (int i=0; i<size; i++) {
        addGlobalComponent((XSObject) components.elementAt(i), desc);
    }
    updateImportDependencies(importDependencies);
}
 
示例21
void fillInLocalElemInfo(Element elmDecl,
        XSDocumentInfo schemaDoc,
        int allContextFlags,
        XSObject parent,
        XSParticleDecl particle) {

    // if the stack is full, increase the size
    if (fParticle.length == fLocalElemStackPos) {
        // increase size
        XSParticleDecl[] newStackP = new XSParticleDecl[fLocalElemStackPos+INC_STACK_SIZE];
        System.arraycopy(fParticle, 0, newStackP, 0, fLocalElemStackPos);
        fParticle = newStackP;
        Element[] newStackE = new Element[fLocalElemStackPos+INC_STACK_SIZE];
        System.arraycopy(fLocalElementDecl, 0, newStackE, 0, fLocalElemStackPos);
        fLocalElementDecl = newStackE;
        XSDocumentInfo [] newStackE_schema = new XSDocumentInfo[fLocalElemStackPos+INC_STACK_SIZE];
        System.arraycopy(fLocalElementDecl_schema, 0, newStackE_schema, 0, fLocalElemStackPos);
        fLocalElementDecl_schema = newStackE_schema;
        int[] newStackI = new int[fLocalElemStackPos+INC_STACK_SIZE];
        System.arraycopy(fAllContext, 0, newStackI, 0, fLocalElemStackPos);
        fAllContext = newStackI;
        XSObject[] newStackC = new XSObject[fLocalElemStackPos+INC_STACK_SIZE];
        System.arraycopy(fParent, 0, newStackC, 0, fLocalElemStackPos);
        fParent = newStackC;
        String [][] newStackN = new String [fLocalElemStackPos+INC_STACK_SIZE][];
        System.arraycopy(fLocalElemNamespaceContext, 0, newStackN, 0, fLocalElemStackPos);
        fLocalElemNamespaceContext = newStackN;
    }

    fParticle[fLocalElemStackPos] = particle;
    fLocalElementDecl[fLocalElemStackPos] = elmDecl;
    fLocalElementDecl_schema[fLocalElemStackPos] = schemaDoc;
    fAllContext[fLocalElemStackPos] = allContextFlags;
    fParent[fLocalElemStackPos] = parent;
    fLocalElemNamespaceContext[fLocalElemStackPos++] = schemaDoc.fNamespaceSupport.getEffectiveLocalContext();
}
 
示例22
public synchronized Set entrySet() {
    // Defer creation of the entry set until it is actually needed.
    if (fEntrySet == null) {
        final int length = getLength();
        final XSNamedMapEntry[] entries = new XSNamedMapEntry[length];
        for (int i = 0; i < length; ++i) {
            XSObject xso = item(i);
            entries[i] = new XSNamedMapEntry(new QName(xso.getNamespace(), xso.getName()), xso);
        }
        // Create a view of this immutable map.
        fEntrySet = new AbstractSet() {
            public Iterator iterator() {
                return new Iterator() {
                    private int index = 0;
                    public boolean hasNext() {
                        return (index < length);
                    }
                    public Object next() {
                        if (index < length) {
                            return entries[index++];
                        }
                        throw new NoSuchElementException();
                    }
                    public void remove() {
                        throw new UnsupportedOperationException();
                    }
                };
            }
            public int size() {
                return length;
            }
        };
    }
    return fEntrySet;
}
 
示例23
public void addXSObject(XSObject object) {
   if (fLength == fArray.length) {
       XSObject[] temp = new XSObject[fLength + 4];
       System.arraycopy(fArray, 0, temp, 0, fLength);
       fArray = temp;
   }
   fArray[fLength++] = object;
}
 
示例24
private boolean canAddComponents(Vector components) {
    final int size = components.size();
    final XSDDescription desc = new XSDDescription();
    for (int i=0; i<size; i++) {
        XSObject component = (XSObject) components.elementAt(i);
        if (!canAddComponent(component, desc)) {
            return false;
        }
    }
    return true;
}
 
示例25
void fillInLocalElemInfo(Element elmDecl,
        XSDocumentInfo schemaDoc,
        int allContextFlags,
        XSObject parent,
        XSParticleDecl particle) {

    // if the stack is full, increase the size
    if (fParticle.length == fLocalElemStackPos) {
        // increase size
        XSParticleDecl[] newStackP = new XSParticleDecl[fLocalElemStackPos+INC_STACK_SIZE];
        System.arraycopy(fParticle, 0, newStackP, 0, fLocalElemStackPos);
        fParticle = newStackP;
        Element[] newStackE = new Element[fLocalElemStackPos+INC_STACK_SIZE];
        System.arraycopy(fLocalElementDecl, 0, newStackE, 0, fLocalElemStackPos);
        fLocalElementDecl = newStackE;
        XSDocumentInfo [] newStackE_schema = new XSDocumentInfo[fLocalElemStackPos+INC_STACK_SIZE];
        System.arraycopy(fLocalElementDecl_schema, 0, newStackE_schema, 0, fLocalElemStackPos);
        fLocalElementDecl_schema = newStackE_schema;
        int[] newStackI = new int[fLocalElemStackPos+INC_STACK_SIZE];
        System.arraycopy(fAllContext, 0, newStackI, 0, fLocalElemStackPos);
        fAllContext = newStackI;
        XSObject[] newStackC = new XSObject[fLocalElemStackPos+INC_STACK_SIZE];
        System.arraycopy(fParent, 0, newStackC, 0, fLocalElemStackPos);
        fParent = newStackC;
        String [][] newStackN = new String [fLocalElemStackPos+INC_STACK_SIZE][];
        System.arraycopy(fLocalElemNamespaceContext, 0, newStackN, 0, fLocalElemStackPos);
        fLocalElemNamespaceContext = newStackN;
    }

    fParticle[fLocalElemStackPos] = particle;
    fLocalElementDecl[fLocalElemStackPos] = elmDecl;
    fLocalElementDecl_schema[fLocalElemStackPos] = schemaDoc;
    fAllContext[fLocalElemStackPos] = allContextFlags;
    fParent[fLocalElemStackPos] = parent;
    fLocalElemNamespaceContext[fLocalElemStackPos++] = schemaDoc.fNamespaceSupport.getEffectiveLocalContext();
}
 
示例26
void fillInLocalElemInfo(Element elmDecl,
        XSDocumentInfo schemaDoc,
        int allContextFlags,
        XSObject parent,
        XSParticleDecl particle) {

    // if the stack is full, increase the size
    if (fParticle.length == fLocalElemStackPos) {
        // increase size
        XSParticleDecl[] newStackP = new XSParticleDecl[fLocalElemStackPos+INC_STACK_SIZE];
        System.arraycopy(fParticle, 0, newStackP, 0, fLocalElemStackPos);
        fParticle = newStackP;
        Element[] newStackE = new Element[fLocalElemStackPos+INC_STACK_SIZE];
        System.arraycopy(fLocalElementDecl, 0, newStackE, 0, fLocalElemStackPos);
        fLocalElementDecl = newStackE;
        XSDocumentInfo [] newStackE_schema = new XSDocumentInfo[fLocalElemStackPos+INC_STACK_SIZE];
        System.arraycopy(fLocalElementDecl_schema, 0, newStackE_schema, 0, fLocalElemStackPos);
        fLocalElementDecl_schema = newStackE_schema;
        int[] newStackI = new int[fLocalElemStackPos+INC_STACK_SIZE];
        System.arraycopy(fAllContext, 0, newStackI, 0, fLocalElemStackPos);
        fAllContext = newStackI;
        XSObject[] newStackC = new XSObject[fLocalElemStackPos+INC_STACK_SIZE];
        System.arraycopy(fParent, 0, newStackC, 0, fLocalElemStackPos);
        fParent = newStackC;
        String [][] newStackN = new String [fLocalElemStackPos+INC_STACK_SIZE][];
        System.arraycopy(fLocalElemNamespaceContext, 0, newStackN, 0, fLocalElemStackPos);
        fLocalElemNamespaceContext = newStackN;
    }

    fParticle[fLocalElemStackPos] = particle;
    fLocalElementDecl[fLocalElemStackPos] = elmDecl;
    fLocalElementDecl_schema[fLocalElemStackPos] = schemaDoc;
    fAllContext[fLocalElemStackPos] = allContextFlags;
    fParent[fLocalElemStackPos] = parent;
    fLocalElemNamespaceContext[fLocalElemStackPos++] = schemaDoc.fNamespaceSupport.getEffectiveLocalContext();
}
 
示例27
/**
 * Retrieves an <code>XSObject</code> specified by local name and namespace
 * URI.
 * @param namespace The namespace URI of the <code>XSObject</code> to
 *   retrieve.
 * @param localName The local name of the <code>XSObject</code> to retrieve.
 * @return A <code>XSObject</code> (of any type) with the specified local
 *   name and namespace URI, or <code>null</code> if they do not
 *   identify any <code>XSObject</code> in this map.
 */
public XSObject itemByName(String namespace, String localName) {
    for (int i = 0; i < fNSNum; i++) {
        if (isEqual(namespace, fNamespaces[i])) {
            XSTypeDefinition type = (XSTypeDefinition)fMaps[i].get(localName);
            // only return it if it matches the required type
            if (type != null && type.getTypeCategory() == fType) {
                return type;
            }
            return null;
        }
    }
    return null;
}
 
示例28
/**
 * Retrieves an <code>XSObject</code> specified by local name and namespace
 * URI.
 * @param namespace The namespace URI of the <code>XSObject</code> to
 *   retrieve.
 * @param localName The local name of the <code>XSObject</code> to retrieve.
 * @return A <code>XSObject</code> (of any type) with the specified local
 *   name and namespace URI, or <code>null</code> if they do not
 *   identify any <code>XSObject</code> in this map.
 */
public XSObject itemByName(String namespace, String localName) {
    for (int i = 0; i < fNSNum; i++) {
        if (isEqual(namespace, fNamespaces[i])) {
            XSTypeDefinition type = (XSTypeDefinition)fMaps[i].get(localName);
            // only return it if it matches the required type
            if (type != null && type.getTypeCategory() == fType) {
                return type;
            }
            return null;
        }
    }
    return null;
}
 
示例29
public void addXSObject(XSObject object) {
   if (fLength == fArray.length) {
       XSObject[] temp = new XSObject[fLength + 4];
       System.arraycopy(fArray, 0, temp, 0, fLength);
       fArray = temp;
   }
   fArray[fLength++] = object;
}
 
示例30
/**
 * getSchemaDocument method uses XMLInputSource to parse a schema document.
 * @param schemaNamespace
 * @param schemaSource
 * @param mustResolve
 * @param referType
 * @param referElement
 * @return A schema Element.
 */
private Element getSchemaDocument(XSInputSource schemaSource, XSDDescription desc) {

    SchemaGrammar[] grammars = schemaSource.getGrammars();
    short referType = desc.getContextType();

    if (grammars != null && grammars.length > 0) {
        Vector expandedGrammars = expandGrammars(grammars);
        // check for existing grammars in our bucket
        // and if there exist any, and namespace growth is
        // not enabled - we do nothing
        if (fNamespaceGrowth || !existingGrammars(expandedGrammars)) {
            addGrammars(expandedGrammars);
            if (referType == XSDDescription.CONTEXT_PREPARSE) {
                desc.setTargetNamespace(grammars[0].getTargetNamespace());
            }
        }
    }
    else {
        XSObject[] components = schemaSource.getComponents();
        if (components != null && components.length > 0) {
            Map<String, Vector> importDependencies = new HashMap();
            Vector expandedComponents = expandComponents(components, importDependencies);
            if (fNamespaceGrowth || canAddComponents(expandedComponents)) {
                addGlobalComponents(expandedComponents, importDependencies);
                if (referType == XSDDescription.CONTEXT_PREPARSE) {
                    desc.setTargetNamespace(components[0].getNamespace());
                }
            }
        }
    }
    return null;
}