mirror of
https://github.com/wezm/wezm.net.git
synced 2024-11-10 01:42:32 +00:00
Add generating-xml-with-node-js
This commit is contained in:
parent
165c3c6bfd
commit
3c1e3f5fee
4 changed files with 48 additions and 0 deletions
34
content/technical/2011/01/generating-xml-with-node-js.html
Normal file
34
content/technical/2011/01/generating-xml-with-node-js.html
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
For a [node.js][node] project I'm working on I wanted to generate a [Sphinx
|
||||||
|
xmlpip2e][xmlpipe] data stream. The options for generating XML with node.js
|
||||||
|
seemed a bit limited. The main contender appeared to be [libmljs] but it
|
||||||
|
segfaulted whenever I tried to use it. A browse of the issue tracker seemed to
|
||||||
|
suggest the project was quite complex and crashing problems were not uncommon.
|
||||||
|
|
||||||
|
[node]: http://nodejs.org/
|
||||||
|
[xmlpipe]: http://sphinxsearch.com/docs/manual-1.10.html TODO
|
||||||
|
[libmljs]: https://github.com/polotek/libxmljs
|
||||||
|
|
||||||
|
So with previous experience using Tim Bray's Genx library I decieded to write
|
||||||
|
bindings for node. The result is [node-genx], which is available via [npm].
|
||||||
|
|
||||||
|
npm install genx
|
||||||
|
|
||||||
|
[node-genx]: https://github.com/wezm/node-genx
|
||||||
|
[npm]: http://npmjs.org/
|
||||||
|
|
||||||
|
Example Usage
|
||||||
|
-------------
|
||||||
|
|
||||||
|
### xmlpipe2
|
||||||
|
|
||||||
|
In this example the first 10 Google search results for "node.js xml" are retrieved
|
||||||
|
and converted into an xmlpipe2 stream, suitable for indexing with Sphinx.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Atom Feed
|
||||||
|
|
||||||
|
In this example, as in the former the first 10 Google search results for "node.js xml"
|
||||||
|
are retrieved and converted into an Atom feed.
|
||||||
|
|
||||||
|
|
11
content/technical/2011/01/generating-xml-with-node-js.yaml
Normal file
11
content/technical/2011/01/generating-xml-with-node-js.yaml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
---
|
||||||
|
title: Generating XML With node.js
|
||||||
|
extra: Using my genx node module to generate XML in node.js.
|
||||||
|
kind: article
|
||||||
|
section: technical
|
||||||
|
created_at: 2011-01-28 06:18:00
|
||||||
|
keywords:
|
||||||
|
- node
|
||||||
|
- js
|
||||||
|
- xml
|
||||||
|
- generation
|
|
@ -0,0 +1,3 @@
|
||||||
|
var genx = require('genx');
|
||||||
|
|
||||||
|
// Retrieve the Google search results
|
Loading…
Reference in a new issue