@@ -146,33 +146,48 @@ mystatus_t myhtml_serialization_node_callback(myhtml_tree_node_t* node, mycore_c
146146 if (attr && attr -> key .data && attr -> key .length ) {
147147 if (callback (attr -> key .data , attr -> key .length , ptr ))
148148 return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION ;
149-
149+
150150 attr = attr -> next ;
151151
152- if (attr && attr -> value .length == 6 ) {
153- if (mycore_strcasecmp (attr -> value .data , "SYSTEM" ) == 0 ) {
154- if (callback (" SYSTEM" , 7 , ptr ))
152+ if (attr ) {
153+ myhtml_tree_attr_t * system_id = NULL , * public_id = NULL ;
154+
155+ if (attr -> value .length == 6 ) {
156+ if (mycore_strcasecmp (attr -> value .data , "SYSTEM" ) == 0 ) {
157+ system_id = attr -> next ;
158+ } else if (mycore_strcasecmp (attr -> value .data , "PUBLIC" ) == 0 ) {
159+ public_id = attr -> next ;
160+ system_id = public_id ? public_id -> next : NULL ;
161+ }
162+ }
163+
164+ if (public_id && public_id -> value .length > 0 ) {
165+ if (callback (" PUBLIC \"" , 9 , ptr ))
155166 return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION ;
156- } else if (mycore_strcasecmp (attr -> value .data , "PUBLIC" ) == 0 ) {
157- if (callback (" PUBLIC" , 7 , ptr ))
167+
168+ if (callback (public_id -> value .data , public_id -> value .length , ptr ))
169+ return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION ;
170+
171+ if (callback ("\"" , 1 , ptr ))
158172 return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION ;
159173 }
160174
161- attr = attr -> next ;
162-
163- while (attr ) {
175+ if (system_id && system_id -> value .length > 0 ) {
176+ if (!public_id || public_id -> value .length == 0 ) {
177+ if (callback (" SYSTEM" , 7 , ptr ))
178+ return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION ;
179+ }
180+
164181 if (callback (" \"" , 2 , ptr ))
165182 return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION ;
166183
167- if (attr -> value .data && attr -> value .length ) {
168- if (callback (attr -> value .data , attr -> value .length , ptr ))
184+ if (system_id -> value .data && system_id -> value .length ) {
185+ if (callback (system_id -> value .data , system_id -> value .length , ptr ))
169186 return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION ;
170187 }
171188
172189 if (callback ("\"" , 1 , ptr ))
173190 return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION ;
174-
175- attr = attr -> next ;
176191 }
177192 }
178193 }
0 commit comments