1 57 58 package com.sun.org.apache.xerces.internal.impl.xs; 59 60 import com.sun.org.apache.xerces.internal.util.NamespaceSupport; 61 62 71 public class SchemaNamespaceSupport 72 extends NamespaceSupport { 73 74 public SchemaNamespaceSupport () { 75 super(); 76 } 78 public SchemaNamespaceSupport(SchemaNamespaceSupport nSupport) { 80 fNamespaceSize = nSupport.fNamespaceSize; 81 if (fNamespace.length < fNamespaceSize) 82 fNamespace = new String [fNamespaceSize]; 83 System.arraycopy(nSupport.fNamespace, 0, fNamespace, 0, fNamespaceSize); 84 fCurrentContext = nSupport.fCurrentContext; 85 if (fContext.length <= fCurrentContext) 86 fContext = new int[fCurrentContext+1]; 87 System.arraycopy(nSupport.fContext, 0, fContext, 0, fCurrentContext+1); 88 } 90 101 public void setEffectiveContext (String [] namespaceDecls) { 102 if(namespaceDecls == null || namespaceDecls.length == 0) return; 103 pushContext(); 104 int newSize = fNamespaceSize + namespaceDecls.length; 105 if (fNamespace.length < newSize) { 106 String [] tempNSArray = new String [newSize]; 108 System.arraycopy(fNamespace, 0, tempNSArray, 0, fNamespace.length); 109 fNamespace = tempNSArray; 110 } 111 System.arraycopy(namespaceDecls, 0, fNamespace, fNamespaceSize, 112 namespaceDecls.length); 113 fNamespaceSize = newSize; 114 } 116 121 public String [] getEffectiveLocalContext() { 122 String [] returnVal = null; 128 if (fCurrentContext >= 3) { 129 int bottomLocalContext = fContext[3]; 130 int copyCount = fNamespaceSize - bottomLocalContext; 131 if (copyCount > 0) { 132 returnVal = new String [copyCount]; 133 System.arraycopy(fNamespace, bottomLocalContext, returnVal, 0, 134 copyCount); 135 } 136 } 137 return returnVal; 138 } 140 public void makeGlobal() { 143 if (fCurrentContext >= 3) { 144 fCurrentContext = 3; 145 fNamespaceSize = fContext[3]; 146 } 147 } } | Popular Tags |