reslafinal
New Member
I am wondering how to define a namespace correctly with XML and XSD. I have the following XML-File:\[code\]<?xml version="1.0" encoding="utf-8" standalone="no"?><application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:app="ms.xsd" xsi:schemaLocation="ms.xsd"> <app:contactPerson> <app:name>Florian</app:name> <app:countryCode>FR</app:countryCode> </app:contactPerson> <app:contactPerson> <app:name>Gabi</app:name> <app:countryCode>DE,EE,EL,FI,FR,IE,UK</app:countryCode> </app:contactPerson> <app:contactPerson> <app:name>Gert</app:name> <app:countryCode>GB</app:countryCode> </app:contactPerson> <apprigin/></application>\[/code\]And the schema is defined by the file ms.xsd in the same folder:\[code\]<?xml version="1.0" encoding="utf-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" version="0.2" targetNamespace="ms.xsd" xmlns:app="ms.xsd"> <xs:element name="application" type="app:applicationType"/> <xs:complexType name="applicationType"> <xs:sequence> <xs:element name="contactPerson" type="app:contactPersonType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="origin" type="appriginType" minOccurs="0"/> </xs:sequence> </xs:complexType> <xs:complexType name="contactPersonType"> <xs:sequence> <xs:element name="name" type="xs:string"/> <xs:element name="countryCode" type="xs:string"/> </xs:sequence> </xs:complexType> <xs:complexType name="originType"> <xs:sequence minOccurs="0"> <xs:element name="street" type="xs:string"/> <xs:element name="city" type="xs:string"/> <xs:element name="country" type="xs:string"/> <xs:element name="further_details" type="xs:string"/> </xs:sequence> </xs:complexType></xs:schema>\[/code\]I already tried a lot of things. The error I get with this (currently) final version isERROR: Element 'application': No matching global declaration available for the validation root.Is this because the xsd-reference in the xml-file is within the application-tag, such that it comes 'too late'? When I add an "envelope"-tag around everything and put the xsd-definition there, I get the messageERROR: Element 'envelope': No matching global declaration available for the validation root.So now I'm really confused on how to do this correctly. I am validating the XML against the XSD using XML-Tools in Notepadd++.