1 / 9

Schema validation with java

Schema validation with java. xml xsd 8.10.08. Agenda. Umgebung Programm Output. Umgebung. Eclipse 3.3.1.1 Java 1.5 Erweiterung http://jdom.org/dist/binary java archives: jdom.jar und xerces.jar. public class Xmlschema { public static void main( String[] args ) { try {

ganit
Télécharger la présentation

Schema validation with java

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Schema validationwith java xml xsd 8.10.08

  2. Agenda • Umgebung • Programm • Output 08.10.08

  3. Umgebung • Eclipse 3.3.1.1 • Java 1.5 • Erweiterung http://jdom.org/dist/binary • java archives: jdom.jar und xerces.jar 08.10.08

  4. publicclass Xmlschema { publicstaticvoid main( String[] args ) {try { File xsdFile = new File(“c:\countries.xsd"); File xmlFile = new File(“c:\countries.xml"); SAXBuilder builder = new SAXBuilder("org.apache.xerces.parsers.SAXParser", true); builder.setFeature("http://apache.org/xml/features/validation/schema", true); builder.setProperty(http://apache.org/xml/properties/schema + "/external-noNamespaceSchemaLocation", xsdFile.toURL().toString() ); org.jdom.Document doc = builder.build( xmlFile ); System.out.println( "Successfully parsed and validated" ); catch ( Exception cause ) {System.err.println( cause.toString() );}}} Program 08.10.08

  5. “Output” 08.10.08

  6. “Output” 08.10.08

  7. File: defineexample1.xml xsi:schemaLocation="http://www.cdisc.org/ns/odm/v1.2 define1-0-0.xsd" schema location 08.10.08

  8. schemata define1-0-0.xsd <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/03/xml.xsd"/> <xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd"/> <xs:include schemaLocation="http://www.cdisc.org/schema/def/v1.0/define-extension.xsd"/> define-extension.xsd <xs:import namespace="http://www.cdisc.org/ns/def/v1.0" schemaLocation="http://www.cdisc.org/schema/def/v1.0/define-ns.xsd"/> <xs:redefine schemaLocation="http://www.cdisc.org/schema/odm/v1.2.1/ODM1-2-1.xsd"> 08.10.08

  9. Fragen • Gibt es andere Lösungen (sas) ? 08.10.08

More Related