moxml 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/moxml/adapter/leptris.rb +0 -20
- data/lib/moxml/adapter/libxml.rb +5 -1
- data/lib/moxml/version.rb +1 -1
- data/lib/moxml/xpath/compiler.rb +0 -4
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 837d647ac39dac23aae2389b6150eafbecf405788f5c62e09af616aa0644715c
|
|
4
|
+
data.tar.gz: c7a427e0cf685dd3121e0e5afdfcf388a0d18c52766f22717c8bb8b7d02cecf2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2e59a3705d492b273708e0d82fa10078be543c4aca86daa7fe7c7c1e90b13ecc774ac89934458b3373d46045e4a2f3fa7eef46172045bbe8ae4fd5105c03030c
|
|
7
|
+
data.tar.gz: c8f15cc1577514a368e551444f0e0759170e77e5969a383e0b43025d733e75be8ec99869e43f9fd459f2ac1c0d0c422b26d9e98c73823d76fd18d585d11ebdff
|
|
@@ -852,26 +852,6 @@ module Moxml
|
|
|
852
852
|
XmlEmitter.doctype_xml(dt.root_name, dt.public_id, dt.system_id)
|
|
853
853
|
end
|
|
854
854
|
|
|
855
|
-
def entity_refs?(element)
|
|
856
|
-
element.is_a?(::Leptris::XML::Element) &&
|
|
857
|
-
!attachments.get(element, :entity_refs).to_a.empty?
|
|
858
|
-
end
|
|
859
|
-
|
|
860
|
-
# Registry-based entity references are not in the native tree,
|
|
861
|
-
# so the native serializer cannot see them; compose the element
|
|
862
|
-
# from the wrapper-visible children instead.
|
|
863
|
-
def serialize_entity_bearing_element(element, options)
|
|
864
|
-
name = element.prefix ? "#{element.prefix}:#{element.name}" : element.name
|
|
865
|
-
attrs = element.attribute_nodes.map do |attr|
|
|
866
|
-
%( #{attr.name}="#{XmlEmitter.escape_attribute(attr.value)}")
|
|
867
|
-
end.join
|
|
868
|
-
decls = element.namespace_definitions.map do |ns|
|
|
869
|
-
ns.prefix ? %( xmlns:#{ns.prefix}="#{ns.href}") : %( xmlns="#{ns.href}")
|
|
870
|
-
end.join
|
|
871
|
-
inner = children(element).map { |child| raw_serialize(child, options) }.join
|
|
872
|
-
"<#{name}#{decls}#{attrs}>#{inner}</#{name}>"
|
|
873
|
-
end
|
|
874
|
-
|
|
875
855
|
def sax_parse(xml, handler)
|
|
876
856
|
bridge = LeptrisSAXBridge.new(handler)
|
|
877
857
|
xml_string = xml.is_a?(IO) || xml.is_a?(::StringIO) ? xml.read : xml.to_s
|
data/lib/moxml/adapter/libxml.rb
CHANGED
|
@@ -1060,6 +1060,11 @@ module Moxml
|
|
|
1060
1060
|
# output keeps the walker.
|
|
1061
1061
|
return nil if output.include?("xmlns")
|
|
1062
1062
|
|
|
1063
|
+
# The native serializer escapes non-ASCII codepoints in
|
|
1064
|
+
# attribute values as numeric character references
|
|
1065
|
+
# (x="©"); the walker emits literal UTF-8
|
|
1066
|
+
return nil if output.include?("&#x")
|
|
1067
|
+
|
|
1063
1068
|
# Layout: pull closing tags onto the last child's line
|
|
1064
1069
|
output = output.gsub(/\n[ \t]*(<\/[\w.:-]+>)/, '\1')
|
|
1065
1070
|
|
|
@@ -1073,7 +1078,6 @@ module Moxml
|
|
|
1073
1078
|
|
|
1074
1079
|
# Native escapes attribute apostrophes; moxml keeps them literal
|
|
1075
1080
|
output.gsub("'", "'")
|
|
1076
|
-
|
|
1077
1081
|
end
|
|
1078
1082
|
|
|
1079
1083
|
# Shallow duplication: copies the node itself (name, attrs, namespaces)
|
data/lib/moxml/version.rb
CHANGED
data/lib/moxml/xpath/compiler.rb
CHANGED