当前位置: 首页 > news >正文

宿迁网站推广哪家公司做seo

宿迁网站推广,哪家公司做seo,网站建设 服务流程,怎么做一款网站背景 因为服务端给的数据并不是xml,而且服务端要拿的数据是json,所以我们只能xml和json互转,来完成和服务端的对接 xml转json import XML from ./config/jsonxml.js/*** xml转为json* param {*} xml*/xmlToJson(xml) {const xotree new X…

背景

因为服务端给的数据并不是xml,而且服务端要拿的数据是json,所以我们只能xml和json互转,来完成和服务端的对接

xml转json
import XML from './config/jsonxml.js'/*** xml转为json* @param {*} xml*/xmlToJson(xml) {const xotree = new XML.ObjTree()const jsonData = xotree.parseXML(xml)return jsonData},

jsonxml.js

const XML = function() {}//  constructorXML.ObjTree = function() {return this
}//  class variablesXML.ObjTree.VERSION = '0.23'//  object prototypeXML.ObjTree.prototype.xmlDecl = '<?xml version="1.0" encoding="UTF-8" ?>\n'
XML.ObjTree.prototype.attr_prefix = '-'//  method: parseXML( xmlsource )XML.ObjTree.prototype.parseXML = function(xml) {let rootif (window.DOMParser) {var xmldom = new DOMParser()//      xmldom.async = false;           // DOMParser is always sync-modeconst dom = xmldom.parseFromString(xml, 'application/xml')if (!dom) returnroot = dom.documentElement} else if (window.ActiveXObject) {xmldom = new ActiveXObject('Microsoft.XMLDOM')xmldom.async = falsexmldom.loadXML(xml)root = xmldom.documentElement}if (!root) returnreturn this.parseDOM(root)
}//  method: parseHTTP( url, options, callback )XML.ObjTree.prototype.parseHTTP = function(url, options, callback) {const myopt = {}for (const key in options) {myopt[key] = options[key] // copy object}if (!myopt.method) {if (typeof myopt.postBody === 'undefined' &&typeof myopt.postbody === 'undefined' &&typeof myopt.parameters === 'undefined') {myopt.method = 'get'} else {myopt.method = 'post'}}if (callback) {myopt.asynchronous = true // async-modeconst __this = thisconst __func = callbackconst __save = myopt.onCompletemyopt.onComplete = function(trans) {let treeif (trans && trans.responseXML && trans.responseXML.documentElement) {tree = __this.parseDOM(trans.responseXML.documentElement)}__func(tree, trans)if (__save) __save(trans)}} else {myopt.asynchronous = false // sync-mode}let transif (typeof HTTP !== 'undefined' && HTTP.Request) {myopt.uri = urlvar req = new HTTP.Request(myopt) // JSANif (req) trans = req.transport} else if (typeof Ajax !== 'undefined' && Ajax.Request) {var req = new Ajax.Request(url, myopt) // ptorotype.jsif (req) trans = req.transport}if (callback) return transif (trans && trans.responseXML && trans.responseXML.documentElement) {return this.parseDOM(trans.responseXML.documentElement)}
}//  method: parseDOM( documentroot )XML.ObjTree.prototype.parseDOM = function(root) {if (!root) returnthis.__force_array = {}if (this.force_array) {for (let i = 0; i < this.force_array.length; i++) {this.__force_array[this.force_array[i]] = 1}}let json = this.parseElement(root) // parse root nodeif (this.__force_array[root.nodeName]) {json = [json]}if (root.nodeType != 11) {// DOCUMENT_FRAGMENT_NODEconst tmp = {}tmp[root.nodeName] = json // root nodeNamejson = tmp}return json
}//  method: parseElement( element )XML.ObjTree.prototype.parseElement = function(elem) {//  COMMENT_NODEif (elem.nodeType == 7) {return}//  TEXT_NODE CDATA_SECTION_NODEif (elem.nodeType == 3 || elem.nodeType == 4) {const bool = elem.nodeValue.match(/[^\x00-\x20]/)if (bool == null) return // ignore white spacesreturn elem.nodeValue}let retvalconst cnt = {}//  parse attributesif (elem.attributes && elem.attributes.length) {retval = {}for (var i = 0; i < elem.attributes.length; i++) {var key = elem.attributes[i].nodeNameif (typeof key !== 'string') continuevar val = elem.attributes[i].nodeValueif (!val) continuekey = this.attr_prefix + keyif (typeof cnt[key] === 'undefined') cnt[key] = 0cnt[key]++this.addNode(retval, key, cnt[key], val)}}//  parse child nodes (recursive)if (elem.childNodes && elem.childNodes.length) {let textonly = trueif (retval) textonly = false // some attributes existsfor (var i = 0; i < elem.childNodes.length && textonly; i++) {const ntype = elem.childNodes[i].nodeTypeif (ntype == 3 || ntype == 4) continuetextonly = false}if (textonly) {if (!retval) retval = ''for (var i = 0; i < elem.childNodes.length; i++) {retval += elem.childNodes[i].nodeValue}} else {if (!retval) retval = {}for (var i = 0; i < elem.childNodes.length; i++) {var key = elem.childNodes[i].nodeNameif (typeof key !== 'string') continuevar val = this.parseElement(elem.childNodes[i])if (!val) continueif (typeof cnt[key] === 'undefined') cnt[key] = 0cnt[key]++this.addNode(retval, key, cnt[key], val)}}}return retval
}//  method: addNode( hash, key, count, value )XML.ObjTree.prototype.addNode = function(hash, key, cnts, val) {if (this.__force_array[key]) {if (cnts == 1) hash[key] = []hash[key][hash[key].length] = val // push} else if (cnts == 1) {// 1st siblinghash[key] = val} else if (cnts == 2) {// 2nd siblinghash[key] = [hash[key], val]} else {// 3rd sibling and morehash[key][hash[key].length] = val}
}//  method: writeXML( tree )XML.ObjTree.prototype.writeXML = function(tree) {const xml = this.hash_to_xml(null, tree)return this.xmlDecl + xml
}//  method: hash_to_xml( tagName, tree )XML.ObjTree.prototype.hash_to_xml = function(name, tree) {const elem = []const attr = []for (const key in tree) {if (!tree.hasOwnProperty(key)) continueconst val = tree[key]if (key.charAt(0) != this.attr_prefix) {if (typeof val === 'undefined' || val == null) {elem[elem.length] = `<${key} />`} else if (typeof val === 'object' && val.constructor == Array) {elem[elem.length] = this.array_to_xml(key, val)} else if (typeof val === 'object') {elem[elem.length] = this.hash_to_xml(key, val)} else {elem[elem.length] = this.scalar_to_xml(key, val)}} else {attr[attr.length] = ` ${key.substring(1)}="${this.xml_escape(val)}"`}}const jattr = attr.join('')let jelem = elem.join('')if (typeof name === 'undefined' || name == null) {// no tag} else if (elem.length > 0) {if (jelem.match(/\n/)) {jelem = `<${name}${jattr}>\n${jelem}</${name}>\n`} else {jelem = `<${name}${jattr}>${jelem}</${name}>\n`}} else {jelem = `<${name}${jattr} />\n`}return jelem
}//  method: array_to_xml( tagName, array )XML.ObjTree.prototype.array_to_xml = function(name, array) {const out = []for (let i = 0; i < array.length; i++) {const val = array[i]if (typeof val === 'undefined' || val == null) {out[out.length] = `<${name} />`} else if (typeof val === 'object' && val.constructor == Array) {out[out.length] = this.array_to_xml(name, val)} else if (typeof val === 'object') {out[out.length] = this.hash_to_xml(name, val)} else {out[out.length] = this.scalar_to_xml(name, val)}}return out.join('')
}//  method: scalar_to_xml( tagName, text )XML.ObjTree.prototype.scalar_to_xml = function(name, text) {if (name == '#text') {return this.xml_escape(text)}return `<${name}>${this.xml_escape(text)}</${name}>\n`
}//  method: xml_escape( text )XML.ObjTree.prototype.xml_escape = function(text) {return `${text}`.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;')
}export default XML

