修改api地址和优化暂停输出的逻辑,
This commit is contained in:
16
node_modules/xmljs/test/more.xml
generated
vendored
Normal file
16
node_modules/xmljs/test/more.xml
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0"?>
|
||||
<soap:Envelope
|
||||
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
|
||||
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
|
||||
|
||||
<soap:Body xmlns:m="http://www.example.org/stock">
|
||||
<m:GetStockPriceResponse>
|
||||
<m:Price>34.5</m:Price>
|
||||
</m:GetStockPriceResponse>
|
||||
<m:GetStockPriceResponse>
|
||||
<m:Price>35.5</m:Price>
|
||||
<m:priCe>36.5</m:priCe>
|
||||
</m:GetStockPriceResponse>
|
||||
</soap:Body>
|
||||
|
||||
</soap:Envelope>
|
||||
12
node_modules/xmljs/test/simple.xml
generated
vendored
Normal file
12
node_modules/xmljs/test/simple.xml
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0"?>
|
||||
<soap:Envelope
|
||||
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
|
||||
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
|
||||
|
||||
<soap:Body xmlns:m="http://www.example.org/stock">
|
||||
<m:GetStockPriceResponse>
|
||||
<m:Price includedVat="1.21">34.5</m:Price>
|
||||
</m:GetStockPriceResponse>
|
||||
</soap:Body>
|
||||
|
||||
</soap:Envelope>
|
||||
86
node_modules/xmljs/test/xml.test.js
generated
vendored
Normal file
86
node_modules/xmljs/test/xml.test.js
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
"use strict";
|
||||
var vows = require("vows"),
|
||||
XmlParser = require("../"),
|
||||
assert = require("assert"),
|
||||
fs = require("fs");
|
||||
|
||||
vows.describe("xml path").addBatch({
|
||||
simple: {
|
||||
topic: function() {
|
||||
fs.readFile(
|
||||
__dirname + "/simple.xml",
|
||||
{ encoding: "utf8" },
|
||||
this.callback
|
||||
);
|
||||
},
|
||||
parse: {
|
||||
topic: function(dat) {
|
||||
var parser = new XmlParser({ strict: true });
|
||||
parser.parseString(dat, this.callback);
|
||||
},
|
||||
caseSenstativePath: function(node) {
|
||||
|
||||
var nodes = node.path(["Envelope", "Body", "GetStockPriceResponse", "Price"]);
|
||||
|
||||
assert.ok(
|
||||
nodes.length === 1 &&
|
||||
nodes[0].text === "34.5" &&
|
||||
nodes[0].getAttribute("includedVat") !== null &&
|
||||
nodes[0].getAttribute("includedVat").text === "1.21"
|
||||
);
|
||||
},
|
||||
caseInsenstativePath: function(node) {
|
||||
var nodes = node.path(["Envelope", "BoDy", "GetstockpriceResponse", "Price"], true);
|
||||
|
||||
assert.ok(
|
||||
nodes.length === 1 &&
|
||||
nodes[0].text === "34.5" &&
|
||||
nodes[0].getAttribute("includedVat", true) !== null &&
|
||||
nodes[0].getAttribute("includedVat", true).text === "1.21"
|
||||
);
|
||||
},
|
||||
invalidPath: function(node) {
|
||||
var nodes = node.path(["something", "totally", 'rubbisch'], true);
|
||||
assert.ok(nodes.length === 0)
|
||||
}
|
||||
}
|
||||
},
|
||||
more: {
|
||||
topic: function() {
|
||||
fs.readFile(
|
||||
__dirname + "/more.xml",
|
||||
{ encoding: "utf8" },
|
||||
this.callback
|
||||
);
|
||||
},
|
||||
parse: {
|
||||
topic: function(dat) {
|
||||
var parser = new XmlParser({ strict: true });
|
||||
parser.parseString(dat, this.callback);
|
||||
},
|
||||
caseSenstativePath: function(node) {
|
||||
var nodes = node.path(["Envelope", "Body", "GetStockPriceResponse", "Price"]);
|
||||
|
||||
assert.ok(
|
||||
nodes.length === 2 &&
|
||||
nodes[0].text === "34.5" &&
|
||||
nodes[1].text === "35.5"
|
||||
);
|
||||
},
|
||||
caseInsenstativePath: function(node) {
|
||||
var nodes = node.path(["Envelope", "BoDy", "GetstockpriceResponse", "Price"], true);
|
||||
|
||||
assert.ok(
|
||||
nodes.length === 3 &&
|
||||
nodes[0].text === "34.5" &&
|
||||
nodes[1].text === "35.5" &&
|
||||
nodes[2].text === "36.5"
|
||||
);
|
||||
},
|
||||
invalidPath: function(node) {
|
||||
var nodes = node.path(["something", "totally", 'rubbisch'], true);
|
||||
assert.ok(nodes.length === 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}).export(module);
|
||||
Reference in New Issue
Block a user