[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Could you take a look at my XMLSchema and/or XMLSpy problem please!!!
Hi, i'm a new user of this list! I have some problem with my schema. It make two days that i'm searching for the problem. I would like to know if this schema is well written. Could you please tell me ? ------------------------------------ This is the schema i am talking about (bidon17.xsd). It's a simple schema witth the root element ROOT and a sub-element LOM wich is defined in an external schema from the LOM spec. <?xml version="1.0" encoding="UTF-8"?> <xs:schema targetNamespace="http://www.bidon.org/blahblah" xmlns:lom="http://www.imsglobal.org/xsd/imsmd_rootv1p2p1" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:import namespace="http://www.imsglobal.org/xsd/imsmd_rootv1p2p1" schemaLocation="http://www.imsglobal.org/xsd/imsmd_rootv1p2p1.xsd"/> <xs:element name="ROOT"> <xs:annotation> <xs:documentation>Comment describing your root element</xs:documentation> </xs:annotation> <xs:complexType> <xs:sequence> <xs:element name="lom" type="lom:lomType"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> ---------------------------------------------------- I wanna know if my schema is good because after that, i got the following problem : When i use the Generate Java Code command from XMLSpy i get some code. Then i use the java code to generate a simple file. This is my code. It create the sample document, and save it. bidon17Doc doc = new bidon17Doc(); // LOM - GENERAL - TITLE langstringType titleStr = new langstringType(); titleStr.addlang("fr"); titleStr.setValue(new SchemaString("title")); titleType title = new titleType(); title.addlangstring(titleStr); // LOM - GENERAL generalType general = new generalType(); general.addtitle(title); // LOM lomType lomElmt = new lomType(); lomElmt.addgeneral(general); // ROOTType root = new ROOTType(); root.addlom(lomElmt); doc.setSchemaLocation(sDefaultSchemaPath); doc.setRootElementName(sDefaultSchemaPath, "connaissances"); doc.save(sDefaultPath, root); -------------------------------------------------------------------------- This is the output file i got (output.xml) by running the above code : <?xml version="1.0" encoding="UTF-8"?> <ROOT xmlns="http://www.bidon.org/blahblah" xmlns:lom="http://www.imsglobal.org/xsd/imsmd_rootv1p2p1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="D:\CONTENU\bidon17.xsd D:\CONTENU\bidon17.xsd"> <lom> <lom:general> <lom:title> <lom:langstring lom:lang="fr">title</lom:langstring> </lom:title> </lom:general> </lom> </ROOT> The problem with this output file is that lom:lang SHOULD HAVE BEEN xml:lang instead! This make that the output file is not valid! Have you an idea, from where the problem may come ? Is it an error in my schema ? In my java code? If you could take a look at my schema, or if you have XMLSpy and could try my code, i would really appreciate, thanks. Thanks you, Philippe _________________________________________________________________ MSN Search, le moteur de recherche qui pense comme vous ! http://fr.ca.search.msn.com/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|