google / cap-library

Common Alerting Protocol Library
Apache License 2.0
80 stars 30 forks source link

CAP Validator throws error for valid polygons, code because of line-break in the tag #43

Closed sschiavoni closed 9 years ago

sschiavoni commented 9 years ago

Original issue 44 created by yuch@google.com on 2013-10-22T23:55:32.000Z:

What steps will reproduce the problem?

  1. Try to validate this alert. It'll throw errors because <code> and <polygon> starts with a newline. Remove the newline and its' fine. We should ignore the newlines.

<alert xmlns="urn:oasis:names:tc:emergency:cap:1.2"> <identifier>628245</identifier> <sender>UAT05@User.whispir.com</sender> <sent>2013-09-23T16:55:27+10:00</sent> <status>Actual</status> <msgType>Alert</msgType> <source>CFA-Manual</source> <scope>Public</scope> <code> urn:oasis:names:tc:emergency:cap:1.2:profile:CAP-AU:1.0 </code> <info> <language>en-AU</language> <category>Fire</category> <event>Bushfire</event> <responseType>Execute</responseType> <urgency>Immediate</urgency> <severity>Severe</severity> <certainty>Observed</certainty> <eventCode> <valueName> urn:oasis:names:tc:emergency:cap:1.2:profile:CAP-AU:1.0:AUeventLIST:1.0 </valueName> <value>bushFire</value> </eventCode> <effective>2013-09-23T16:55:00+10:00</effective> <expires>2013-10-19T01:00:00+11:00</expires> <senderName>Country Fire Authority</senderName> <headline>Emergency Warning</headline> <description> Incident Information </description> <instruction>

</instruction> <web>www.cfa.vic.gov.au</web> <parameter> <valueName>Event</valueName> <value>fire</value> </parameter> <parameter> <valueName>MessageAction</valueName> <value>Emergency Warning</value> </parameter> <parameter> <valueName>Size</valueName> <value>large</value> </parameter> <parameter> <valueName>SizeHectares</valueName> <value>55454</value> </parameter> <parameter> <valueName>Speed</valueName> <value>slow</value> </parameter> <parameter> <valueName>Location</valueName> <value>DSE - 22 KM NW OF ORBOST</value> </parameter> <parameter> <valueName>AuthorisedBy</valueName> <value>test</value> </parameter> <area> <areaDesc>Areas_Affected</areaDesc> <polygon> -37.701814521710354,148.45660535147374 -37.70181118770032,148.45663195662993 -37.70180460177421,148.45665757504224 -37.70179492609854,148.4566815759004 -37.7017823989194,148.45670336822357 -37.70176732869615,148.4567224154124 -37.7017500865063,148.45673824846196 -37.70173109690842,148.45675047751 -37.70171082748827,148.45675880143673 -37.70168977734543,148.45676301527953 -37.70166846480381,148.45676301527953 -37.701647414648924,148.45675880143673 -37.7016271452059,148.45675047751 -37.701608155576515,148.45673824846196 -37.70159091334965,148.4567224154124 -37.701575843087475,148.45670336822357 -37.70156331587131,148.4566815759004 -37.70155364016415,148.45665757504224 -37.70154705421515,148.45663195662993 -37.70154372019309,148.45660535147374 -37.70154372019309,148.45657841468093 -37.70154705421515,148.45655180952474 -37.70155364016415,148.4565261911124 -37.70156331587131,148.45650219025427 -37.701575843087475,148.4564803979311 -37.70159091334965,148.45646135074225 -37.701608155576515,148.45644551769269 -37.7016271452059,148.45643328864466 -37.701647414648924,148.4564249647179 -37.70166846480381,148.45642075087514 -37.70168977734543,148.45642075087514 -37.70171082748827,148.4564249647179 -37.70173109690842,148.45643328864466 -37.7017500865063,148.45644551769269 -37.70176732869615,148.45646135074225 -37.7017823989194,148.4564803979311 -37.70179492609854,148.45650219025427 -37.70180460177421,148.4565261911124 -37.70181118770032,148.45655180952474 -37.701814521710354,148.45657841468093 -37.701814521710354,148.45660535147374 </polygon> <geocode> <valueName> urn:oasis:names:tc:emergency:cap:1.2:profile:CAP-AU:1.0:postcode </valueName> <value/> </geocode> </area> <area> <areaDesc>Areas_Affected</areaDesc> <polygon> -37.7047,148.4633 -37.70362554588509,148.46452632745192 -37.70234808197172,148.46548225154552 -37.70096800663633,148.46617382637936 -37.699519297172614,148.46658402308586 -37.698037622663726,148.46670274126072 -37.69655946598003,148.46652705766846 -37.69512122553519,148.4660612982222 -37.6937583189101,148.46531693146525 -37.69250431042862,148.46431228617763 -37.69139008419932,148.46307210006051 -37.69044308303358,148.46162691061207 -37.689686632040676,148.46001230319277 -37.68913936362089,148.4582680347959 -37.688814758080056,148.45643705509826 -37.6887208112358,148.45456444889672 -37.688859837244955,148.45269632597075 -37.689228411535865,148.45087868570675 -37.689817455258975,148.4491562844404 -37.6906124591638,148.4475715334072 -37.691593841358184,148.4461634544371 -37.69273743009186,148.4449667191075 -37.694015059617016,148.44401079501392 -37.6953952643879,148.44331922018006 -37.69684405444077,148.4429090234736 -37.69832575280385,148.44279030529873 -37.699803874271744,148.442965988891 -37.70124202387796,148.44343174833725 -37.70260479293354,148.44417611509417 -37.70385863058087,148.4451807603818 -37.70497266943382,148.4464209464989 -37.705919485022726,148.44786613594738 -37.706675770403834,148.44948074336668 -37.70722290938813,148.45122501176354 -37.707547434339816,148.45305599146116 -37.70764135732989,148.4549285976627 -37.70750236653653,148.45679672058867 -37.707133883084225,148.4586143608527 -37.70654497693064,148.46033676211903 -37.70575014385995,148.46192151315222 -37.7047,148.4633 </polygon> <geocode> <valueName> urn:oasis:names:tc:emergency:cap:1.2:profile:CAP-AU:1.0:postcode </valueName> <value/> </geocode> </area> <area> <areaDesc>Orbost</areaDesc> <circle>-37.70256500448905,148.45897299999686 0.0</circle> <geocode> <valueName> urn:oasis:names:tc:emergency:cap:1.2:profile:CAP-AU:1.0:postcode </valueName> <value/> </geocode> </area> <area> <areaDesc>Point_Of_Origin</areaDesc> <circle>-37.62316913477013,148.21478065303333 0.0</circle> <geocode> <valueName> urn:oasis:names:tc:emergency:cap:1.2:profile:CAP-AU:1.0:postcode </valueName> <value/> </geocode> </area> </info> </alert>

What is the expected output? What do you see instead? Should validate.

Please use labels and text to provide additional information.

sschiavoni commented 9 years ago

Comment #1 originally posted by yuch@google.com on 2014-01-23T03:13:14.000Z:

Fixed by https://code.google.com/p/cap-library/source/detail?r=e06b7ce5bf2da1cb91a98f1ea5b53551d8db57ef