From rasmussen.bryan at gmail.com  Fri Nov 16 15:10:07 2012
From: rasmussen.bryan at gmail.com (bryan rasmussen)
Date: Fri, 16 Nov 2012 15:10:07 +0100
Subject: [Rd] xmlParseDoc parser errors
Message-ID: <CAHKsR69NPN4vVHAS8SvYGyEqjMBc7x9GFisjOe9x9Uwi1bkK0A@mail.gmail.com>

Hi,

I have some XML files that have a processing instruction directly
after the XML declaration

when I do
kgroup.reading <- character(0)
for (file in file_list){kgroup.reading <-
xmlParseDoc(file.path("c:","projects","respositories","dk","004",file))}

I get the error
file name :1: parser error : Start tag expected, '<' not found

When I remove the processing instruction and try to load it again I do
not get the parser error.

This is of course understandable because of

 [Definition: Processing instructions (PIs) allow documents to contain
instructions for applications.]
Processing Instructions
[16]   	PI	   ::=   	'<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>'
[17]   	PITarget	   ::=   	Name - (('X' | 'x') ('M' | 'm') ('L' | 'l'))

PIs are not part of the document's character data, but MUST be passed
through to the application. The PI begins with a target (PITarget)
used to identify the application to which the instruction is directed.
The target names " XML ", " xml ", and so on are reserved for
standardization in this or future versions of this specification. The
XML Notation mechanism may be used for formal declaration of PI
targets. Parameter entity references MUST NOT be recognized within
processing instructions.

from the specification, on the other hand it does not say that it is
never allowed for any PI given that they (the W3C) are planning to use
it for  'standardization in this or future versions of this
specification'

Unfortunately the people who made the xml-model processing instruction

http://www.w3.org/TR/2012/NOTE-xml-model-20121009/#the-xml-model-processing-instruction

I guess decided they had the right to standardize a processing
instruction name.

Is there any way to get around this problem?

Also When I do the following:

 t <- '<?xml version="1.0" encoding="utf-8"?><?xml-model
href="urn:publicid:-:Thomson+Information+AS:DTD+AFGRDOK:DK"?><t></t>'
> xmlParseDoc(t)
I get the parser warning

<?xml version="1.0" encoding="utf-8"?><?xml-model
href="urn:publicid:-:Thomson+Information+AS:DTD+AFGRDOK:DK"?><t></t>:1:
parser warning : xmlParsePITarget: invalid name prefix 'xml'
<?xml version="1.0" encoding="utf-8"?><?xml-model href="urn:publicid:-:Thomson+I

Why do I get it as a parser error when I load the document, but a
parser warning when I load it as a string?
Anyway just to get it as a warning when I load the document?

Thanks,
Bryan Rasmussen



[Rd] xmlParseDoc parser errors
bryan rasmussen