Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php xmlParsePITarget: invalid name prefix 'xml' error

Tags:

php

xslt

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

like image 415
Jeff Avatar asked Jun 18 '26 04:06

Jeff


1 Answers

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

  • Namespaces in XML 1.0: Reserved Prefixes and Namespace Names
like image 76
Paul Sweatte Avatar answered Jun 20 '26 19:06

Paul Sweatte



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!