@@ -462,15 +462,16 @@ public JsonToken nextToken() throws IOException
462
462
{
463
463
JsonToken t = nextToken0();
464
464
if (t != null) {
465
+ final String loc = _parsingContext.pathAsPointer().toString();
465
466
switch (t) {
466
467
case FIELD_NAME:
467
- System.out.println ("FromXmlParser.nextToken(): JsonToken.FIELD_NAME '"+ _parsingContext.getCurrentName()+"'" );
468
+ System.out.printf ("FromXmlParser.nextToken() at '%s' : JsonToken.FIELD_NAME '%s'\n", loc, _parsingContext.getCurrentName());
468
469
break;
469
470
case VALUE_STRING:
470
- System.out.println ("FromXmlParser.nextToken(): JsonToken.VALUE_STRING '"+ getText()+"'" );
471
+ System.out.printf ("FromXmlParser.nextToken() at '%s' : JsonToken.VALUE_STRING '%s'\n", loc, getText());
471
472
break;
472
473
default:
473
- System.out.println ("FromXmlParser.nextToken(): "+ t);
474
+ System.out.printf ("FromXmlParser.nextToken() at '%s': %s\n", loc, t);
474
475
}
475
476
}
476
477
return t;
@@ -486,6 +487,7 @@ public JsonToken nextToken() throws IOException
486
487
JsonToken t = _nextToken ;
487
488
_currToken = t ;
488
489
_nextToken = null ;
490
+
489
491
switch (t ) {
490
492
case START_OBJECT :
491
493
_parsingContext = _parsingContext .createChildObjectContext (-1 , -1 );
@@ -501,7 +503,9 @@ public JsonToken nextToken() throws IOException
501
503
_parsingContext .setCurrentName (_xmlTokens .getLocalName ());
502
504
break ;
503
505
default : // VALUE_STRING, VALUE_NULL
504
- // should be fine as is?
506
+ // 13-May-2020, tatu: [dataformat-xml#397]: advance `index` anyway; not
507
+ // used for Object contexts, updated automatically by "createChildXxxContext"
508
+ _parsingContext .valueStarted ();
505
509
}
506
510
return t ;
507
511
}
@@ -564,6 +568,8 @@ public JsonToken nextToken() throws IOException
564
568
}
565
569
// 07-Sep-2019, tatu: for [dataformat-xml#353], must NOT return second null
566
570
if (_currToken != JsonToken .VALUE_NULL ) {
571
+ // 13-May-2020, tatu: [dataformat-xml#397]: advance `index`
572
+ _parsingContext .valueStarted ();
567
573
return (_currToken = JsonToken .VALUE_NULL );
568
574
}
569
575
}
@@ -584,6 +590,8 @@ public JsonToken nextToken() throws IOException
584
590
return (_currToken = JsonToken .FIELD_NAME );
585
591
case XmlTokenStream .XML_ATTRIBUTE_VALUE :
586
592
_currText = _xmlTokens .getText ();
593
+ // 13-May-2020, tatu: [dataformat-xml#397]: advance `index`
594
+ _parsingContext .valueStarted ();
587
595
return (_currToken = JsonToken .VALUE_STRING );
588
596
case XmlTokenStream .XML_TEXT :
589
597
_currText = _xmlTokens .getText ();
@@ -666,6 +674,8 @@ public String nextTextValue() throws IOException
666
674
667
675
// expected case; yes, got a String
668
676
if (t == JsonToken .VALUE_STRING ) {
677
+ // 13-May-2020, tatu: [dataformat-xml#397]: advance `index`
678
+ _parsingContext .valueStarted ();
669
679
return _currText ;
670
680
}
671
681
_updateState (t );
@@ -715,6 +725,8 @@ public String nextTextValue() throws IOException
715
725
// NOTE: this is different from nextToken() -- produce "", NOT null
716
726
_mayBeLeaf = false ;
717
727
_currToken = JsonToken .VALUE_STRING ;
728
+ // 13-May-2020, tatu: [dataformat-xml#397]: advance `index`
729
+ _parsingContext .valueStarted ();
718
730
return (_currText = "" );
719
731
}
720
732
_currToken = _parsingContext .inArray () ? JsonToken .END_ARRAY : JsonToken .END_OBJECT ;
@@ -735,6 +747,8 @@ public String nextTextValue() throws IOException
735
747
break ;
736
748
case XmlTokenStream .XML_ATTRIBUTE_VALUE :
737
749
_currToken = JsonToken .VALUE_STRING ;
750
+ // 13-May-2020, tatu: [dataformat-xml#397]: advance `index`
751
+ _parsingContext .valueStarted ();
738
752
return (_currText = _xmlTokens .getText ());
739
753
case XmlTokenStream .XML_TEXT :
740
754
_currText = _xmlTokens .getText ();
@@ -748,6 +762,8 @@ public String nextTextValue() throws IOException
748
762
}
749
763
// NOTE: this is different from nextToken() -- NO work-around
750
764
// for otherwise empty List/array
765
+ // 13-May-2020, tatu: [dataformat-xml#397]: advance `index`
766
+ _parsingContext .valueStarted ();
751
767
_currToken = JsonToken .VALUE_STRING ;
752
768
return _currText ;
753
769
}
0 commit comments