本文整理汇总了Java中mf.org.apache.xerces.xs.XSObject类的典型用法代码示例。如果您正苦于以下问题:Java XSObject类的具体用法?Java XSObject怎么用?Java XSObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XSObject类属于mf.org.apache.xerces.xs包,在下文中一共展示了XSObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: expandComponents
import mf.org.apache.xerces.xs.XSObject; //导入依赖的package包/类
private Vector expandComponents(XSObject[] components, Hashtable dependencies) {
Vector newComponents = new Vector();
for (int i=0; i<components.length; i++) {
if (!newComponents.contains(components[i])) {
newComponents.add(components[i]);
}
}
for (int i=0; i<newComponents.size(); i++) {
final XSObject component = (XSObject) newComponents.elementAt(i);
expandRelatedComponents(component, newComponents, dependencies);
}
return newComponents;
}
示例2: expandRelatedComponents
import mf.org.apache.xerces.xs.XSObject; //导入依赖的package包/类
private void expandRelatedComponents(XSObject component, Vector componentList, Hashtable 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;
}
}
示例3: getGlobalElements
import mf.org.apache.xerces.xs.XSObject; //导入依赖的package包/类
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);
}
示例4: XSNamedMapImpl
import mf.org.apache.xerces.xs.XSObject; //导入依赖的package包/类
/**
* 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;
}
示例5: itemByName
import mf.org.apache.xerces.xs.XSObject; //导入依赖的package包/类
/**
* 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;
}
示例6: item
import mf.org.apache.xerces.xs.XSObject; //导入依赖的package包/类
/**
* 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];
}
示例7: getSchemaDocument
import mf.org.apache.xerces.xs.XSObject; //导入依赖的package包/类
/**
* 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) {
Hashtable importDependencies = new Hashtable();
Vector expandedComponents = expandComponents(components, importDependencies);
if (fNamespaceGrowth || canAddComponents(expandedComponents)) {
addGlobalComponents(expandedComponents, importDependencies);
if (referType == XSDDescription.CONTEXT_PREPARSE) {
desc.setTargetNamespace(components[0].getNamespace());
}
}
}
}
return null;
}
示例8: canAddComponents
import mf.org.apache.xerces.xs.XSObject; //导入依赖的package包/类
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;
}
示例9: addGlobalComponents
import mf.org.apache.xerces.xs.XSObject; //导入依赖的package包/类
private void addGlobalComponents(Vector components, Hashtable 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);
}
示例10: fillInLocalElemInfo
import mf.org.apache.xerces.xs.XSObject; //导入依赖的package包/类
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();
}
示例11: traverseLocal
import mf.org.apache.xerces.xs.XSObject; //导入依赖的package包/类
/**
* Traverse a locally declared element (or an element reference).
*
* To handle the recursive cases efficiently, we delay the traversal
* and return an empty particle node. We'll fill in this particle node
* later after we've done with all the global declarations.
* This method causes a number of data structures in the schema handler to be filled in.
*
* @param elmDecl
* @param schemaDoc
* @param grammar
* @return the particle
*/
XSParticleDecl traverseLocal(Element elmDecl,
XSDocumentInfo schemaDoc,
SchemaGrammar grammar,
int allContextFlags,
XSObject parent) {
XSParticleDecl particle = null;
if (fSchemaHandler.fDeclPool !=null) {
particle = fSchemaHandler.fDeclPool.getParticleDecl();
} else {
particle = new XSParticleDecl();
}
if (fDeferTraversingLocalElements) {
// The only thing we care about now is whether this element has
// minOccurs=0. This affects (if the element appears in a complex
// type) whether a type has emptiable content.
particle.fType = XSParticleDecl.PARTICLE_ELEMENT;
Attr attr = elmDecl.getAttributeNode(SchemaSymbols.ATT_MINOCCURS);
if (attr != null) {
String min = attr.getValue();
try {
int m = Integer.parseInt(XMLChar.trim(min));
if (m >= 0)
particle.fMinOccurs = m;
}
catch (NumberFormatException ex) {
}
}
fSchemaHandler.fillInLocalElemInfo(elmDecl, schemaDoc, allContextFlags, parent, particle);
} else {
traverseLocal(particle, elmDecl, schemaDoc, grammar, allContextFlags, parent, null);
// If it's an empty particle, return null.
if (particle.fType == XSParticleDecl.PARTICLE_EMPTY)
particle = null;
}
return particle;
}
示例12: addXSObject
import mf.org.apache.xerces.xs.XSObject; //导入依赖的package包/类
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;
}
示例13: itemByName
import mf.org.apache.xerces.xs.XSObject; //导入依赖的package包/类
/**
* 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;
}
示例14: entrySet
import mf.org.apache.xerces.xs.XSObject; //导入依赖的package包/类
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;
}
示例15: getFractionRestriction
import mf.org.apache.xerces.xs.XSObject; //导入依赖的package包/类
private static Integer getFractionRestriction(XSSimpleTypeDecl simpleType)
{
if ((simpleType.getDefinedFacets() & XSSimpleType.FACET_FRACTIONDIGITS) != 0){
XSObjectList facets = simpleType.getFacets();
Integer digits = null;
for (int f = 0; f < facets.getLength(); f++)
{
XSObject item = facets.item(f);
if (item instanceof XSFacet)
{
XSFacet facet = (XSFacet) item;
if (facet.getFacetKind() == XSSimpleType.FACET_FRACTIONDIGITS)
{
try
{
digits = Integer.parseInt(facet.getLexicalFacetValue());
}
catch (RuntimeException ex)
{
log.warn("Error parsing fraction facet value '" + facet.getLexicalFacetValue() + "' : " + ex.getMessage(), ex);
}
}
}
}
return digits;
}
return null;
}