[PHP] Need help for DOM xsd validation
Hi, I'm trying to load XML data into my script. That's no problem. The problem is, that the schema validation fails all time after loading a new document: Warning: DOMDocument::schemaValidate() [function.DOMDocument-schemaValidate]: Element '{http://www.desktopportal.de/Preferences}user': This element is not expected. Expected is ( user ). Funny is, if I'm creating and adding elements with php (DOMDocument etc.) and then validate the xml structure, no error occures. But if I reload this saved file next time when the script is reloading, I get a warning. Any ideas? Thanks, Matthias This is my xml file: ?xml version=1.0 encoding=UTF-8? preferences xmlns=http://www.desktopportal.de/Preferences; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; user id=1webmail//user user id=2webmail//user /preferences This is my xsd file: ?xml version=1.0 encoding=UTF-8? xsd:schema targetNamespace=http://www.desktopportal.de/Preferences; xmlns=http://www.desktopportal.de/Preferences; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xsd:element name=preferences type=typePreferences/ xsd:complexType name=typePreferences xsd:sequence xsd:element name=user type=typeUser minOccurs=0 maxOccurs=unbounded/ /xsd:sequence /xsd:complexType xsd:complexType name=typeUser xsd:sequence xsd:element name=webmail type=typeWebmail maxOccurs=1 minOccurs=1/ /xsd:sequence xsd:attribute name=id type=xsd:int use=required/xsd:attribute /xsd:complexType xsd:complexType name=typeWebmail xsd:sequence xsd:element name=mailbox type=typeMailbox minOccurs=0 maxOccurs=unbounded/ /xsd:sequence /xsd:complexType xsd:complexType name=typeMailbox xsd:sequence xsd:element name=box type=typeBox minOccurs=1 maxOccurs=unbounded/ /xsd:sequence xsd:attribute name=id type=xsd:int use=required/xsd:attribute /xsd:complexType xsd:complexType name=typeBox xsd:sequence xsd:element name=visibility type=xsd:boolean minOccurs=1 maxOccurs=1/ /xsd:sequence xsd:attribute name=name type=xsd:string use=required/xsd:attribute /xsd:complexType /xsd:schema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Need help for DOM xsd validation
Hi, I'm trying to load XML data into my script. That's no problem. The problem is, that the schema validation fails all time after loading a new document: Warning: DOMDocument::schemaValidate() [function.DOMDocument-schemaValidate]: Element '{http://www.desktopportal.de/Preferences}user': This element is not expected. Expected is ( user ). Funny is, if I'm creating and adding elements with php (DOMDocument etc.) and then validate the xml structure, no error occures. But if I reload this saved file next time when the script is reloading, I get a warning. Any ideas? Thanks, Matthias This is my xml file: ?xml version=1.0 encoding=UTF-8? preferences xmlns=http://www.desktopportal.de/Preferences; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; user id=1webmail//user user id=2webmail//user /preferences This is my xsd file: ?xml version=1.0 encoding=UTF-8? xsd:schema targetNamespace=http://www.desktopportal.de/Preferences; xmlns=http://www.desktopportal.de/Preferences; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xsd:element name=preferences type=typePreferences/ xsd:complexType name=typePreferences xsd:sequence xsd:element name=user type=typeUser minOccurs=0 maxOccurs=unbounded/ /xsd:sequence /xsd:complexType xsd:complexType name=typeUser xsd:sequence xsd:element name=webmail type=typeWebmail maxOccurs=1 minOccurs=1/ /xsd:sequence xsd:attribute name=id type=xsd:int use=required/xsd:attribute /xsd:complexType xsd:complexType name=typeWebmail xsd:sequence xsd:element name=mailbox type=typeMailbox minOccurs=0 maxOccurs=unbounded/ /xsd:sequence /xsd:complexType xsd:complexType name=typeMailbox xsd:sequence xsd:element name=box type=typeBox minOccurs=1 maxOccurs=unbounded/ /xsd:sequence xsd:attribute name=id type=xsd:int use=required/xsd:attribute /xsd:complexType xsd:complexType name=typeBox xsd:sequence xsd:element name=visibility type=xsd:boolean minOccurs=1 maxOccurs=1/ /xsd:sequence xsd:attribute name=name type=xsd:string use=required/xsd:attribute /xsd:complexType /xsd:schema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php