1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.tuscany.core.databinding.xml;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import javax.xml.namespace.NamespaceContext;
import javax.xml.namespace.QName;
import javax.xml.stream.Location;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
/**
* This is the new implementation of the XMLFramentStreamReader. The approach
* here is simple When the pull parser needs to generate events for a particular
* name-value(s) pair it always handes over (delegates) the task to another pull
* parser which knows how to deal with it The common types of name value pairs
* we'll come across are
* <ul>
* <li> String name/QName name - String value
* <li> String name/QName name - String[] value
* <li> QName name/String name - XMLStreamReader value
* <li> QName name/String name - XMLStreamable value
* <li> QName name/String name - Java bean
* <li> QName name/String name - Datahandler
*
* </ul>
* <p/> As for the attributes, these are the possible combinations in the array
* <ul>
* <li> String name/QName name - String value
* </ul>
* Note that certain array methods have been deliberately removed to avoid
* complications. The generated code will take the trouble to lay the elements
* of the array in the correct order <p/> <p/> Hence there will be a parser impl
* that knows how to handle these types, and this parent parser will always
* delegate these tasks to the child pullparasers in effect this is one huge
* state machine that has only a few states and delegates things down to the
* child parsers whenever possible <p/>
*
* @version $Rev$ $Date$
*/
public class XMLFragmentStreamReaderImpl implements XMLFragmentStreamReader {
private static final int DELEGATED_STATE = 2;
private static final int END_ELEMENT_STATE = 1;
// states for this pullparser - it can only have four states
private static final int START_ELEMENT_STATE = 0;
private static final int TEXT_STATE = 3;
protected NamedProperty[] attributes;
// reference to the child reader
protected XMLFragmentStreamReader childReader;
// current property index
// initialized at zero
protected int index;
protected Map<String, String> declaredNamespaceMap = new HashMap<String, String>();
protected QName elementQName;
// we always create a new namespace context
protected DelegatingNamespaceContext namespaceContext = new DelegatingNamespaceContext();
protected NamedProperty[] elements;
// integer field that keeps the state of this
// parser.
protected int state = START_ELEMENT_STATE;
/*
* we need to pass in a namespace context since when delegated, we've no
* idea of the current namespace context. So it needs to be passed on here!
*/
public XMLFragmentStreamReaderImpl(QName elementQName, NamedProperty[] elements, NamedProperty[] attributes) {
// validate the lengths, since both the arrays are supposed
// to have
this.elements = elements == null ? new NamedProperty[0] : elements;
this.elementQName = elementQName;
this.attributes = attributes == null ? new NamedProperty[0] : attributes;
}
protected XMLFragmentStreamReaderImpl(QName elementQName) {
this.elementQName = elementQName;
}
/**
* add the namespace context
*/
public void setParentNamespaceContext(NamespaceContext nsContext) {
// register the namespace context passed in to this
this.namespaceContext.setParentNsContext(nsContext);
}
protected NamedProperty[] getElements() {
return elements;
}
protected NamedProperty[] getAttributes() {
return attributes;
}
protected QName[] getNamespaces() {
return new QName[0];
}
/**
* @param prefix
* @param uri
*/
protected void addToNsMap(String prefix, String uri) {
if (!uri.equals(namespaceContext.getNamespaceURI(prefix))) {
namespaceContext.pushNamespace(prefix, uri);
declaredNamespaceMap.put(prefix, uri);
}
}
public void close() throws XMLStreamException {
// do nothing here - we have no resources to free
}
public int getAttributeCount() {
return (state == DELEGATED_STATE) ? childReader.getAttributeCount() : (state == START_ELEMENT_STATE
? getAttributes().length : 0);
}
public String getAttributeLocalName(int i) {
if (state == DELEGATED_STATE) {
return childReader.getAttributeLocalName(i);
} else if (state == START_ELEMENT_STATE) {
QName name = getAttributeName(i);
if (name == null) {
return null;
} else {
return name.getLocalPart();
}
} else {
throw new IllegalStateException();
}
}
/**
* @param i
*/
public QName getAttributeName(int i) {
if (state == DELEGATED_STATE) {
return childReader.getAttributeName(i);
} else if (state == START_ELEMENT_STATE) {
if ((i >= (getAttributes().length)) || i < 0) { // out of range
return null;
} else {
// get the attribute pointer
QName attribPointer = getAttributes()[i].getKey();
// case one - attrib name is null
// this should be the pointer to the OMAttribute then
if (attribPointer == null) {
throw new UnsupportedOperationException();
} else if (attribPointer instanceof QName) {
return (QName)attribPointer;
} else {
return null;
}
}
} else {
throw new IllegalStateException(); // as per the api contract
}
}
public String getAttributeNamespace(int i) {
if (state == DELEGATED_STATE) {
return childReader.getAttributeNamespace(i);
} else if (state == START_ELEMENT_STATE) {
QName name = getAttributeName(i);
if (name == null) {
return null;
} else {
return name.getNamespaceURI();
}
} else {
throw new IllegalStateException();
}
}
public String getAttributePrefix(int i) {
if (state == DELEGATED_STATE) {
return childReader.getAttributePrefix(i);
} else if (state == START_ELEMENT_STATE) {
QName name = getAttributeName(i);
if (name == null) {
return null;
} else {
return name.getPrefix();
}
} else {
throw new IllegalStateException();
}
}
public String getAttributeType(int i) {
return null; // not supported
}
public String getAttributeValue(int i) {
if (state == DELEGATED_STATE) {
return childReader.getAttributeValue(i);
} else if (state == START_ELEMENT_STATE) {
if ((i >= (getAttributes().length)) || i < 0) { // out of range
return null;
} else {
// get the attribute pointer
QName attribPointer = getAttributes()[i].getKey();
Object omAttribObj = getAttributes()[i].getValue();
// case one - attrib name is null
// this should be the pointer to the OMAttribute then
if (attribPointer == null) {
throw new UnsupportedOperationException();
} else if (attribPointer instanceof QName) {
return (String)omAttribObj;
} else {
return null;
}
}
} else {
throw new IllegalStateException();
}
}
public String getAttributeValue(String nsUri, String localName) {
int attribCount = getAttributeCount();
String returnValue = null;
QName attribQualifiedName;
for (int i = 0; i < attribCount; i++) {
attribQualifiedName = getAttributeName(i);
if (nsUri == null) {
if (localName.equals(attribQualifiedName.getLocalPart())) {
returnValue = getAttributeValue(i);
break;
}
} else {
if (localName.equals(attribQualifiedName.getLocalPart()) && nsUri.equals(attribQualifiedName
.getNamespaceURI())) {
returnValue = getAttributeValue(i);
break;
}
}
}
return returnValue;
}
public String getCharacterEncodingScheme() {
return null; // todo - should we return something for this ?
}
/**
* todo implement the right contract for this
*
* @throws XMLStreamException
*/
public String getElementText() throws XMLStreamException {
if (state == DELEGATED_STATE) {
return childReader.getElementText();
} else {
return null;
}
}
// /////////////////////////////////////////////////////////////////////////
// / attribute handling
// /////////////////////////////////////////////////////////////////////////
public String getEncoding() {
if (state == DELEGATED_STATE) {
return childReader.getEncoding();
} else {
// we've no idea what the encoding is going to be in this case
// perhaps we ought to return some constant here, which the user
// might
// have access to change!
return null;
}
}
public int getEventType() {
if (state == START_ELEMENT_STATE) {
return START_ELEMENT;
} else if (state == END_ELEMENT_STATE) {
return END_ELEMENT;
} else if (state == TEXT_STATE) {
return CHARACTERS;
} else { // this is the delegated state
return childReader.getEventType();
}
}
public String getLocalName() {
if (state == DELEGATED_STATE) {
return childReader.getLocalName();
} else if (state != TEXT_STATE) {
return elementQName.getLocalPart();
} else {
throw new IllegalStateException();
}
}
/**
*/
public Location getLocation() {
// return a default location
return new Location() {
public int getCharacterOffset() {
return 0;
}
public int getColumnNumber() {
return 0;
}
public int getLineNumber() {
return 0;
}
public String getPublicId() {
return null;
}
public String getSystemId() {
return null;
}
};
}
public QName getName() {
if (state == DELEGATED_STATE) {
return childReader.getName();
} else if (state != TEXT_STATE) {
return elementQName;
} else {
throw new IllegalStateException();
}
}
public NamespaceContext getNamespaceContext() {
if (state == DELEGATED_STATE) {
return childReader.getNamespaceContext();
} else {
return namespaceContext;
}
}
public int getNamespaceCount() {
if (state == DELEGATED_STATE) {
return childReader.getNamespaceCount();
} else {
return declaredNamespaceMap.size();
}
}
/**
* @param i
*/
public String getNamespacePrefix(int i) {
if (state == DELEGATED_STATE) {
return childReader.getNamespacePrefix(i);
} else if (state != TEXT_STATE) {
// order the prefixes
String[] prefixes = makePrefixArray();
if ((i >= prefixes.length) || (i < 0)) {
return null;
} else {
return prefixes[i];
}
} else {
throw new IllegalStateException();
}
}
public String getNamespaceURI() {
if (state == DELEGATED_STATE) {
return childReader.getNamespaceURI();
} else if (state == TEXT_STATE) {
return null;
} else {
return elementQName.getNamespaceURI();
}
}
// /////////////////////////////////////////////////////////////////////////
// //////////// end of attribute handling
// /////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////////
// //////////// namespace handling
// //////////////////////////////////////////////////////////////////////////
public String getNamespaceURI(int i) {
if (state == DELEGATED_STATE) {
return childReader.getNamespaceURI(i);
} else if (state != TEXT_STATE) {
String namespacePrefix = getNamespacePrefix(i);
return namespacePrefix == null ? null : (String)declaredNamespaceMap.get(namespacePrefix);
} else {
throw new IllegalStateException();
}
}
public String getNamespaceURI(String prefix) {
return namespaceContext.getNamespaceURI(prefix);
}
public String getPIData() {
throw new UnsupportedOperationException("Yet to be implemented !!");
}
public String getPITarget() {
throw new UnsupportedOperationException("Yet to be implemented !!");
}
public String getPrefix() {
if (state == DELEGATED_STATE) {
return childReader.getPrefix();
} else if (state == TEXT_STATE) {
return null;
} else {
String prefix = elementQName.getPrefix();
return "".equals(prefix) ? null : prefix;
}
}
// /////////////////////////////////////////////////////////////////////////
// /////// end of namespace handling
// /////////////////////////////////////////////////////////////////////////
/**
* @param key
* @throws IllegalArgumentException
*/
public Object getProperty(String key) throws IllegalArgumentException {
if (state == START_ELEMENT_STATE || state == END_ELEMENT_STATE) {
return null;
} else if (state == TEXT_STATE) {
return null;
} else if (state == DELEGATED_STATE) {
return childReader.getProperty(key);
} else {
return null;
}
}
public String getText() {
if (state == DELEGATED_STATE) {
return childReader.getText();
} else if (state == TEXT_STATE) {
return (String)getElements()[index - 1].getValue();
} else {
throw new IllegalStateException();
}
}
public char[] getTextCharacters() {
if (state == DELEGATED_STATE) {
return childReader.getTextCharacters();
} else if (state == TEXT_STATE) {
return getElements()[index - 1].getValue() == null ? new char[0] : ((String)getElements()[index - 1]
.getValue()).toCharArray();
} else {
throw new IllegalStateException();
}
}
private int copy(int sourceStart, char[] target, int targetStart, int length) {
char[] source = getTextCharacters();
if (sourceStart > source.length) {
throw new IndexOutOfBoundsException("source start > source length");
}
int sourceLen = source.length - sourceStart;
if (length > sourceLen) {
length = sourceLen;
}
System.arraycopy(source, sourceStart, target, targetStart, length);
return sourceLen;
}
public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException {
if (state == DELEGATED_STATE) {
return childReader.getTextCharacters(i, chars, i1, i2);
} else if (state == TEXT_STATE) {
return copy(i, chars, i1, i2);
} else {
throw new IllegalStateException();
}
}
public int getTextLength() {
if (state == DELEGATED_STATE) {
return childReader.getTextLength();
} else if (state == TEXT_STATE) {
return getTextCharacters().length;
} else {
throw new IllegalStateException();
}
}
public int getTextStart() {
if (state == DELEGATED_STATE) {
return childReader.getTextStart();
} else if (state == TEXT_STATE) {
return 0; // assume text always starts at 0
} else {
throw new IllegalStateException();
}
}
public String getVersion() {
return null;
}
public boolean hasName() {
// since this parser always has a name, the hasname
// has to return true if we are still navigating this element
// if not we should ask the child reader for it.
if (state == DELEGATED_STATE) {
return childReader.hasName();
} else {
return state != TEXT_STATE;
}
}
/**
* @throws XMLStreamException
*/
public boolean hasNext() throws XMLStreamException {
if (state == DELEGATED_STATE) {
if (childReader.isDone()) {
// the child reader is done. We shouldn't be getting the
// hasnext result from the child pullparser then
return true;
} else {
return childReader.hasNext();
}
} else {
return state == START_ELEMENT_STATE || state == TEXT_STATE;
}
}
/**
* check the validity of this implementation
*/
public boolean hasText() {
if (state == DELEGATED_STATE) {
return childReader.hasText();
} else {
return state == TEXT_STATE;
}
}
/**
* we need to split out the calling to the populate namespaces seperately
* since this needs to be done *after* setting the parent namespace context.
* We cannot assume it will happen at construction!
*/
public void init() {
// here we have an extra issue to attend to. we need to look at the
// prefixes and uris (the combination) and populate a hashmap of
// namespaces. The hashmap of namespaces will be used to serve the
// namespace context
populateNamespaceContext();
}
public boolean isAttributeSpecified(int i) {
return false; // not supported
}
public boolean isCharacters() {
if (state == START_ELEMENT_STATE || state == END_ELEMENT_STATE) {
return false;
}
return childReader.isCharacters();
}
/**
* are we done ?
*/
public boolean isDone() {
return state == END_ELEMENT_STATE;
}
public boolean isEndElement() {
if (state == START_ELEMENT_STATE) {
return false;
} else if (state == END_ELEMENT_STATE) {
return true;
}
return childReader.isEndElement();
}
public boolean isStandalone() {
return true;
}
public boolean isStartElement() {
if (state == START_ELEMENT_STATE) {
return true;
} else if (state == END_ELEMENT_STATE) {
return false;
}
return childReader.isStartElement();
}
public boolean isWhiteSpace() {
if (state == START_ELEMENT_STATE || state == END_ELEMENT_STATE) {
return false;
}
return childReader.isWhiteSpace();
}
/**
* Get the prefix list from the hastable and take that into an array
*/
private String[] makePrefixArray() {
String[] prefixes = (String[])declaredNamespaceMap.keySet().toArray(new String[declaredNamespaceMap.size()]);
Arrays.sort(prefixes);
return prefixes;
}
/**
* By far this should be the most important method in this class this method
* changes the state of the parser
*/
public int next() throws XMLStreamException {
int returnEvent = -1; // invalid state is the default state
switch (state) {
case START_ELEMENT_STATE:
// current element is start element. We should be looking at the
// property list and making a pullparser for the property value
if (getElements() == null || getElements().length == 0) {
// no properties - move to the end element state
// straightaway
state = END_ELEMENT_STATE;
returnEvent = END_ELEMENT;
} else {
// there are properties. now we should delegate this task to
// a
// child reader depending on the property type
returnEvent = processProperties();
}
break;
case END_ELEMENT_STATE:
// we've reached the end element already. If the user tries to
// push
// further ahead then it is an exception
throw new XMLStreamException("Trying to go beyond the end of the pullparser");
case DELEGATED_STATE:
if (childReader.isDone()) {
// we've reached the end!
if (index > (getElements().length - 1)) {
state = END_ELEMENT_STATE;
returnEvent = END_ELEMENT;
} else {
returnEvent = processProperties();
}
} else {
returnEvent = childReader.next();
}
break;
case TEXT_STATE:
// if there are any more event we should be delegating to
// processProperties. if not we just return an end element
if (index > (getElements().length - 1)) {
state = END_ELEMENT_STATE;
returnEvent = END_ELEMENT;
} else {
returnEvent = processProperties();
}
break;
}
return returnEvent;
}
// /////////////////////////////////////////////////////////////////////////
// / Other utility methods
// ////////////////////////////////////////////////////////////////////////
/**
* todo implement this
*
* @throws XMLStreamException
*/
public int nextTag() throws XMLStreamException {
return 0;
}
/**
* Populates a namespace context
*/
private void populateNamespaceContext() {
// first add the current element namespace to the namespace context
// declare it if not found
addToNsMap(elementQName.getPrefix(), elementQName.getNamespaceURI());
for (QName n : getNamespaces()) {
addToNsMap(n.getPrefix(), n.getNamespaceURI());
}
// traverse through the attributes and populate the namespace context
// the attrib list can be of many combinations
// the valid combinations are
// String - String
// QName - QName
// null - OMAttribute
for (int i = 0; i < getAttributes().length; i++) { // jump in two
QName attrQName = getAttributes()[i].getKey();
if (!"".equals(attrQName.getNamespaceURI())) {
addToNsMap(attrQName.getPrefix(), attrQName.getNamespaceURI());
}
}
}
/**
* A convenient method to reuse the properties
*
* @return event to be thrown
* @throws XMLStreamException
*/
private int processProperties() throws XMLStreamException {
// move to the next property depending on the current property
// index
QName propertyQName = getElements()[index].getKey();
boolean textFound = false;
if (propertyQName == null) {
throw new XMLStreamException("property key cannot be null!");
} else if (ELEMENT_TEXT.equals(propertyQName.getLocalPart())) {
// propPointer being a String has a special case
// that is it can be a the special constant ELEMENT_TEXT that
// says this text event
textFound = true;
}
// ok! we got the key. Now look at the value
Object propertyValue = getElements()[index].getValue();
// cater for the special case now
if (textFound) {
// no delegation here - make the parser null and immediately
// return with the event characters
childReader = null;
state = TEXT_STATE;
++index;
return CHARACTERS;
} else if (propertyValue == null) {
// if the value is null we delegate the work to a nullable
// parser
childReader = new NilElementStreamReader(propertyQName);
childReader.setParentNamespaceContext(this.namespaceContext);
childReader.init();
} else if (propertyValue instanceof String) {
// strings are handled by the NameValuePairStreamReader
childReader = new NameValuePairStreamReader(propertyQName, (String)propertyValue);
childReader.setParentNamespaceContext(this.namespaceContext);
childReader.init();
} else if (propertyValue instanceof String[]) {
// string[] are handled by the NameValueArrayStreamReader
// if the array is empty - skip it
if (((String[])propertyValue).length == 0) {
// advance the index
++index;
return processProperties();
} else {
childReader = new NameValueArrayStreamReader(propertyQName, (String[])propertyValue);
childReader.setParentNamespaceContext(this.namespaceContext);
childReader.init();
}
} else if (propertyValue instanceof XMLStreamable) {
// ADBbean has it's own method to get a reader
XMLStreamReader reader = ((XMLStreamable)propertyValue).getXMLStreamReader(propertyQName);
// we know for sure that this is an ADB XMLStreamreader.
// However we need to make sure that it is compatible
if (reader instanceof XMLFragmentStreamReader) {
childReader = (XMLFragmentStreamReader)reader;
childReader.setParentNamespaceContext(this.namespaceContext);
childReader.init();
} else {
// wrap it to make compatible
childReader = new WrappingXMLStreamReader(reader);
}
} else if (propertyValue instanceof XMLStreamReader) {
XMLStreamReader reader = (XMLStreamReader)propertyValue;
if (reader instanceof XMLFragmentStreamReader) {
childReader = (XMLFragmentStreamReader)reader;
childReader.setParentNamespaceContext(this.namespaceContext);
childReader.init();
} else {
// wrap it to make compatible
childReader = new WrappingXMLStreamReader(reader);
}
} else {
// all special possiblilities has been tried! Let's treat
// the thing as a bean and try generating events from it
childReader = new WrappingXMLStreamReader(BeanUtil.getXMLStreamReader(propertyValue, propertyQName));
// we cannot register the namespace context here
}
// set the state here
state = DELEGATED_STATE;
// we are done with the delegation
// increment the property index
++index;
return childReader.getEventType();
}
public void require(int i, String string, String string1) throws XMLStreamException {
throw new UnsupportedOperationException();
}
public boolean standaloneSet() {
return true;
}
}
|