Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
= Demolisher
Works in a similar fashion to Builder but is instead used for extracting information from XML files rather than building them.
== Installation
You can install using any of the following methods
$ gem install demolisher $ gem install demolisher -s http://gemcutter.org
the first two should always be stable, the latter github one should be stable but there are no guarantees.
== Example
Given the simple XML example file below
Enoch Root 01234 567 8900 enoch@example.com YES Randy Waterhouse 01234 567 8901 randy@example.com NOwe can parse it with
xml = Demolisher.demolish('addressbook.xml') xml.addressbook do puts "Version #{xml['version']}" xml.person do puts "#{xml.firstname} #{xml.lastname}: #{xml.contact.email}" puts "this person is active" if xml.active? end end
and we should get the result of
Enoch Root: enoch@example.com this person is active Randy Waterhouse: randy@example.com
== Namespaces
There is now rudimentary support for XML namespaced documents. The caveat is that if you are using a document with any XML namespaced elements you must access all elements via a namespace prefix.
As an example we have this document
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> soap:Body <ns1:IdAndName xmlns:ns1="http://domain.somewhere.com"> 14-Demolisher </ns1:IdAndName> </soap:Body> </soap:Envelope>
some of the elements define their default namespace, +getManufacturerNamesResponse+ and +IDAndNameList+ so are not prefixed. When accessing these elements they will need to be prefixed.
Additionally the list of namespaces need to known ahead of parse time. For the above document the list of namespaces is
as namespace two has no prefix, its a default namespace, we will assign it one when creating the hash of namespaces.
namespaces = { 'soap' => "http://schemas.xmlsoap.org/soap/envelope/", 'ns0' => "http://services.somewhere.com", 'ns1' => "http://domain.somewhere.com" }
this hash of namespaces is then passed to Demolisher
xml = Demolisher.demolish('soap.xml', namespaces) xml.soap :Envelope do xml.soap :Body do xml.ns0 :getManufacturerNamesResponse do xml.ns0 :IDAndNameList do puts xml.ns1(:IdAndName).strip end end end end
the result of this will be
14-Demolisher
== Copyright
Copyright (c) 2009 Geoff Garside. See LICENSE for details.
FAQs
Unknown package
We found that demolisher demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.