我尝试了很多方法来设置它,但是我无法使其正常工作。我需要有一个名为“ ShipmentUpdates”的元素,该元素是“ ShipmentUpdate”的一种类型,其中“ ShipmentUpdate”设置为无界。最初创建此架构时,我为“ ShipmentUpdate”部分使用了属性,但是最近我发现这些属性必须是元素。当我尝试仅将服装样式更改为元素时,收到消息:“不允许使用元素。”
// create a route middleware for POST /lions that will increment and
// add an id to the incoming new lion object on req.body
const express = require('express')
const app = express()
const bodyParser = require('body-parser')
const port = 3000
app.use(express.static('client'))
app.use(bodyParser.urlencoded({ extended: true }))
app.use(bodyParser.json())
let lions = []
let id = 0
const updateId = function(req, res, next) {
if (!req.body.id) {
id++;
req.body.id = id + '';
}
next();
};
app.param('id', (req, res, next, id) => {
let lion = lions.filter((lion => lion.id === id))
if (lion) {
req.lion = lion;
next();
}
else {
console.log('NO LION')
res.send()
}
})
app.get('/lions', (req, res, next) => {
console.log('GET lions:', lions)
res.json(lions)
})
app.get('/lions/:id', (req, res) => {
res.json(req || {})
})
app.post('/lions', updateId, (req, res) => {
console.log('POST req', req.body)
const lion = req.body;
lions.push(lion)
res.json(req)
})
app.put('/lions/:id', (req, res) => {
const paramId = req.params.id
const updated = req.body
if (updated.id) delete updated.id
const oldLion = lions.find((lion => lion.id === paramId))
if (!oldLion) res.send()
const newLion = Object.assign({ id: oldLion.id }, updated)
lions = lions.filter(lion => lion.id !== paramId)
lions.push(newLion)
res.json(newLion)
})
app.delete('/lions/:id', (req, res) => {
lions = lions.filter((lion => lion.id !== req.params.id))
res.json(lions)
})
app.use((err, req, res, next) => {
console.error('ERROR:', err)
})
app.listen(port, () => console.log(`NODE RUNNING on port: ${port}`))
答案 0 :(得分:0)
<xsd:element name="ShipmentUpdates">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ShipmentUpdate" maxOccurs="unbounded" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element type="xsd:string" name="stockNumber"/>
<xsd:element type="xsd:string" name="qtyRequest"/>
<xsd:element type="xsd:string" name="qtyShip"/>
<xsd:element type="xsd:string" name="trackingNumber"/>
<xsd:element type="xsd:boolean" name="found"/>
<xsd:element type="xsd:string" name="primeLine"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>