Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within XML
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
XML and Related Technologies
Validate XML Document
Deon Bottha
Greenhorn
Posts: 1
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi I was wondering how I could validate a document based on a hard coded
string
representing a dtd in my program. basically I have:
private static final String DTD = // dtd that the animation xml file must follow "<?xml version='1.0' encoding='utf-8'?>" + "<!ELEMENT animation (frame+)>" + "<!ELEMENT frame (#PCDATA)>" + "<!ATTLIST frame duration CDATA #REQUIRED>"; Document doc;
doc
has allready been filled with xml data:
DOMResult result = new DOMResult(doc); StreamSource source = new StreamSource(zip.getInputStream(zip.getEntry("animation.xml"))); TransformerFactory tfactory = TransformerFactory.newInstance(); Transformer transformer = tfactory.newTransformer(); transformer.transform(source, result);
now i simply want to validate the document against my hard coded dtd. Thanks
Been there. Done that. Went back for more. But this time, I took this tiny ad with me:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Proper use of an EntityResolver
org.w3c.dom.DOMException: DOM003 Namespace error
Simple XSL transformation
DTD Validation problem via Sax
Inserting node in XMl and retaining doc type information
More...