mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 02:42:44 +00:00 
			
		
		
		
	 de88e119a0
			
		
	
	
		de88e119a0
		
	
	
	
	
		
			
			The main thing that is missing is validating certain pieces of data
against XML productions in well-formed mode, but nothing uses
well-formed mode right now.
Required by Closure Library for sanitising HTML.
e687b3d8ab/closure/goog/html/sanitizer/safedomtreeprocessor.js (L117)
		
	
			
		
			
				
	
	
		
			41 lines
		
	
	
	
		
			900 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
	
		
			900 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2022, Luke Wilde <lukew@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <AK/RefCounted.h>
 | |
| #include <LibWeb/Bindings/Wrappable.h>
 | |
| #include <LibWeb/Forward.h>
 | |
| 
 | |
| namespace Web::DOMParsing {
 | |
| 
 | |
| class XMLSerializer final
 | |
|     : public RefCounted<XMLSerializer>
 | |
|     , public Bindings::Wrappable {
 | |
| public:
 | |
|     using WrapperType = Bindings::XMLSerializerWrapper;
 | |
| 
 | |
|     static NonnullRefPtr<XMLSerializer> create_with_global_object(Bindings::WindowObject&)
 | |
|     {
 | |
|         return adopt_ref(*new XMLSerializer());
 | |
|     }
 | |
| 
 | |
|     virtual ~XMLSerializer() override;
 | |
| 
 | |
|     DOM::ExceptionOr<String> serialize_to_string(NonnullRefPtr<DOM::Node> root);
 | |
| 
 | |
| private:
 | |
|     XMLSerializer();
 | |
| };
 | |
| 
 | |
| enum class RequireWellFormed {
 | |
|     No,
 | |
|     Yes,
 | |
| };
 | |
| 
 | |
| DOM::ExceptionOr<String> serialize_node_to_xml_string(NonnullRefPtr<DOM::Node> root, RequireWellFormed require_well_formed);
 | |
| 
 | |
| }
 |