json 转为xml

const getIncoming = (id, data) => {return data.filter(item => item.targetRef === id).map(items => items.id)
}
const getOutGoing = (id, data) => {return data.filter(item => item.sourceRef === id).map(items => items.id)
}
const getLabel = (data, labelStyle) => {const keyWord = ['isBold', 'isItalic', 'isStrikeThrough', 'isUnderline', 'fontFamily', 'size']const arr = data.filter(item => {return keyWord.find(key => {return key in labelStyle})})return arr.map(item => {const obj = {}keyWord.forEach(key => {if (labelStyle[key]) {obj[key === 'fontFamily' ? 'name' : key] = labelStyle[key] || ''}})return {'-id': item.id,'omgdc:Font': obj}})
}
export function convertJsonToBpmn(jsonData) {if (!jsonData || !Object.keys(jsonData).length) return {}const result = {definitions: {'-xmlns': 'http://www.omg.org/spec/BPMN/20100524/MODEL','-xmlns:bpmndi': 'http://www.omg.org/spec/BPMN/20100524/DI','-xmlns:omgdi': 'http://www.omg.org/spec/DD/20100524/DI','-xmlns:omgdc': 'http://www.omg.org/spec/DD/20100524/DC','-xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance','-xmlns:bioc': 'http://bpmn.io/schema/bpmn/biocolor/1.0','-xmlns:color': 'http://www.omg.org/spec/BPMN/non-normative/color/1.0','-id': 'sid-38422fae-e03e-43a3-bef4-bd33b32041b2','-targetNamespace': 'http://bpmn.io/bpmn','-exporter': 'bpmn-js (https://demo.bpmn.io)','-exporterVersion': '5.1.2',process: {'-id': 'Process_1','-isExecutable': 'true',task: [],sequenceFlow: []},'bpmndi:BPMNDiagram': {'-id': 'BpmnDiagram_1','bpmndi:BPMNPlane': {'-id': 'BpmnPlane_1','-bpmnElement': 'Process_1','bpmndi:BPMNShape': [],'bpmndi:BPMNEdge': []}},'bpmndi:BPMNLabelStyle': {}}}// Convert tasksjsonData.nodeLists.forEach(task => {const taskId = task.config.idconst incoming = getIncoming(taskId, jsonData.lines)const outGoing = getOutGoing(taskId, jsonData.lines)const obj = {'-id': taskId}if (incoming.length > 1) {obj.incoming = incoming} else if (incoming.length === 1) {obj.incoming = incoming[0]}if (outGoing.length > 1) {obj.outgoing = outGoing} else if (outGoing.length === 1) {obj.outgoing = outGoing[0]}result.definitions.process.task.push(obj)const { x, y, width, height, labelStyle } = task.configconst element = {'-id': `${taskId}_di`,'-bpmnElement': taskId,'omgdc:Bounds': {'-x': x,'-y': y,'-width': width,'-height': height},'bpmndi:BPMNLabel': {}}if (labelStyle && Object.keys(labelStyle).length) {const { x, y, width, height, id } = labelStyleelement['bpmndi:BPMNLabel']['-labelStyle'] = idelement['bpmndi:BPMNLabel']['omgdc:Bounds'] = {'-x': x,'-y': y,'-width': width,'-height': height}result.definitions['bpmndi:BPMNLabelStyle'] = getLabel(jsonData.nodeLists, labelStyle)}// Convert BPMN shapesresult.definitions['bpmndi:BPMNDiagram']['bpmndi:BPMNPlane']['bpmndi:BPMNShape'].push(element)})// Convert sequence flowsjsonData.lines.forEach(line => {const sequenceFlowId = line.idconst sourceRef = line.sourceRefconst targetRef = line.targetRefresult.definitions.process.sequenceFlow.push({'-id': `${sequenceFlowId}`,'-name': line.name,'-sourceRef': sourceRef,'-targetRef': targetRef})// Convert BPMN edgesresult.definitions['bpmndi:BPMNDiagram']['bpmndi:BPMNPlane']['bpmndi:BPMNEdge'].push({'-id': `${sequenceFlowId}_di`,'-bpmnElement': sequenceFlowId,'omgdi:waypoint': line.point.map(p => {return { '-x': p.x, '-y': p.y }}),'bpmndi:BPMNLabel': {'omgdc:Bounds': {'-x': line.x,'-y': line.y,'-width': line.width,'-height': line.height}}})})return result
}

