@@ -472,15 +472,16 @@ public JsonToken nextToken() throws IOException
472
472
{
473
473
JsonToken t = nextToken0();
474
474
if (t != null) {
475
+ final String loc = _parsingContext.pathAsPointer().toString();
475
476
switch (t) {
476
477
case FIELD_NAME:
477
- System.out.println ("FromXmlParser.nextToken(): JsonToken.FIELD_NAME '"+ _parsingContext.getCurrentName()+"'" );
478
+ System.out.printf ("FromXmlParser.nextToken() at '%s' : JsonToken.FIELD_NAME '%s'\n", loc, _parsingContext.getCurrentName());
478
479
break;
479
480
case VALUE_STRING:
480
- System.out.println ("FromXmlParser.nextToken(): JsonToken.VALUE_STRING '"+ getText()+"'" );
481
+ System.out.printf ("FromXmlParser.nextToken() at '%s' : JsonToken.VALUE_STRING '%s'\n", loc, getText());
481
482
break;
482
483
default:
483
- System.out.println ("FromXmlParser.nextToken(): "+ t);
484
+ System.out.printf ("FromXmlParser.nextToken() at '%s': %s\n", loc, t);
484
485
}
485
486
}
486
487
return t;
@@ -496,6 +497,7 @@ public JsonToken nextToken() throws IOException
496
497
JsonToken t = _nextToken ;
497
498
_currToken = t ;
498
499
_nextToken = null ;
500
+
499
501
switch (t ) {
500
502
case START_OBJECT :
501
503
_parsingContext = _parsingContext .createChildObjectContext (-1 , -1 );
@@ -511,7 +513,9 @@ public JsonToken nextToken() throws IOException
511
513
_parsingContext .setCurrentName (_xmlTokens .getLocalName ());
512
514
break ;
513
515
default : // VALUE_STRING, VALUE_NULL
514
- // should be fine as is?
516
+ // 13-May-2020, tatu: [dataformat-xml#397]: advance `index` anyway; not
517
+ // used for Object contexts, updated automatically by "createChildXxxContext"
518
+ _parsingContext .valueStarted ();
515
519
}
516
520
return t ;
517
521
}
@@ -574,6 +578,8 @@ public JsonToken nextToken() throws IOException
574
578
}
575
579
// 07-Sep-2019, tatu: for [dataformat-xml#353], must NOT return second null
576
580
if (_currToken != JsonToken .VALUE_NULL ) {
581
+ // 13-May-2020, tatu: [dataformat-xml#397]: advance `index`
582
+ _parsingContext .valueStarted ();
577
583
return (_currToken = JsonToken .VALUE_NULL );
578
584
}
579
585
}
@@ -594,6 +600,8 @@ public JsonToken nextToken() throws IOException
594
600
return (_currToken = JsonToken .FIELD_NAME );
595
601
case XmlTokenStream .XML_ATTRIBUTE_VALUE :
596
602
_currText = _xmlTokens .getText ();
603
+ // 13-May-2020, tatu: [dataformat-xml#397]: advance `index`
604
+ _parsingContext .valueStarted ();
597
605
return (_currToken = JsonToken .VALUE_STRING );
598
606
case XmlTokenStream .XML_TEXT :
599
607
_currText = _xmlTokens .getText ();
@@ -676,6 +684,8 @@ public String nextTextValue() throws IOException
676
684
677
685
// expected case; yes, got a String
678
686
if (t == JsonToken .VALUE_STRING ) {
687
+ // 13-May-2020, tatu: [dataformat-xml#397]: advance `index`
688
+ _parsingContext .valueStarted ();
679
689
return _currText ;
680
690
}
681
691
_updateState (t );
@@ -725,6 +735,8 @@ public String nextTextValue() throws IOException
725
735
// NOTE: this is different from nextToken() -- produce "", NOT null
726
736
_mayBeLeaf = false ;
727
737
_currToken = JsonToken .VALUE_STRING ;
738
+ // 13-May-2020, tatu: [dataformat-xml#397]: advance `index`
739
+ _parsingContext .valueStarted ();
728
740
return (_currText = "" );
729
741
}
730
742
_currToken = _parsingContext .inArray () ? JsonToken .END_ARRAY : JsonToken .END_OBJECT ;
@@ -745,6 +757,8 @@ public String nextTextValue() throws IOException
745
757
break ;
746
758
case XmlTokenStream .XML_ATTRIBUTE_VALUE :
747
759
_currToken = JsonToken .VALUE_STRING ;
760
+ // 13-May-2020, tatu: [dataformat-xml#397]: advance `index`
761
+ _parsingContext .valueStarted ();
748
762
return (_currText = _xmlTokens .getText ());
749
763
case XmlTokenStream .XML_TEXT :
750
764
_currText = _xmlTokens .getText ();
@@ -758,6 +772,8 @@ public String nextTextValue() throws IOException
758
772
}
759
773
// NOTE: this is different from nextToken() -- NO work-around
760
774
// for otherwise empty List/array
775
+ // 13-May-2020, tatu: [dataformat-xml#397]: advance `index`
776
+ _parsingContext .valueStarted ();
761
777
_currToken = JsonToken .VALUE_STRING ;
762
778
return _currText ;
763
779
}
0 commit comments