Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: Need help with this schema >Thread Next - Re: Need help with this schema Re: Need help with this schemaTo: NULL Date: 8/4/2006 10:06:00 AM Thanks for the tip about mixed elements, that's exactly what I needed. Regarding the namespaces, my problem is that the xml is generated by a 3rd party app, and I'm trying to create an xsd basically to document for our purposes what the xml would look like. Unfortunately the root node has a namespace and prefix (<ns0:Assessment xmlns:ns0="http://AIM.xsd">) but non of the child elements do. Any way to get this to validate with a schema? "George Bina" <george@o...> wrote in message news:1154505542.754439.68980@h...... > Hi Jeremy, > > To allow both elements and text content in an element add mixed="true" > to the complex type for that element. Note that you have placed > incorrectly all the elements except the root element in no namespace > instead of schema target namespace. You can find below a corrected > instance and an updated schema to allow mixed content in all the > elements that contain mixed content in the sample instance document. > > <Assessment xmlns="http://AIM.xsd"> > <Location>ABC</Location> > <Client>1234A</Client> > <Client_Name>FRED SMITH</Client_Name> > <Address>123 St, City Prov</Address> > <City>CityName</City> > <Province>AB</Province> > <Postal_Code>LNL NLN</Postal_Code> > <Telephone>555-555-5555</Telephone> > <System>Assessment</System> > <Type>Assessment</Type> > <Date>28 JUN 06</Date> > <Completed_By>UserName</Completed_By> Additional Text > <Section Value="AA"> Additional text > <Question Value="1.A"> Question text > <Question_Text>Question text</Question_Text> > <Answer_Text>Answer</Answer_Text> > <Answer_Value>1</Answer_Value> > </Question> > <Question Value="1.B"> Question text > <Question_Text>Question text</Question_Text> > <Answer_Text>Answer</Answer_Text> > <Answer_Value>1</Answer_Value> > </Question> > </Section> > <Section Value="CC"> Referral Items > <Question Value="1"> Question text > <Question_Text>Question text</Question_Text> > <Answer_Text>Answer</Answer_Text> > <Answer_Value>1</Answer_Value> > </Question> > </Section> > </Assessment> > > <?xml version="1.0" encoding="UTF-8"?> > <xs:schema xmlns:ns0="http://AIM.xsd" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > targetNamespace="http://AIM.xsd" > elementFormDefault="qualified" attributeFormDefault="unqualified"> > <xs:element name="Assessment"> > <xs:complexType mixed="true"> > <xs:sequence> > <xs:element name="Location" type="xs:string"/> > <xs:element name="Client" type="xs:string"/> > <xs:element name="Client_Name" type="xs:string"/> > <xs:element name="Address" type="xs:string"/> > <xs:element name="City" type="xs:string"/> > <xs:element name="Province" type="xs:string"/> > <xs:element name="Postal_Code" type="xs:string"/> > <xs:element name="Telephone" type="xs:string"/> > <xs:element name="System" type="xs:string"/> > <xs:element name="Type" type="xs:string"/> > <xs:element name="Date" type="xs:string"/> > <xs:element name="Completed_By" type="xs:string"/> > <xs:element name="Section" maxOccurs="unbounded"> > <xs:complexType mixed="true"> > <xs:sequence> > <xs:element name="Question" maxOccurs="unbounded"> > <xs:complexType mixed="true"> > <xs:sequence> > <xs:element name="Question_Text" type="xs:string"/> > <xs:element name="Answer_Text" type="xs:string"/> > <xs:element name="Answer_Value" type="xs:string"/> > </xs:sequence> > <xs:attribute name="Value" type="xs:string" > use="required"/> > </xs:complexType> > </xs:element> > </xs:sequence> > <xs:attribute name="Value" type="xs:string" > use="required"/> > </xs:complexType> > </xs:element> > </xs:sequence> > </xs:complexType> > </xs:element> > </xs:schema> > > > Best Regards, > George > --------------------------------------------------------------------- > George Cristian Bina > <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger > www.---.com > > Jeremy Chapman wrote: >> I've got the following xml, and I'm trying to develop an xsd (below) to >> validate it. For the most part, my xsd is good, except I am having >> trouble >> accomodating the text after the Completed_By tag. How can I do this? >> >> <ns0:Assessment xmlns:ns0="http://AIM.xsd"> >> <Location>ABC</Location> >> <Client>1234A</Client> >> <Client_Name>FRED SMITH</Client_Name> >> <Address>123 St, City Prov</Address> >> <City>CityName</City> >> <Province>AB</Province> >> <Postal_Code>LNL NLN</Postal_Code> >> <Telephone>555-555-5555</Telephone> >> <System>Assessment</System> >> <Type>Assessment</Type> >> <Date>28 JUN 06</Date> >> <Completed_By>UserName</Completed_By> Additional Text >> <Section Value="AA"> Additional text >> <Question Value="1.A"> Question text >> <Question_Text>Question text</Question_Text> >> <Answer_Text>Answer</Answer_Text> >> <Answer_Value>1</Answer_Value> >> </Question> >> <Question Value="1.B"> Question text >> <Question_Text>Question text</Question_Text> >> <Answer_Text>Answer</Answer_Text> >> <Answer_Value>1</Answer_Value> >> </Question> >> </Section> >> <Section Value="CC"> Referral Items >> <Question Value="1"> Question text >> <Question_Text>Question text</Question_Text> >> <Answer_Text>Answer</Answer_Text> >> <Answer_Value>1</Answer_Value> >> </Question> >> </Section> >> </ns0:Assessment> >> >> >> <?xml version="1.0" encoding="UTF-8"?> >> <xs:schema xmlns:ns0="http://AIM.xsd" >> xmlns:xs="http://www.w3.org/2001/XMLSchema" >> targetNamespace="http://AIM.xsd" >> elementFormDefault="qualified" attributeFormDefault="unqualified"> >> <xs:element name="Assessment"> >> <xs:complexType> >> <xs:sequence> >> <xs:element name="Location" type="xs:string"/> >> <xs:element name="Client" type="xs:string"/> >> <xs:element name="Client_Name" type="xs:string"/> >> <xs:element name="Address" type="xs:string"/> >> <xs:element name="City" type="xs:string"/> >> <xs:element name="Province" type="xs:string"/> >> <xs:element name="Postal_Code" type="xs:string"/> >> <xs:element name="Telephone" type="xs:string"/> >> <xs:element name="System" type="xs:string"/> >> <xs:element name="Type" type="xs:string"/> >> <xs:element name="Date" type="xs:string"/> >> <xs:element name="Completed_By" type="xs:string"/> >> <xs:element name="Section" maxOccurs="unbounded"> >> <xs:complexType> >> <xs:sequence> >> <xs:element name="Question" maxOccurs="unbounded"> >> <xs:complexType> >> <xs:sequence> >> <xs:element name="Question_Text" type="xs:string"/> >> <xs:element name="Answer_Text" type="xs:string"/> >> <xs:element name="Answer_Value" type="xs:string"/> >> </xs:sequence> >> <xs:attribute name="Value" type="xs:string" use="required"/> >> </xs:complexType> >> </xs:element> >> </xs:sequence> >> <xs:attribute name="Value" type="xs:string" use="required"/> >> </xs:complexType> >> </xs:element> >> </xs:sequence> >> </xs:complexType> >> </xs:element> >> </xs:schema> > | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
