Jump to content

Lynx

Members
  • Posts

    2
  • Joined

  • Last visited

About Lynx

  • Birthday 01/29/1976

Contact Methods

  • Skype
    grendizer76

Lynx's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Lynx

    XML Schema basics

    Thanks Boen for quick reply!Yep! Infact I was reading some articles related with XML Schema validators and I understood that it's not possible to delegate the burden of validation just to the browser. That's why I need PHP libxml or DOMdocument ( exactly DOMDocument::schemaValidate() ) extensions in order to do this.
  2. Lynx

    XML Schema basics

    Hi everybody,I am new of this forum and newbie of XML Schema so please forgive my silly question but I really need to understand one thing. I have a schema like in the tutorial: note.xsd <?xml version="1.0"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"targetNamespace="http://www.w3schools.com"xmlns="http://www.w3schools.com"elementFormDefault="qualified"><xs:element name="note"> <xs:complexType> <xs:sequence> <xs:element name="to" type="xs:string"/> <xs:element name="from" type="xs:string"/> <xs:element name="heading" type="xs:string"/> <xs:element name="body" type="xs:string"/> </xs:sequence> </xs:complexType></xs:element></xs:schema> and an the XML with reference to the XML Schema: <?xml version="1.0"?><notexmlns="http://www.w3schools.com"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.w3schools.com note.xsd"> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body></note> ( Note: note.xml and note.xsd are in the same directory ) I am still learning something about basics rules and I tryed to change something within the XML file in order to make some tests on my local machine.In the example above I tryed to change the parameter of the element "to" like this: <xs:element name="to" type="xs:string"/> in <xs:element name="to" type="xs:integer" /> from string to integer in order to check the behaviour when I read my .xml through browser but seems nothing happen.I also tryed something like this : <xs:element name="to" type="xs:string" default="No name specified" /> and left the element "to" empty. <to></to>I was expecting to read something like this: <to>No name specified</to> when reading my xml but I simply get a tag like this <to/> Maybe the file xsd doesn't affect directly on xml?Where can i find a real working example? Thanks in advance
×
×
  • Create New...