Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 7th, 2004, 04:01 PM
roypython roypython is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 71 roypython User rank is Lance Corporal (50 - 100 Reputation Level)roypython User rank is Lance Corporal (50 - 100 Reputation Level)roypython User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 h 20 m 49 sec
Reputation Power: 5
Validating Xml against DTD

Hi.
I am trying to validate xml doc. against a DTD .
I'm using Debian's package "Python2.3-xml", but it just won't work
My questions:
1. How to validate xml with dtd using this package? ( I couldn't find any
documentation, it looks like a great package, but no docs available)
2. How to validate xml against dtd with any alternative Debian's package?
3. Is there a Debian package to validate xml against Xml schema?

I tried to validating something realy simple, like:

Xml code:

<?xml version="1.0"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>

dtd code:

<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>

and the "glue" code is:

import os
import sys

from xml.parsers.xmlproc import xmlval
from xml.parsers.xmlproc.utils import validate_doc, load_dtd, ErrorPrinter

dtd = load_dtd("/var/www/jazz/cgi-bin/mkentTest.dtd")
parser = xmlval.XMLValidator()
parser.dtd = dtd
parser.set_error_handler(ErrorPrinter(parser, out=sys.stdout))
parser.parse_resource("/var/www/jazz/cgi-bin/mkentconfTest.xml")


and it won't work ( it says that it can't find the elements)

Thanks a lot
Roy


Reply With Quote
  #2  
Old June 9th, 2004, 08:32 AM
joeandersen joeandersen is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 4 joeandersen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 m 34 sec
Reputation Power: 0
Validating XML schema

hello,

Please try ExamXML at URL

best regards.

Reply With Quote
  #3  
Old June 9th, 2004, 05:00 PM
roypython roypython is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 71 roypython User rank is Lance Corporal (50 - 100 Reputation Level)roypython User rank is Lance Corporal (50 - 100 Reputation Level)roypython User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 h 20 m 49 sec
Reputation Power: 5
Thanks

thank you,
It looks like a great tool to manipulate,calidate and compare xml files.
But it's not for free.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Validating Xml against DTD


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT