You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Context: To test any package which uses atom4R, any attributes of any objects which are dependent on untrollable variables, such as current time or timezone of test environments, must be standardised. It is therefore necessary to be able to set a standard "updated" time using the setUpdated method. Doing so, however, leads to this issue:
At that stage, all looks good, and the updated field has merely changed iternally. But then:
m$validate ()
#> [atom4R][WARN] Element '{http://www.w3.org/2005/Atom}updated', attribute 'tzone': The attribute 'tzone' is not allowed at line 2. #> [atom4R][WARN] Object 'DCEntry' is INVALID according to Atom XML schemas!#> [1] FALSE
And that happens because of the code in the 'validate' method:
self <- m
schemaNamespaceId <- self$namespace$id
xml <- self$encode(addNS = TRUE, validate = FALSE, strict = strict)
print (xml)
#> <atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
#> <atom:updated tzone="CEST">2022-01-01T00:00:01+00:00</atom:updated>
#> <!--Creation date/time: 2022-10-06T14:59:56-->
#> <!--Atom XML generated by atom4R R package - Version 0.3-1-->
#> <!--Atom XML compliance: NOT TESTED-->
#> <!--atom4R R package information: Contact: Emmanuel Blondel emmanuel.blondel1@gmail.com URL: https://github.com/eblondel/atom4R BugReports: https://github.com/eblondel/atom4R-->
#> </atom:entry>
xsd <- getAtomSchemas()
if(is(xml, "XMLInternalNode")) xml <- XML::xmlDoc(xml)
report <- XML::xmlSchemaValidate(xsd, xml)
report$errors[[1]]$msg
#> [1] "Element '{http://www.w3.org/2005/Atom}updated', attribute 'tzone': The attribute 'tzone' is not allowed.\n"
isValid <- report$status == 0 # FALSE
So atom4R then inserts a tzone="CEST" value into the XML and renders it invalid. Note that in the initial call before setUpdated() is called, then tzone is still there yet empty (so tzone=""). Then the xmlSchemaValidate() method does not complain.
The text was updated successfully, but these errors were encountered:
Context: To test any package which uses
atom4R
, any attributes of any objects which are dependent on untrollable variables, such as current time or timezone of test environments, must be standardised. It is therefore necessary to be able to set a standard "updated" time using thesetUpdated
method. Doing so, however, leads to this issue:At that stage, all looks good, and the
updated
field has merely changed iternally. But then:And that happens because of the code in the 'validate' method:
Created on 2022-10-06 with reprex v2.0.2
So
atom4R
then inserts atzone="CEST"
value into the XML and renders it invalid. Note that in the initial call beforesetUpdated()
is called, thentzone
is still there yet empty (sotzone="")
. Then thexmlSchemaValidate()
method does not complain.The text was updated successfully, but these errors were encountered: