1.1.0 • Published 8 years ago
min-xml v1.1.0
min-xml
simple xml api
Installation
npm i min-xml
API
xml list api
below always accept xml list as first argument, because xml children is always an array
XML.name(xmlList)
return first xml nameXML.attr(xmlList, 'name')
return first xml attr value in nameXML.attrs(xmlList)
return first xml attributes, in[{name: 'name', value: 'value'}]
XML.get(xmlList, 'name')
search direct children by nameXML.find(xmlList, 'name')
search nested children by nameXML.children(xmlList)
return children of all xmlListXML.parent(xmlList)
return parent of all xmlListXML.text(xmlList)
return value in all xml list, and join them by ''
other xml api
XML.parse(str)
parse xml stringXML.init(xmlList)
return xmlList, if get xml, still return xmlListXML.isElement(xml)
return true if xml is xml