I've been happily building a file with odfWeave, and just as the hour draws nigh for it to be sent off, odfWeave or XML throws the following catastrophic error: ...this is the tail of entirely uneventful processing of input file..... 31 : term xml(label=LR_Fall_Model_Results) 32 : term verbatim(label=LR_Model_Fall_graph) 33 : term xml(label=LR_OMC_tab) 'content_1.xml' has been Sweaved Removing content.xml Post-processing the contents xmlParseStartTag: invalid element name Entity 'apos' not defined Entity 'apos' not defined This triplet of errors XMLParse, and duplicate "Entity" lines is reported several times, then XML or odfWeave packs up its toys, and goes home without an output file. I'd (desperately) love any insights anyone might have. Thanks, Rob
Hi Rob. Without the file content_1.xml or any information from the R call stack (e.g. options(error = recover) and then run the command and dynamically explore the state of affairs when the error occurs), there is no way for us to know what the problem might be. Somehow, the XML parser appears to be seeing a <token and token is not a legitimate XML element name. It may also be seeing ' which would identify an XML entity. Assuming that this is what the XML parser is seeing, the question is how they got into the document. So we need more to start diagnosing the problem. D. Rob James wrote:> I've been happily building a file with odfWeave, and just as the hour > draws nigh for it to be sent off, odfWeave or XML throws the following > catastrophic error: > > > ...this is the tail of entirely uneventful processing of input file..... > > 31 : term xml(label=LR_Fall_Model_Results) > 32 : term verbatim(label=LR_Model_Fall_graph) > 33 : term xml(label=LR_OMC_tab) > > 'content_1.xml' has been Sweaved > > Removing content.xml > > Post-processing the contents > xmlParseStartTag: invalid element name > Entity 'apos' not defined > Entity 'apos' not defined > > > This triplet of errors XMLParse, and duplicate "Entity" lines is > reported several times, then XML or odfWeave packs up its toys, and > goes home without an output file. > > I'd (desperately) love any insights anyone might have. > > Thanks, > > Rob > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Just to close out my earlier posting, I have identified and resolved the following odfWeave/XML error:>> xmlParseStartTag: invalid element name >>I used odfWeave to call various logistic regression models which included the above mentioned variable. odfWeave failed to generate the destination file throwing multiple lines of the above error. It happened that the dataset originated in STATA (probably irrelevant), and included a variable which had five levels. Two of those levels had values of "(1)<3500" and "(5)=>5000". So, while these codes did not appear in the source document, these codes appear in the odfWeave destination file. The results were displayed in the document using the following crude method: results <-glm(...... and subsequently reported out using : odfTable( as.matrix(results[,c(X1, X2, X3)],) horizontal = TRUE) odfTableCaption("Selected Logistic Regression Results for RXN3 outcome") @ I received xmlParseStartTag errors for each such table. Editting of the XML file in gedit highlighted the above values as problematic. I then removed the two problematic value for this variable, and re-ran odfWeave, which generated the output I needed. So, it appears that these values of this variable operated as invalid xmlParseStartTags, and that the process of wrapping up content_1.xml back into an ODF file failed because of the mis-recognition of these ParseStartTags found embedded in the data. I think this is likely to be regarded more as a feature than as a bug, but it is none-the-less a cautionary tale.
There is a function called odfTranslate that will help deal with characters that might confound XML. You might need to use it on the row/column names of your output. Max On Oct 10, 2009, at 11:33 AM, Rob James <rob at aetiologic.ca> wrote:> Just to close out my earlier posting, I have identified and resolved > the following odfWeave/XML error: > >>> xmlParseStartTag: invalid element name >>> > > I used odfWeave to call various logistic regression models which > included the above mentioned variable. odfWeave failed to generate > the destination file throwing multiple lines of the above error. > > It happened that the dataset originated in STATA (probably > irrelevant), and included a variable which had five levels. Two of > those levels had values of > "(1)<3500" and "(5)=>5000". > So, while these codes did not appear in the source document, these > codes appear in the odfWeave destination file. The results were > displayed in the document using the following crude method: > > results <-glm(...... > > and subsequently reported out using : > > odfTable( > > as.matrix(results[,c(X1, X2, X3)],) > > horizontal = TRUE) > > odfTableCaption("Selected Logistic Regression Results for RXN3 > outcome") > > > @ > > I received xmlParseStartTag errors for each such table. Editting of > the XML file in gedit highlighted the above values as problematic. > > I then removed the two problematic value for this variable, and re- > ran odfWeave, which generated the output I needed. > > So, it appears that these values of this variable operated as > invalid xmlParseStartTags, and that the process of wrapping up > content_1.xml back into an ODF file failed because of the mis- > recognition of these ParseStartTags found embedded in the data. I > think this is likely to be regarded more as a feature than as a bug, > but it is none-the-less a cautionary tale. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.