@@ -1460,7 +1460,7 @@ namespace folia {
14601460 }
14611461 if ( parent->isSubClass <AbstractSpanRole>() ){
14621462 // we should check the textclass of the layer above this.
1463- // but due to recusion , it is not connected to that layer yet!
1463+ // but due to recursion , it is not connected to that layer yet!
14641464 return true ;
14651465 }
14661466 if ( !_tval.empty () ){
@@ -1488,22 +1488,26 @@ namespace folia {
14881488 * \return the parsed tree. Throws on error.
14891489 */
14901490 KWargs atts = getAttributes ( node );
1491- string id = atts[ " id" ] ;
1491+ string id = atts. extract ( " id" ) ;
14921492 if ( id.empty () ) {
14931493 throw XmlError ( this ,
14941494 " empty id in WordReference" );
14951495 }
14961496 if ( doc ()->debug % DocDbg::PARSING ) {
14971497 DBG << " Found word reference: " << id << endl;
14981498 }
1499+ _tval = atts.extract (" t" );
1500+ if ( !atts.empty () ){
1501+ throw XmlError ( this ,
1502+ " unsupported attribute(s) in wref: " + toString (atts) );
1503+ }
14991504 FoliaElement *ref = (*doc ())[id];
15001505 if ( ref ) {
15011506 if ( !ref->referable () ){
15021507 throw XmlError ( this ,
15031508 " WordReference id=" + id + " refers to a non-referable word: "
15041509 + ref->xmltag () );
15051510 }
1506- _tval = atts[" t" ];
15071511 ref->increfcount ();
15081512 }
15091513 else {
@@ -1534,20 +1538,20 @@ namespace folia {
15341538 * \param node a LinkReference
15351539 * \return the parsed tree. Throws on error.
15361540 */
1537- KWargs att = getAttributes ( node );
1538- string val = att[ " id" ] ;
1539- if ( val .empty () ) {
1541+ KWargs atts = getAttributes ( node );
1542+ ref_id = atts. extract ( " id" ) ;
1543+ if ( ref_id .empty () ) {
15401544 throw XmlError ( this ,
15411545 " ID required for LinkReference" );
15421546 }
1543- ref_id = val;
15441547 if ( doc ()->debug % DocDbg::PARSING ) {
15451548 DBG << " Found LinkReference ID " << ref_id << endl;
15461549 }
1547- ref_type = att[" type" ];
1548- val = att[" t" ];
1549- if ( !val.empty () ) {
1550- _t = val;
1550+ ref_type = atts.extract (" type" );
1551+ _t = atts.extract (" t" );
1552+ if ( !atts.empty () ){
1553+ throw XmlError ( this ,
1554+ " unsupported attribute(s) in wref: " + toString (atts) );
15511555 }
15521556 return this ;
15531557 }
@@ -2852,11 +2856,11 @@ namespace folia {
28522856 * the associated Document
28532857 */
28542858 KWargs att = getAttributes ( node );
2855- setAttributes ( att );
2856- /* if ( _include ) {
2857- doc()->addExternal( this );
2858- }*/
2859- return this ;
2859+ setAttributes ( att );
2860+ /* if ( _include ) {
2861+ doc()->addExternal( this );
2862+ }*/
2863+ return this ;
28602864 }
28612865
28622866 void Note::setAttributes ( KWargs& kwargs ) {
0 commit comments