|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
Validate XML Documents
All,Troy Simpson 04/26/04 04:31 P www.cflib.org/udf.cfm/validateXMLStringRaymond Camden 04/26/04 04:35 P Thanks for the response.Troy Simpson 04/26/04 04:39 P Ah, sorry about that.Raymond Camden 04/26/04 04:47 P I guess you can use Java XML parsersQasim Rasheed 04/26/04 10:03 P The JRE 1.4.2 that ships with CF 6.1 doesn't include XSD validation as partMassimo, Tiziana e Federica 04/27/04 12:59 A On Mon, 2004-04-26 at 13:29, Troy Simpson wrote:Rob 04/26/04 10:45 P Here is a good blurb on how to do it in java - pretty similar steps inRob 04/26/04 11:04 P All, Is there a ColdFusion Function to validate an XML Document against a its schema? Thanks, -- Troy Simpson Applications Analyst/Programmer, OCPDBA, MCSE, SCSA North Carolina State University Libraries Campus Box 7111 | Raleigh | North Carolina ph.919.515.3855 | fax.919.513.3330 E-mail: Troy_Simpson@ncsu.edu www.cflib.org/udf.cfm/validateXMLString Thanks for the response. This only validates a formatted XML string against a DTD. I need to validate the XML doc against an XSD. Troy Raymond Camden wrote: > www.cflib.org/udf.cfm/validateXMLString Ah, sorry about that. I guess you can use Java XML parsers Qaso, Thanks for the response. This only validates a formatted XML string against a DTD. I need to validate the XML doc against an XSD. Troy Raymond Camden wrote: > www.cflib.org/udf.cfm/validateXMLString > _____ The JRE 1.4.2 that ships with CF 6.1 doesn't include XSD validation as part of its APIs. You can install and use another XML parser to do the job (Xerces is the first that comes to mind) You already got suggestion about the code required, the topic is covered very well here: http://www.ibiblio.org/xml/books/xmljava/chapters/ch07s04.html#d0e10881 ---------------------------- Massimo Foti http://www.massimocorner.com Co-Author of Dreamweaver MX 2004 Magic: http://www.dwmagic.com/ On Mon, 2004-04-26 at 13:29, Troy Simpson wrote: > All, > > Is there a ColdFusion Function to validate an XML Document against a its > schema? As far as I know the only java parser (last I heard anyway) that validates with a schema is Xerces (which cf uses I think). However, I don't think there is a standard, cross parser, way in java to do xsd validation (unlike dtd) so there are not many java products that do xsd validation yet. This is quite a stretch as my cf sever is out of commission right now so this is a totally untested code - but you could try something like: <cfscript> parser = CreateObject("java","org.apache.xerces.parsers.DOMParser"); //this might be needed... //parser.init(); parser.setFeature("http://xml.org/sax/features/validation", true); parser.setProperty( "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation", "test.xsd" ); parser.parse("test.xml"); </cfscript> Look around on the www.apache.org site for xerces xsd validation, if cf still uses it ... it might use Crimson ... some MM guy might chime in... Good luck, -- Rob <me@robrohan.com> Here is a good blurb on how to do it in java - pretty similar steps in cf http://www.geocities.com/herong_yang/jdk/xsd_validation.html On Mon, 2004-04-26 at 19:39, Rob wrote: ----- Excess quoted text cut - see Original Post for more ----- -- Rob <me@robrohan.com>
|
March 14, 2010
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||