文章转载自:
http://autocracy.c7496.cn
http://antifeudal.c7496.cn
http://cropper.c7496.cn
http://gibeonite.c7496.cn
http://ossie.c7496.cn
http://hydrophilic.c7496.cn
http://ber.c7496.cn
http://phytology.c7496.cn
http://disfurnish.c7496.cn
http://melodist.c7496.cn
http://mettle.c7496.cn
http://halliard.c7496.cn
http://promotee.c7496.cn
http://insectarium.c7496.cn
http://irremovable.c7496.cn
http://dareful.c7496.cn
http://sepulchre.c7496.cn
http://consumable.c7496.cn
http://pillbox.c7496.cn
http://kumiss.c7496.cn
http://technicalization.c7496.cn
http://mizenyard.c7496.cn
http://circassia.c7496.cn
http://romeo.c7496.cn
http://haematometer.c7496.cn
http://prostrate.c7496.cn
http://multilevel.c7496.cn
http://feller.c7496.cn
http://geogeny.c7496.cn
http://zibeline.c7496.cn
http://mush.c7496.cn
http://keramics.c7496.cn
http://ebb.c7496.cn
http://clasmatocyte.c7496.cn
http://cluck.c7496.cn
http://unnational.c7496.cn
http://tucket.c7496.cn
http://koutekite.c7496.cn
http://reecho.c7496.cn
http://semanticist.c7496.cn
http://hodiernal.c7496.cn
http://unfastidious.c7496.cn
http://deniable.c7496.cn
http://conglomeritic.c7496.cn
http://spadix.c7496.cn
http://facp.c7496.cn
http://organelle.c7496.cn
http://idyll.c7496.cn
http://peloponnese.c7496.cn
http://viceroyalty.c7496.cn
http://cost.c7496.cn
http://fenceless.c7496.cn
http://withdrawment.c7496.cn
http://sesquipedal.c7496.cn
http://orthodromic.c7496.cn
http://amygdalaceous.c7496.cn
http://euglenoid.c7496.cn
http://osteolite.c7496.cn
http://bowfin.c7496.cn
http://interradial.c7496.cn
http://jud.c7496.cn
http://brainwashing.c7496.cn
http://platinocyanic.c7496.cn
http://adenoidal.c7496.cn
http://boff.c7496.cn
http://safranin.c7496.cn
http://corpse.c7496.cn
http://ceremonialist.c7496.cn
http://parabombs.c7496.cn
http://microsystem.c7496.cn
http://pshaw.c7496.cn
http://ashen.c7496.cn
http://gyrostatics.c7496.cn
http://eeler.c7496.cn
http://sphericity.c7496.cn
http://rareness.c7496.cn
http://horseway.c7496.cn
http://aleatory.c7496.cn
http://purpose.c7496.cn
http://railwayed.c7496.cn
http://associative.c7496.cn
http://unliving.c7496.cn
http://caraway.c7496.cn
http://adrenocortical.c7496.cn
http://liechtensteiner.c7496.cn
http://whatsit.c7496.cn
http://haboob.c7496.cn
http://astronautic.c7496.cn
http://hyperfunction.c7496.cn
http://georgina.c7496.cn
http://benignantly.c7496.cn
http://overbodice.c7496.cn
http://underdevelopment.c7496.cn
http://incurably.c7496.cn
http://drugola.c7496.cn
http://teapoy.c7496.cn
http://skullcap.c7496.cn
http://bleacher.c7496.cn
http://crafty.c7496.cn
http://septicaemic.c7496.cn
http://www.zhongyajixie.com/news/88733.html

