[YANGTOOLS-1522] XML parser omits leading/trailing whitespace in string values Created: 20/Jul/23  Updated: 21/Jul/23  Resolved: 21/Jul/23

Status: Resolved
Project: yangtools
Component/s: codecs
Affects Version/s: None
Fix Version/s: 11.0.1, 9.0.9, 10.0.9

Type: Bug Priority: Medium
Reporter: Maurizio Brigandi' Assignee: Robert Varga
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Issue split
split to YANGTOOLS-1523 Do not trim XML element text Resolved

 Description   

tested with karaf 18.1

In yang model we have a leaf declared as the following

 

leaf myLeaf {     
  type string {
    length "1..4";
  }
}

 

Case 1)

The leaf is filled with the value="    "

i.e. with four empty spaces:

<myLeaf>    </myLeaf>

ODL raises an error for this case,

because all spaces are removed and the length constraint is not satisfied.

Case 2)

The leaf is filled with four empty encoded spaces, each space is encoded using a xml entity, using & plus #160;

ODL does not raise error,

but the json return by ODL

contains non printable characters,

the encode spaces are not decoded back to plain spaces ...

 

 

 

 

 


Generated at Wed Feb 07 20:56:24 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.