CARVIEW |
Select Language
HTTP/2 200
date: Mon, 21 Jul 2025 14:28:48 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
etag: W/"179191f07eb34827858418b231752b1a"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=qD0KaXpMbBF9oZLbBnuTNrj%2FgIWDmucwC4yKJW5UgEUECqlFOmWJBl1mQZyCWZJcych6pcTCwEnfEZisz43L6ZHPKlqmPkbBE4%2F%2FJN9KEHSM25VTG1ZLOE2av1W1ylzKEbONOzHzvMWORYKAFkSmUjiyU5G5Vj32CbunstKUa2A7XrU1gpx5BYwdpBNR0v2XojxxFiFKzQAWrUzMkC2Xd3ccVWEQKjgSzr2%2B8ipxjKtOITYN8bbMmnTClfHe2ZxmCDB6N%2BJIc8qE3Lm6iBEYXA%3D%3D--qYp32Ax6dW%2FMCCnS--aimhg6wuXccNAdBE0pGqKQ%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.2073240859.1753108127; Path=/; Domain=github.com; Expires=Tue, 21 Jul 2026 14:28:47 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Tue, 21 Jul 2026 14:28:47 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: 9E14:10A6BA:1D43141:2451DB0:687E4E9F
Examples · oozcitak/xmlbuilder-js Wiki · GitHub
Skip to content
Navigation Menu
{{ message }}
-
-
Notifications
You must be signed in to change notification settings - Fork 107
Examples
Ozgur Ozcitak edited this page Nov 24, 2016
·
2 revisions
The single-entry Atom Feed Document as given in The Atom Syndication Format:
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="https://www.w3.org/2005/Atom">
<title type="text">dive into mark</title>
<subtitle type="html">A <em>lot</em> of effort went into making this effortless</subtitle>
<updated>2005-07-31T12:29:29Z</updated>
<id>tag:example.org,2003:3</id>
<link rel="alternate" type="text/html" hreflang="en" href="https://example.org/"/>
<link rel="self" type="application/atom+xml" href="https://example.org/feed.atom"/>
<rights>Copyright (c) 2003, Mark Pilgrim</rights>
<generator uri="https://www.example.com/" version="1.0">Example Toolkit</generator>
<entry>
<title>Atom draft-07 snapshot</title>
<link rel="alternate" type="text/html" href="https://example.org/2005/04/02/atom"/>
<link rel="enclosure" type="audio/mpeg" length="1337" href="https://example.org/audio/ph34r_my_podcast.mp3"/>
<id>tag:example.org,2003:3.2397</id>
<updated>2005-07-31T12:29:29Z</updated>
<published>2003-12-13T08:29:29-04:00</published>
<author>
<name>Mark Pilgrim</name>
<uri>https://example.org/</uri>
<email>f8dy@example.com</email>
</author>
<contributor>
<name>Sam Ruby</name>
</contributor>
<contributor>
<name>Joe Gregorio</name>
</contributor>
<content type="xhtml" xml:lang="en" xml:base="https://diveintomark.org/">
<div xmlns="https://www.w3.org/1999/xhtml">
<p>
<i>[Update: The Atom draft is finished.]</i>
</p>
</div>
</content>
</entry>
</feed>
Using create
and friends:
var builder = require('xmlbuilder');
var feed = builder.create('feed', { encoding: 'utf-8' })
.att('xmlns', 'https://www.w3.org/2005/Atom')
.ele('title', { 'type': 'text'}, 'dive into mark').up()
.ele('subtitle', { 'type': 'html' }, 'A <em>lot</em> of effort went into making this effortless').up()
.ele('updated', '2005-07-31T12:29:29Z').up()
.ele('id', 'tag:example.org,2003:3').up()
.ele('link', { 'rel': 'alternate', 'type': 'text/html', 'hreflang': 'en', 'href': 'https://example.org/' }).up()
.ele('link', { 'rel': 'self', 'type': 'application/atom+xml', 'href': 'https://example.org/feed.atom' }).up()
.ele('rights', 'Copyright (c) 2003, Mark Pilgrim').up()
.ele('generator', { 'uri': 'https://www.example.com/', 'version': '1.0' }, 'Example Toolkit').up()
.ele('entry')
.ele('title', 'Atom draft-07 snapshot').up()
.ele('link', { 'rel': 'alternate', 'type': 'text/html', 'href': 'https://example.org/2005/04/02/atom' }).up()
.ele('link', { 'rel': 'enclosure', 'type': 'audio/mpeg', 'length': '1337', 'href': 'https://example.org/audio/ph34r_my_podcast.mp3' }).up()
.ele('id', 'tag:example.org,2003:3.2397').up()
.ele('updated', '2005-07-31T12:29:29Z').up()
.ele('published', '2003-12-13T08:29:29-04:00').up()
.ele('author')
.ele('name', 'Mark Pilgrim').up()
.ele('uri', 'https://example.org/').up()
.ele('email', 'f8dy@example.com').up()
.up()
.ele('contributor')
.ele('name', 'Sam Ruby').up()
.up()
.ele('contributor')
.ele('name', 'Joe Gregorio').up()
.up()
.ele('content', { 'type': 'xhtml', 'xml:lang': 'en', 'xml:base': 'https://diveintomark.org/' })
.ele('div', { 'xmlns': 'https://www.w3.org/1999/xhtml' })
.ele('p')
.ele('i', '[Update: The Atom draft is finished.]').up()
.up()
.up()
.up()
.up()
console.log(feed.end({ pretty: true }));
Using JS objects:
var builder = require('xmlbuilder');
var feedObj = {
'feed': {
'@xmlns': 'https://www.w3.org/2005/Atom',
'title': { '@type': 'text', '#text': 'dive into mark' },
'subtitle': { '@type': 'html', '#text': 'A <em>lot</em> of effort went into making this effortless' },
'updated': '2005-07-31T12:29:29Z',
'id': 'tag:example.org,2003:3',
'link': [
{ '@rel': 'alternate', '@type': 'text/html', '@hreflang': 'en', '@href': 'https://example.org/' },
{ '@rel': 'self', '@type': 'application/atom+xml', '@href': 'https://example.org/feed.atom' }
],
'rights': 'Copyright (c) 2003, Mark Pilgrim',
'generator': { '@uri': 'https://www.example.com/', '@version': '1.0', '#text': 'Example Toolkit' },
'entry': {
'title': 'Atom draft-07 snapshot',
'link': [
{ '@rel': 'alternate', '@type': 'text/html', '@href': 'https://example.org/2005/04/02/atom' },
{ '@rel': 'enclosure', '@type': 'audio/mpeg', '@length': '1337', '@href': 'https://example.org/audio/ph34r_my_podcast.mp3' }
],
'id': 'tag:example.org,2003:3.2397',
'updated': '2005-07-31T12:29:29Z',
'published': '2003-12-13T08:29:29-04:00',
'author': {
'name': 'Mark Pilgrim',
'uri': 'https://example.org/',
'email': 'f8dy@example.com'
},
'contributor' : [
{ 'name': 'Sam Ruby' },
{ 'name': 'Joe Gregorio' }
],
'content': {
'@type': 'xhtml',
'@xml:lang': 'en',
'@xml:base': 'https://diveintomark.org/',
'div': {
'@xmlns': 'https://www.w3.org/1999/xhtml',
'p': {
'i': '[Update: The Atom draft is finished.]'
}
}
}
}
}
}
var feed = builder.create(feedObj, { encoding: 'utf-8' })
console.log(feed.end({ pretty: true }));
Clone this wiki locally
You can’t perform that action at this time.