相关文章:

  • 网站建设制作 武汉长沙seo优化推广公司
  • 正定县住房和城乡建设局网站当下最流行的营销方式
  • 网站怎么做跳转seo服务是什么
  • 左侧固定导航栏的网站拓客app下载
  • 许昌做网站汉狮网络职业培训机构需要什么资质
  • 购买的网站如何换背景seo结算系统
  • 汾湖做网站百度推广开户渠道
  • 做微商网站需要哪些杭州网络排名优化
  • 自助网站建设公司电话yahoo搜索引擎入口
  • bc网站怎么做支付广州seo培训
  • 网站建设公司经营范围百度竞价被点击软件盯上
  • 如何建设营销型网站大连网站建设
  • 请求php网站数据库百度指数预测
  • 常州自助做网站链友之家
  • 泉州高端模板建站如何把品牌推广出去
  • 增城企业网站建设昆明百度推广开户费用
  • 鞍山互动网班级优化大师官方免费下载
  • 国际网站建设与维护购买链接平台
  • 个人静态网站首页怎么做微信推广怎么做
  • 北京最大做网站的公司百度推广登录首页网址
  • 北京建设银行网站首页汕头百度seo公司
  • 无锡网页制作服务关键词优化哪个好
  • 网站怎么更新内容seo综合查询怎么用
  • 南昌汉邦网站建设博客推广的方法与技巧
  • 招聘网站开发学徒广告公司网站
  • 郑州做网站制作的公司谷歌搜索引擎为什么打不开
  • 丽水微信网站建设报价全球网站排名
  • 苏州建设网站平台宁波搜索引擎优化seo
  • 做淘宝美工图片网站今日热点新闻事件
  • 郑州中原区网站建设百度百科官网