[NETCONF-988] Convert xml pretty print Created: 31/Mar/23  Updated: 04/Apr/23  Resolved: 04/Apr/23

Status: Resolved
Project: netconf
Component/s: netconf
Affects Version/s: None
Fix Version/s: 4.0.6, 5.0.5

Type: Improvement Priority: Low
Reporter: zhao wei Assignee: zhao wei
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

When we print NetconfMessage, we found that, the print like this:

<notification xmlns="urn:ietf:params:netconf:capability:notification:1.0">    <event-notification xmlns="http://openconfig.net/yang/event">
    
        <events>
        
            <id>MODULE_EVENT_1</id>
            
            <resource/>
            
            <text>transceiver plug off</text>
            
            <time-created>1679874955</time-created>
            
            <severity xmlns:oc-alarm-types="http://openconfig.net/yang/alarms/types">oc-alarm-types:MAJOR</severity>
            
            <type-id>EVENT</type-id>
            
            <vendor-type/>
            
            <event-abbreviate>MODULE-PLUGOFF</event-abbreviate>
            
            <hostname>test</hostname>
            
        </events>
        
    </event-notification>
    
    <eventTime>2023-03-31T02:16:18.672Z</eventTime>
    
</notification> 

his has been discussed in this JDK bug ticket.

We shoud use a stylesheet to remove empty Text nodes.



 Comments   
Comment by zhao wei [ 31/Mar/23 ]

In this patch, the NetconfMessage print like this:

<notification xmlns="urn:ietf:params:netconf:capability:notification:1.0">
    <event-notification xmlns="http://openconfig.net/yang/event">    
        <events>        
            <id>MODULE_EVENT_1</id>            
            <resource/>            
            <text>transceiver plug off</text>            
            <time-created>1679874955</time-created>            
            <severity xmlns:oc-alarm-types="http://openconfig.net/yang/alarms/types">oc-alarm-types:MAJOR</severity>            
            <type-id>EVENT</type-id>            
            <vendor-type/>            
            <event-abbreviate>MODULE-PLUGOFF</event-abbreviate>
            <hostname>test</hostname>
        </events>
    </event-notification>
    <eventTime>2023-03-31T02:16:18.672Z</eventTime>
</notification>
 
Generated at Wed Feb 07 20:16:24 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.