Go Back   SitePoint Forums > Forum Index > Program Your Site > XML and Web Services
Newsletter FAQ Members List Calendar Mark Forums Read

New to SitePoint Forums? Register here for free!

SitePoint Sponsor
 
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old Oct 17, 2005, 15:14   #1
leblanc
SitePoint Evangelist
 
Join Date: Aug 2004
Posts: 428
xml - create a validator with dtd or xsd - db concept of 2 primary keys

I am having a hard time generating a validator for an xml file which eventually it's attributes will go into a database.

Heres a simple example of where being able to set 2 primary keys in a db helps with.

location="0" owner="0"
location="0" owner="1"
location="1" owner="0"
location="1" owner="1"
location="1" owner="1" - yeilds error as that SET (location and owner) already exists.

How can i get a dtd or xsd file to validate my document in a similar way? So that a set is considered unique. - (and only when the set is a duplicate will i get warning when I call $dom->validate() )

Also how can i get the unique keys not only to be numbers but strings with odd characters like location="b/gh/"

This data is basically a menu system on a website. Where the location can be the same but owned by a different user.

Example: bob and dan have written an article about jane... to get to that article .. the url will look as follows:
bob.asdf.com/jane/
dan.asdf.com/jane/

notice how setting 2 primary keys help differentiate between the data.



Here is what i currently have. Any help/advice/ ect would be appreciated.

PHP Code:

<?xml version="1.0" encoding="iso-8859-1"?>

<!DOCTYPE sitemap [
   <!ELEMENT sitemap (item)>
   <!ELEMENT item (item*)>
   <!ATTLIST item
          name CDATA #REQUIRED
          description CDATA #REQUIRED
          location ID #REQUIRED>
]>
<sitemap>
     <item name="home" description="home link" location="b/gh/">
           <item name="services" description="services link" location="test1">
                 <item name="advertising" description="advertising link" location="test2"></item>
                 <item name="telecommunications" description="telecom link" location="test3"></item>
           </item>
           <item name="about" description="about link" location="test4">
                 <item name="company overview" description="company overview link" location="test5">
                           <item name="management team" description="management team link" location="test6"></item>
                 </item>
                 <item name="satisfied clients" description="satisfied clients link" location="test7"></item>
           </item>
           <item name="products" description="products link" location="test8"></item>
     </item>
</sitemap>
leblanc is offline   Reply With Quote
 

Bookmarks

« Previous Thread | Next Thread »

Thread Tools
Display Modes

 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Sponsored Links
 
Forum Jump


All times are GMT -7. The time now is 03:24.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright 1998-2009, SitePoint Pty Ltd. All Rights Reserved