class Amber::Schema::Parser::XMLParser

Defined in:

amber/schema/parsers/xml_parser.cr

Class Method Summary

Instance Method Summary

Instance methods inherited from class Amber::Schema::Parser::Base

can_parse?(value : JSON::Any) : Bool can_parse?, parse(value : JSON::Any) : JSON::Any parse

Class Method Detail

def self.create_parse_error(xml_string : String, error : XML::Error) : SchemaDefinitionError #

Create detailed parse error with context


[View source]
def self.extract_default_fields(document : XML::Node) : Hash(String, JSON::Any) #

Extract default fields from XML document (without schema)


[View source]
def self.extract_fields_with_schema(xml_string : String, schema : Definition) : Hash(String, JSON::Any) #

Extract fields from XML using schema field definitions with XPath support


[View source]
def self.extract_namespace_declarations(element : XML::Node) : Hash(String, String) #

Handle XML namespace declarations


[View source]
def self.extract_node_value(node : XML::Node) : JSON::Any #

Extract value from XML node


[View source]
def self.extract_text_content(element : XML::Node) : String #

Extract text content from mixed content (handling CDATA)


[View source]
def self.handle_xml_errors(&) #

Error handling for malformed XML


[View source]
def self.is_text_only?(element : XML::Node) : Bool #

Check if element contains only text content (no child elements)


[View source]
def self.parse_request(request : HTTP::Request) : Hash(String, JSON::Any) #

Parse HTTP request body


[View source]
def self.parse_string(xml_string : String) : Hash(String, JSON::Any) #

Parse raw XML string into Hash suitable for schema validation


[View source]
def self.parse_with_namespaces(xml_string : String, explicit_namespaces : Hash(String, String) = {} of String => String) : Hash(String, JSON::Any) #

Parse XML with explicit namespace handling


[View source]
def self.parse_xml_value(value : String) : JSON::Any #

Parse XML string value to appropriate JSON type


[View source]
def self.validate_xml(xml_string : String, schema : Definition) : Array(Error) #

Validate XML against schema (used for error reporting)


[View source]

Instance Method Detail

def can_parse?(value : JSON::Any) : Bool #

[View source]
def parse(value : JSON::Any) : JSON::Any #

Instance methods for Parser::Base interface


[View source]