Nodejs/handlebars在创建超过特定大小的XML文件时遇到问题
我在生成XML文件时遇到问题。如果我只运行20个左右的“属性”:properties:properties.slice0,20我会得到一个有效的XML文件。如果我尝试运行我所有的properties:properties:properties,其中我有大约100个,那么我的XML是无效的 由于随机XML元素未正确关闭,它返回为无效 有什么线索可以解释为什么它对…20而不是100有效吗 生成XML的代码:Nodejs/handlebars在创建超过特定大小的XML文件时遇到问题,xml,node.js,handlebars.js,Xml,Node.js,Handlebars.js,我在生成XML文件时遇到问题。如果我只运行20个左右的“属性”:properties:properties.slice0,20我会得到一个有效的XML文件。如果我尝试运行我所有的properties:properties:properties,其中我有大约100个,那么我的XML是无效的 由于随机XML元素未正确关闭,它返回为无效 有什么线索可以解释为什么它对…20而不是100有效吗 生成XML的代码: var express = require('express'); var router =
var express = require('express');
var router = express.Router();
router.get('/mits.xml', function(req, res) {
var date = new Date();
var y = date.getYear() + 1900;
var m = date.getMonth() + 1;
var d = date.getDate();
api.getProperties(function(e, properties) {
res.header('Content-Type', 'application/xml');
res.render('mits/index', {
properties: properties.slice(0,20),
//properties: properties,
layout: false,
month: m,
year: y,
date: d
});
});
});
module.exports = router;
把手的模板文件:
<?xml version="1.0" encoding="UTF-8"?>
<PhysicalProperty xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Management
IDValue="XYZ"
OrganizationName="XYZ Company">
</Management>{{#properties}}
<Property IDValue="123" OrganizationName="XYZ">
<PropertyID>
<MarketingName>XYZ</MarketingName>
<LegalName>XYZ Company</LegalName>
<WebSite>XYZ</WebSite>
<Address AddressType="property">
<AddressLine1>XYZ</AddressLine1>
<City>XYZ</City>
<State>XYZ</State>
<PostalCode>XYZ</PostalCode>
<Country>United States</Country>
</Address>
<Phone PhoneType="office">
<PhoneNumber>XYZ</PhoneNumber>
</Phone>
<Email>XYZ</Email>
</PropertyID>
<General_ID IDValue="XYZ"></General_ID>
<ILS_Identification
ILS_IdentificationType="Apartment"
RentalType="Unspecified">
<Latitude>-126.1234</Latitude>
<Longitude>126.1234</Longitude>
<LastUpdate
Month="08"
Day="01"
Year="2014"/>
</ILS_Identification>
<Information>
<StructureType>Standard</StructureType>
<UnitCount>2</UnitCount>
<OfficeHour>
<OpenTime>8:00 AM</OpenTime>
<CloseTime>5:00 PM</CloseTime>
<Day>Monday</Day>
</OfficeHour>
</Information>
<Concession Active="true">
<Value>0.00</Value>
<Term>0</Term>
<DescriptionHeader>XYz</DescriptionHeader>
<DescriptionBody>NA</DescriptionBody>
<DescriptionFooter>NA</DescriptionFooter>
</Concession>
<Amenity AmenityType="Other">
<Description>XYz</Description>
</Amenity>
<Floorplan
IDValue="XYZ"
OrganizationName="XYZ">
<Name>XYZ</Name>
<UnitCount>0</UnitCount>
<Room RoomType="Bedroom">
<Count>2.0</Count>
<Comment>NA</Comment>
</Room>
<Room RoomType="Bathroom">
<Count>2.0</Count>
<Comment>NA</Comment>
</Room>
<SquareFeet
Min="123"
Max="123"/>
<MarketRent
Min="123"
Max="123"/>
<EffectiveRent
Min="123"
Max="123"/>
</Floorplan>
<File FileID="XYZ" Active="true">
<FileType>Floorplan</FileType>
<Description>XYZ</Description>
<Name>XYz</Name>
<Caption>XYz</Caption>
<Format>image/jpeg</Format>
<Src>XYZ</Src>
<Rank>XYZ</Rank>
</File>
<File FileID="XYZ" Active="true">
<FileType>Photo</FileType>
<Description>XYZ</Description>
<Name>XYZ</Name>
<Caption>XYZ</Caption>
<Format>image/jpeg</Format>
<Src>XYZ</Src>
<Rank>1</Rank>
</File>
</Property>
{{/properties}}
</PhysicalProperty>
代码似乎没有问题。我正在将xml从浏览器复制到验证工具中。如果我通过wget下载xml,它会很好地验证