# XMLDOM [![Build Status](https://secure.travis-ci.org/bigeasy/xmldom.png?branch=master)](http://travis-ci.org/bigeasy/xmldom) [![Coverage Status](https://coveralls.io/repos/bigeasy/xmldom/badge.png?branch=master)](https://coveralls.io/r/bigeasy/xmldom) [![NPM version](https://badge.fury.io/js/xmldom.png)](http://badge.fury.io/js/xmldom)
A JavaScript implementation of W3C DOM for Node.js, Rhino and the browser. Fully
compatible with `W3C DOM level2`; and some compatible with `level3`. Supports
`DOMParser` and `XMLSerializer` interface such as in browser.
Install:
-------
>npm install xmldom
Example:
====
```javascript
var DOMParser = require('xmldom').DOMParser;
var doc = new DOMParser().parseFromString(
'<xml xmlns="a" xmlns:c="./lite">\n'+
'\t<child>test</child>\n'+
'\t<child></child>\n'+
'\t<child/>\n'+
'</xml>'
,'text/xml');
doc.documentElement.setAttribute('x','y');
doc.documentElement.setAttributeNS('./lite','c:x','y2');
var nsAttr = doc.documentElement.getAttributeNS('./lite','x')
console.info(nsAttr)
console.info(doc)
```
API Reference
=====
* [DOMParser](https://developer.mozilla.org/en/DOMParser):
```javascript
parseFromString(xmlsource,mimeType)
```
* **options extension** _by xmldom_(not BOM standard!!)
```javascript
//added the options argument
new DOMParser(options)
//errorHandler is supported
new DOMParser({
/**
* locator is always need for error position info
*/
locator:{},
/**
* you can override the errorHandler for xml parser
* @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html
*/
errorHandler:{warning:function(w){console.warn(w)},error:callback,fatalError:callback}
//only callback model
//errorHandler:function(level,msg){console.log(level,msg)}
})
```
* [XMLSerializer](https://developer.mozilla.org/en/XMLSerializer)
```javascript
serializeToString(node)
```
DOM level2 method and attribute:
------
* [Node](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247)
attribute:
nodeValue|prefix
readonly attribute:
nodeName|nodeType|parentNode|childNodes|firstChild|lastChild|previousSibling|nextSibling|attributes|ownerDocument|namespaceURI|localName
method:
insertBefore(newChild, refChild)
replaceChild(newChild, oldChild)
removeChild(oldChild)
appendChild(newChild)
hasChildNodes()
cloneNode(deep)
normalize()
isSupported(feature, version)
hasAttributes()
* [DOMImplementation](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-102161490)
method:
hasFeature(feature, version)
createDocumentType(qualifiedName, publicId, systemId)
createDocument(namespaceURI, qualifiedName, doctype)
* [Document](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#i-Document) : Node
readonly attribute:
doctype|implementation|documentElement
method:
createElement(tagName)
createDocumentFragment()
createTextNode(data)
createComment(data)
createCDATASection(data)
createProcessingInstruction(target, data)
createAttribute(name)
createEntityReference(name)
getElementsByTagName(tagname)
importNode(importedNode, deep)
createElementNS(namespaceURI, qualifiedName)
createAttributeNS(namespaceURI, qualifiedName)
getElementsByTagNameNS(namespaceURI, localName)
getElementById(elementId)
* [DocumentFragment](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-B63ED1A3) : Node
* [Element](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-745549614) : Node
readonly attribute:
tagName
method:
getAttribute(name)
setAttribute(name, value)
removeAttribute(name)
getAttributeNode(name)
setAttributeNode(newAttr)
removeAttributeNode(oldAttr)
getElementsByTagName(name)
getAttributeNS(namespaceURI, localName)
setAttributeNS(namespaceURI, qualifiedName, value)
removeAttributeNS(namespaceURI, localName)
getAttributeNodeNS(namespaceURI, localName)
setAttributeNodeNS(newAttr)
getElementsByTagNameNS(namespaceURI, localName)
hasAttribute(name)
hasAttributeNS(namespaceURI, localName)
* [Attr](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-637646024) : Node
attribute:
value
readonly attribute:
name|specified|ownerElement
* [NodeList](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-536297177)
readonly attribute:
length
method:
item(index)
* [NamedNodeMap](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1780488922)
readonly attribute:
length
method:
getNamedItem(name)
setNamedItem(arg)
removeNamedItem(name)
item(index)
getNamedItemNS(namespaceURI, localName)
setNamedItemNS(arg)
removeNamedItemNS(namespaceURI, localName)
* [CharacterData](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-FF21A306) : Node
method:
substringData(offset, count)
appendData(arg)
insertData(offset, arg)
deleteData(offset, count)
replaceData(offset, count, arg)
* [Text](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1312295772) : CharacterData
method:
splitText(offset)
* [CDATASection](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-667469212)
* [Comment](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1728279322) : CharacterData
* [DocumentType](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-412266927)
readonly attribute:
name|entities|notations|publicId|systemId|internalSubset
* Notation : Node
readonly attribute:
publicId|systemId
* Entity : Node
readonly attribute:
publicId|systemId|notationName
* EntityReference : Node
* ProcessingInstruction : Node
attribute:
data
readonly attribute:
target
DOM level 3 support:
-----
* [Node](http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-textContent)
attribute:
textContent
method:
isDefaultNamespace(namespaceURI){
lookupNamespaceURI(prefix)
DOM extension by xmldom
---
* [Node] Source position extension;
attribute:
//Numbered starting from '1'
lineNumber
//Numbered starting from '1'
columnNumber
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
最近项目需求要在小程序中添加一个即时通信IM的功能,本来想自己开发一个....评估了一下团队实力后,并不允许,所以找了一个IM第三方框架,采用的是腾讯云的即时通信IM,但是目前腾讯云IM的小程序SDK并没有包含UI,因此就需要自己来开发页面样式和交互,腾讯云IM自己也提供了一个demo,但是使用mpvue框架写的。。。网上是一片骂声。。。我也没有使用他的demo,自已用小程序原生写了一套,因为网上用原生写的demo很少,特此将小弟写的分享出来,各位大佬轻点喷~~ demo运行教程在这里:https://blog.csdn.net/weixin_42326144/article/details
资源推荐
资源详情
资源评论
收起资源包目录
微信小程序——原生小程序即时通信IM demo,包含聊天、表情、语音、图片、会话列表功能 (101个子文件)
changelog 496B
.DS_Store 6KB
index.js 348KB
tim-wx.js 346KB
index.js 263KB
cos-wx-sdk-v5.js 261KB
cos-wx-sdk-v5.js 261KB
base.js 103KB
index.js 62KB
dom.js 33KB
xml2json.js 21KB
sax.js 19KB
demo-sdk.js 19KB
util.js 17KB
advance.js 14KB
index.js 9KB
dom-parser.js 8KB
crypto.js 8KB
album.js 8KB
md5.js 8KB
task.js 7KB
cos-auth.js 7KB
base64.js 6KB
json2xml.js 5KB
demo-no-sdk.js 4KB
sts.js 4KB
request.js 3KB
build.js 3KB
index.js 3KB
cos.js 2KB
preview.js 2KB
tim.js 2KB
index.js 2KB
async.js 1KB
util.js 1KB
event.js 872B
cos.js 818B
app.js 753B
app.js 578B
util.js 472B
index.js 432B
request.js 431B
index.js 391B
__package__.js 201B
config.js 152B
config.js 129B
index.js 54B
api.js 22B
app.js 8B
package.json 2KB
package.json 2KB
project.config.json 2KB
package.json 1KB
package-lock.json 752B
project.config.json 517B
project.config.json 506B
app.json 351B
app.json 335B
package.json 292B
app.json 274B
sitemap.json 191B
sitemap.json 191B
component.json 142B
index.json 124B
index.json 27B
index.json 27B
index.json 27B
preview.json 4B
album.json 2B
index.json 2B
LICENSE 1KB
LICENSE 143B
index.js.map 354KB
index.js.map 316KB
index.js.map 78KB
readme.md 6KB
README.md 3KB
README.md 2KB
qcloud-sts-sdk.php 6KB
sts.php 1KB
wave.png 217KB
message-img.png 3KB
camera.png 2KB
index.wxml 4KB
album.wxml 2KB
index.wxml 1KB
preview.wxml 886B
index.wxml 629B
index.wxml 581B
index.wxml 397B
index.wxss 291KB
index.wxss 17KB
album.wxss 2KB
preview.wxss 1KB
index.wxss 783B
index.wxss 551B
app.wxss 197B
app.wxss 118B
index.wxss 111B
app.wxss 0B
共 101 条
- 1
- 2
资源评论
- qq_357695682021-01-07没有后台,跑不了
朕.
- 粉丝: 34
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功