Jeff
Jeff

Reputation: 4003

php xmlParsePITarget: invalid name prefix 'xml' error

Can one help me understand (and fix this error). The error reads:

Warning: simplexml_load_file(): /home/jeffreycwitt/webapps/lombardpress_instances/petrusplaoul/lombardpress/phpfunctions/../../projectfiles/GitTextfiles/lectio1/lectio1.xml:2: parser warning : xmlParsePITarget: invalid name prefix 'xml' in home/jeffreycwitt/webapps/lombardpress_instances/petrusplaoul/lombardpress/phpfunctions/generalfunctions.php on line 47

The error seems to have something to do with my schema delcarations at the beginning of my xml files.

The declaration at the beginning of the file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://bitbucket.org/lombardpress/lombardpress-schema/raw/master/LombardPressODD.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="https://bitbucket.org/lombardpress/lombardpress-schema/raw/master/LombardPressODD.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<TEI xmlns="http://www.tei-c.org/ns/1.0" xmlns:xi="http://www.w3.org/2001/XInclude">
    <teiHeader>

I don't understand why I'm getting the warning. On systems where I can turn of "display_errors" this hasn't been a problem. But now I'm working with a system in which I do not have access to the php.ini file.

Ideally, I'd like to solve the problem so that I don't have any warnings. However, I need the schema declarations in place for other reasons.

Suggestions. jw

Upvotes: 3

Views: 3723

Answers (1)

Paul Sweatte
Paul Sweatte

Reputation: 24617

There is one issue:

  • The <?xml prefix is reserved for the first line

Use an underscore as a simple fix:

<?_xml-model href="https://bitbucket.org/lombardpress/lombardpress-schema/raw/master/LombardPressODD.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?_xml-model href="https://bitbucket.org/lombardpress/lombardpress-schema/raw/master/LombardPressODD.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>

References

Upvotes: 6

Related Questions