MCPcopy Create free account
hub / github.com/dumbledore/AlbiteREADER / adjustNsp

Method adjustNsp

src/org/kxml2/io/KXmlParser.java:111–221  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

109 }
110
111 private final boolean adjustNsp() throws XmlPullParserException {
112
113 boolean any = false;
114
115 for (int i = 0; i < attributeCount << 2; i += 4) {
116 // * 4 - 4; i >= 0; i -= 4) {
117
118 String attrName = attributes[i + 2];
119 int cut = attrName.indexOf(':');
120 String prefix;
121
122 if (cut != -1) {
123 prefix = attrName.substring(0, cut);
124 attrName = attrName.substring(cut + 1);
125 }
126 else if (attrName.equals("xmlns")) {
127 prefix = attrName;
128 attrName = null;
129 }
130 else
131 continue;
132
133 if (!prefix.equals("xmlns")) {
134 any = true;
135 }
136 else {
137 int j = (nspCounts[depth]++) << 1;
138
139 nspStack = ensureCapacity(nspStack, j + 2);
140 nspStack[j] = attrName;
141 nspStack[j + 1] = attributes[i + 3];
142
143 if (attrName != null && attributes[i + 3].equals(""))
144 error("illegal empty namespace");
145
146 // prefixMap = new PrefixMap (prefixMap, attrName, attr.getValue ());
147
148 //System.out.println (prefixMap);
149
150 System.arraycopy(
151 attributes,
152 i + 4,
153 attributes,
154 i,
155 ((--attributeCount) << 2) - i);
156
157 i -= 4;
158 }
159 }
160
161 if (any) {
162 for (int i = (attributeCount << 2) - 4; i >= 0; i -= 4) {
163
164 String attrName = attributes[i + 2];
165 int cut = attrName.indexOf(':');
166
167 if (cut == 0 && !relaxed)
168 throw new RuntimeException(

Callers 1

parseStartTagMethod · 0.95

Calls 5

ensureCapacityMethod · 0.95
errorMethod · 0.95
getNamespaceMethod · 0.95
indexOfMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected