1 16 17 package org.apache.xerces.impl.xs; 18 19 import org.apache.xerces.util.NamespaceSupport; 20 21 32 public class SchemaNamespaceSupport 33 extends NamespaceSupport { 34 35 public SchemaNamespaceSupport () { 36 super(); 37 } 39 public SchemaNamespaceSupport(SchemaNamespaceSupport nSupport) { 41 fNamespaceSize = nSupport.fNamespaceSize; 42 if (fNamespace.length < fNamespaceSize) 43 fNamespace = new String [fNamespaceSize]; 44 System.arraycopy(nSupport.fNamespace, 0, fNamespace, 0, fNamespaceSize); 45 fCurrentContext = nSupport.fCurrentContext; 46 if (fContext.length <= fCurrentContext) 47 fContext = new int[fCurrentContext+1]; 48 System.arraycopy(nSupport.fContext, 0, fContext, 0, fCurrentContext+1); 49 } 51 62 public void setEffectiveContext (String [] namespaceDecls) { 63 if(namespaceDecls == null || namespaceDecls.length == 0) return; 64 pushContext(); 65 int newSize = fNamespaceSize + namespaceDecls.length; 66 if (fNamespace.length < newSize) { 67 String [] tempNSArray = new String [newSize]; 69 System.arraycopy(fNamespace, 0, tempNSArray, 0, fNamespace.length); 70 fNamespace = tempNSArray; 71 } 72 System.arraycopy(namespaceDecls, 0, fNamespace, fNamespaceSize, 73 namespaceDecls.length); 74 fNamespaceSize = newSize; 75 } 77 82 public String [] getEffectiveLocalContext() { 83 String [] returnVal = null; 89 if (fCurrentContext >= 3) { 90 int bottomLocalContext = fContext[3]; 91 int copyCount = fNamespaceSize - bottomLocalContext; 92 if (copyCount > 0) { 93 returnVal = new String [copyCount]; 94 System.arraycopy(fNamespace, bottomLocalContext, returnVal, 0, 95 copyCount); 96 } 97 } 98 return returnVal; 99 } 101 public void makeGlobal() { 104 if (fCurrentContext >= 3) { 105 fCurrentContext = 3; 106 fNamespaceSize = fContext[3]; 107 } 108 } } | Popular Tags |