Has anybody tried creating and validating a XML doc with XML Schema?

Hi,
Has anybody tried creating and validating a XML doc with XML Schema?

With XMLBeans, an XML document may be created from and validated with an XML schema.

Similar Messages

  • Still problems serializing xml-docs with xml-parser for java v2.0.2.7

    Hi !
    I'm using the Oracle XML Parser 2.0.2.7.0 and get some problems when serializing the XMLDocument.
    In one class (DOMOut) I parse a xml-file with the oracle.xml.parser.v2.DOMParser, then obtain the XMLDocument and write it to System.out
    In another class (DOMIn) I fetch the XMLDocument from System.in, search for a given Element and print it's TextValue (if existing) to System.out
    That is where the error occurs.
    I get the XMLDocument from System.in but the returning NodeList from doc.getElementsByTagName() is empty. [nl.getLength()==0] even if it shouldn't be.
    Look at this code and output:
    [DOMOut]
    DOMParser parser = new DOMParser();
    parser.parse(url);
    XMLDocument doc = (XMLDocument)parser.getDocument();
    ObjectOutputStream out = new ObjectOutputStream(System.out);
    out.writeObject(doc); out.flush();
    [DOMIn]
    ObjectInputStream in = new ObjectInputStream(System.in);
    XMLDocument doc = (XMLDocument)in.readObject();
    doc.print(System.out);
    NodeList nl = doc.getElementsByTagName("Name");
    System.out.println("Length of NodeList: "+nl.getLength());
    if (nl.getLength()==0)
    System.out.println(argv[0] + ": not in this document!");
    else {
    XMLNode node = (XMLNode) nl.item(nl.getLength()-1);
    System.out.println(node.getNodeName() + ": " + (node.getFirstChild()).getNodeValue());
    This is the relevant code.
    I javac both classes and then do this:
    java DOMOut xmltestfile.xml > xx
    java DOMIn Name < xx
    And get this as output:
    <?xml version = '1.0'?>
    <!DOCTYPE course [
    <!ELEMENT course (Name,Dept,Instructor,Student)>
    <!ELEMENT Name ((#PCDATA)*)*>
    <!ELEMENT Dept ((#PCDATA)*)*>
    <!ELEMENT Instructor (Name)>
    <!ELEMENT Student (Name)*>
    ]>
    <course>
    <Name>Calculus</Name>
    <Dept>Math</Dept>
    <Instructor>
    <Name>Jim Green</Name>
    </Instructor>
    <Student>
    <Name>Jack</Name>
    <Name>Mary</Name>
    <Name>Paul</Name>
    </Student>
    </course>
    Length of NodeList: 0
    Name: not in this document!
    Has anyone an idea?
    If I do all this stuff without serializing it works.
    If I do not search for argv[0], but the string "Name" it fails.
    If I do search for "*" it works fine!
    I'm very confused could anybody please help me a bit??
    Stefan.
    [[email protected]]

    The link has been fixed. You will go to the v2 download page
    now. Sorry for the inconvience.
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    Renilton Oliveira (guest) wrote:
    : I didn't find the file for version 2.0.0.0 as well.
    : Renilton
    : Andrei Filimonov (guest) wrote:
    : : I tried to download XML Parser for Java v2 it seems that
    only
    : v
    : : 1.0.1.4 is available. Could you please give an exact URL for
    : v2
    : : download?
    : : Andrei Filimonov
    : : Oracle XML Team wrote:
    : : : The Oracle XML v2 parser is now available for download
    here
    : as
    : : : an early beta release and is written in Java. It features
    : an
    : : : improved architecture over the Oracle XML v1 parser and
    has
    : : : shown better performance on small to large XML documents.
    : It
    : : : will also be able to format the XML document according to
    a
    : : : stylesheet, having integrated an XSLT processor.
    : : : Version 2 of the XML Parser for Java, besides
    incorporating
    : an
    : : : XSLT processor, has been re-architected from version 1.
    This
    : : has
    : : : resulted in a number of changes to the class names
    : especially
    : : : those that support Namespaces. See v2changes.txt and
    : the .diff
    : : : difference files in the sample directory.
    : : : Oracle XML Team
    : : : http://technet.oracle.com
    : : : Oracle Technology Network
    null

  • Has anybody tried this multirow header JTable sample?

    Hi,
    http://www2.gol.com/users/tame/swing/examples/JTableExamples1.html
    I found a link to this sample from this forum, and I need to implement a similar functionality. I tried running the code of this sample but it returns a "NullPointerException" for the call "GetHeaderRenderer" in the class "GroupableTableHeaderUI".
    Has anybody tried this, and if so, how do I get this sample to work ??
    Thanks,
    R.

    I ran into this problem a while ago. If you are using SDK 1.3 and above, tame's example won't work. You need to some minor modification in the "GroupableTableHeaderUI" java file. I have already made it work under SDK 1.3.02. I don't have the source code at home. So, if you need to take look at my source code please let me know, I can either e-mail or post it when I return to my office.
    Kenny :}

  • Has anyone tried creating a plugin that you can type in a specific word, and if it comes up in the very top of the page (i think its refered to as the header) it closes the page or tab automatically?

    Has anyone tried creating a plugin that you can type in a specific word, and if it comes up in the very top of the page (i think its refered to as the header) it closes the page or tab automatically? there is a program called POW! by AnalogX that does this, but its only good for IE. And Im a Firefox man. Can anyone look into this or maybe create a plugin that does what POW! does for IE? I will donate to the creater of a plugin that does that. Im so sick of pop ups that most pop up blockers miss.

    The Firefox pop-up blocker is very effective. If you are getting a lot of pop-ups in Firefox, you may have picked up some Malware that is causing those pop-ups.
    Install, update, and run these programs in this order. '''''(Not all programs detect the same Malware.)''''' They are all free for personal use, but some have limited functionality in the "free mode" - but those are features you really don't need to find and remove the problem that you have.<br />
    ''Note: If your Malware infection is bad enough and you are mis-directed to URL's other than what is posted, you may have to use a different PC to download these programs and use a USB stick to transfer them to the afflicted PC.''
    Malwarebytes' Anti-Malware - [http://www.malwarebytes.org/mbam.php] <br />
    SuperAntispyware - [http://www.superantispyware.com/] <br />
    AdAware - [http://www.lavasoftusa.com/software/adaware/] <br />
    Spybot Search & Destroy - [http://www.safer-networking.org/en/index.html] <br />
    Windows Defender: Home Page - [http://www.microsoft.com/windows/products/winfamily/defender/default.mspx]
    If these don't find it or can't clear it, post in one of these forums for specialized malware removal help: <br />
    [http://www.spywarewarrior.com/index.php] <br />
    [http://forum.aumha.org/] <br />
    [http://www.spywareinfoforum.com/] <br />
    [http://bleepingcomputer.com]

  • Has anybody tried the Day-Timer iPhone App -  Syncs. Calendar + Todo list?

    I have had my iPhone 3Gs calender sync. break several times,
    and honestly none of them seem to be my "fault". I stumbled across this app. and for $6 I'd take the cowards way out rather than try to fix my current broken sync. problem with iTunes. Has anybody tried this?
    http://www.daytimer.com/iphoneapps/
    Frankly the demo. seems pretty clever:
    http://www.youtube.com/watch?v=s7FDiy5PsfU
    I have not connection with Day-Timer company... other than being a potential customer

    Vlingo doesn't consume all the app memory space itself... it can be used by a number of factors, including the browser cache.
    Your unintall of Vlingo also caused a reboot of the device in which all the free memory space was cleared, from routine use of the BB device.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Has anybody tried to transfer Hi-8 video to iDVD?

    Has anybody tried to transfer Hi-8 video to iDVD?

    Has anybody tried to transfer Hi-8 video to iDVD?
    I have done lots of that.
    To get your Hi-8 video into iMovie, use the Grassvalley ADVC300.  With the ADVC300 Audio and Video go in, FireWire comes out. It also comes with a nice Macintosh application that works flawlessly with iMovie 06 and iDVD 09/11 (I have used it a few times with iMovie 11).

  • Has anybody tried to install Photoshop Elements (any version) on Vista 64-b

    Has anybody tried to install Photoshop Elements (any version) on Vista 64-bit? Thanks

    See this FAQ:
    http://www.johnrellis.com/psedbtool/photoshopelements-6-7-faq.htm#_PSE_and_Vista

  • Catch all error information while validating xml content with xsd schema

    Hi experts,
    I created a java mapping to validating the input xml content with xsd schema (schema validation). What I want is to catch all error message to the xml not just the first error. I used SAXParser in sapxmltoolkit.jar to do the schema validation. The below is a part of my java mapping.
    XMLReader parser = XMLReaderFactory.createXMLReader("com.sap.engine.lib.xml.parser.SAXParser");
    parser.setFeature( "http://xml.org/sax/features/validation" ,  true);
    parser.setFeature( "http://apache.org/xml/features/validation/schema" , true);
    parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");          parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource",this.getClass().getClassLoader().getResourceAsStream(schema)); // schema is my schema name
    parser.setErrorHandler(new ParseErrorHandler()); // ParseErrorHandler is my own ErrorHandler which extends DefaultHandler
    parser.parse(new InputSource(new ByteArrayInputStream(sinput.getBytes())));
    // In error handler, I comment all code so as not to throw any exception
    public class ParseErrorHandler extends DefaultHandler
         public void error(SAXParseException e) throws SAXException
              // sSystem.out.println("Error" + e.getMessage());
              // throw e;
         public void fatalError(SAXParseException e)
              // throw e;
              // System.out.println("SAP Fatal Error" + e.getMessage());
    Unfortunately the program always stopped while catching the first error. Check the below log.
    com.sap.engine.lib.xml.parser.NestedSAXParserException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException:
    ERRORS :
    cvc-simple-type : information item '/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]/:CityName[1]' is not valid, because it's value does not satisfy the constraints of facet 'minLength' with value '1'.
    cvc-data : information item '/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]/:CityName[1]' is is not valid with respoct to the corresponding simple type definition.
    cvc-element : element information item '/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]/:CityName[1]' is associated with invalid data.
    cvc-element : element information item '/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]' is not valid with respect to it's complex type definition..
    cvc-element : element information item '/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]' is not valid with respect to it's complex type definition..
    cvc-element : element information item '/:ShipNotice[1]/:Header[1]/:To[1]' is not valid with respect to it's complex type definition..
    cvc-element : element information item '/:ShipNotice[1]/:Header[1]' is not valid with respect to it's complex type definition..
    cvc-element : element information item '/:ShipNotice[1]' is not valid with respect to it's complex type definition..
    -> com.sap.engine.lib.xml.parser.ParserException:
    I tried using Xerces and JAXP to do validation, the same error happened. I have no idea on this. Does xi has its own error handler logic? Is there any body can make me get out of this?
    Thanks.

    <h6>Hi experts,
    <h6>
    <h6>I created a java mapping to validating the input xml content with xsd schema (schema validation). What I want is to catch all <h6>error message to the xml not just the first error. I used SAXParser in sapxmltoolkit.jar to do the schema validation. The below <h6>is a part of my java mapping.
    <h6>XMLReader parser = XMLReaderFactory.createXMLReader("com.sap.engine.lib.xml.parser.SAXParser");
    <h6>parser.setFeature( "http://xml.org/sax/features/validation" ,  true);
    <h6>parser.setFeature( "http://apache.org/xml/features/validation/schema" , true);
    <h6>parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");          <h6>parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource",this.getClass().getClassLoader().getResourceAsStream(schema)); <h6>// schema is my schema name
    <h6>parser.setErrorHandler(new ParseErrorHandler()); // ParseErrorHandler is my own ErrorHandler which extends Default Handler
    <h6>parser.parse(new InputSource(new ByteArrayInputStream(sinput.getBytes())));
    <h6>
    <h6>// In error handler, I comment all code so as not to throw any exception
    <h6>public class ParseErrorHandler extends DefaultHandler
    <h6>{
    <h6>     public void error(SAXParseException e) throws SAXException
    <h6>     {
    <h6>          // sSystem.out.println("Error" + e.getMessage());
    <h6>          // throw e;
    <h6>     }
    <h6>
    <h6>     public void fatalError(SAXParseException e)
    <h6>     {
    <h6>          // throw e;
    <h6>          // System.out.println("SAP Fatal Error" + e.getMessage());
    <h6>
    <h6>     }
    <h6>
    <h6>}
    <h6>
    <h6>Unfortunately the program always stopped while catching the first error. Check the below log.
    <h6>
    <h6>com.sap.engine.lib.xml.parser.NestedSAXParserException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException:
    <h6>ERRORS :
    <h6>cvc-simple-type : information item <h6>'/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]/:CityName[1]' <h6>is not valid, because it's value does not satisfy the constraints of facet 'minLength' with value '1'.
    <h6>cvc-data : information item <h6>'/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]/:CityName[1]' <h6>is is not valid with respoct to the corresponding simple type definition.
    <h6>cvc-element : element information item <h6>'/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]/:CityName[1]' <h6>is associated with invalid data.
    <h6>cvc-element : element information item <h6>'/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]' <h6>is not valid with respect to it's complex type definition..
    <h6>cvc-element : element information item <h6>'/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]' <h6>is not valid with respect to it's complex type definition..
    <h6>cvc-element : element information item <h6>'/:ShipNotice[1]/:Header[1]/:To[1]' <h6>is not valid with respect to it's complex type definition..
    <h6>cvc-element : element information item <h6>'/:ShipNotice[1]/:Header[1]' <h6>is not valid with respect to it's complex type definition..
    <h6>cvc-element : element information item '/:ShipNotice[1]' is not valid with <h6>respect to it's complex type definition..
    <h6> -> com.sap.engine.lib.xml.parser.ParserException:
    <h6>
    <h6>
    <h6>I tried using Xerces and JAXP to do validation, the same error happened. I have no idea on this. Does xi has its own error <h6>handler logic? Is there any body can make me get out of this?
    <h6>Thanks.

  • Validation XML documnet with XML Schema in PL/SQL

    Hello,
    can someone please explain
    How to validate an XML document with XML schema using PL/SQL code (with out writing Java code).
    Thanks for your Help in Advance
    Surendra.

    see the posting: Schema validation routine?
    regards, Bart

  • Binding Xml file with Xsd Schema

    Hello
    everybody there.
    I am trying to make an application where word files are converted into xml.
    For that i have used org.exolab.castor and org.apache.poi.hwpf.
    Now the problem is that i was able to generate the xml file from word, but when i am binding it with XMLSchema.xsd following error is coming.
    java.lang.IllegalArgumentException: getSimpleType: the simple type 'formChoice' is not a built-in type as defined in XML Schema specification.
         at org.exolab.castor.xml.schema.Schema.getSimpleType(Schema.java:1289)
         at org.exolab.castor.xml.schema.Schema.addSimpleType(Schema.java:583)
         at org.exolab.castor.xml.schema.reader.SchemaUnmarshaller.endElement(SchemaUnmarshaller.java:643)
         at org.exolab.castor.xml.schema.reader.Sax2ComponentReader.endElement(Sax2ComponentReader.java:198)
         at org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1392)
         at org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1550)
         at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1149)
         at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
         at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
         at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:430)
         at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:485)
         at TempHwpf.<init>(TempHwpf.java:35)
         at TempHwpf.main(TempHwpf.java:44)the code for binding my xml file with xsd schema is as under:-
    SourceGenerator sourcegen = new SourceGenerator();
    sourcegen.getVersion();
    System.out.println(sourcegen.getVersion());
    sourcegen.generateSource("XMLSchema.xsd","packagename");I have checked XMLSchema.xsd file, in that formChoice is already defined, than also error is coming.
    can anyone help me out. first i thought that XMLSchema.xsd which i have is not proper, but i downloaded it again from w3c.org,
    than also same error is shown.
    please help me out.
    waiting for reply.
    milind

    Please do not double-post. http://forum.java.sun.com/thread.jspa?threadID=5134447&tstart=0
    Then use Stax (Woodstock) or Saxon.
    - Saish

  • How to validate an XML file with XSD Schema on JDK 1.4

    Hi
    I'm looking for samples how to validate xml files with xsd schema using jsdk 1.4
    Thank you.

    This is how.
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.dom.DOMResult;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.validation.Schema;
    import javax.xml.validation.SchemaFactory;
    import javax.xml.validation.Validator;
    DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
    dbfac.setNamespaceAware(true);
    SchemaFactory factory1 = SchemaFactory
                        .newInstance("http://www.w3.org/2001/XMLSchema");
    Schema schema = factory1.newSchema(new File("person.xsd"));
    dbfac.setSchema(schema);
    DocumentBuilder dbparser1 = dbfac.newDocumentBuilder();
    Document doc1 = dbparser1.parse(new File("person.xml"));
    Validator validator1 = schema.newValidator();
    DOMSource dm1 = new DOMSource(doc1);
    DOMResult domresult1 = new DOMResult();
    validator1.validate(dm1, domresult1);

  • How to validate xml file with XSD schema ??  in JDK1.4.2

    How to validate xml file with XSD schema ?? in JDK1.4.2
    i dont want to use new Xerec Jar ...
    Suggest option ...

    Please do not double-post. http://forum.java.sun.com/thread.jspa?threadID=5134447&tstart=0
    Then use Stax (Woodstock) or Saxon.
    - Saish

  • Has anybody tried to install RAC on Zones as nodes ?

    Hi guys,
    Could anyone share his experiences about installing Oracle RAC
    on Solaris zones located on single physical machine ?
    I created 2 sparse root zones , presented the same raw devices for ocr and votedisk to them and try to install clusterware,
    but during clusterware initialization there is an error
    OCROSD[1]utsz:3: ioctl DKIOCGAPART failed. errno 48
    Does anybody tried similar configuration ?

    I have not tried this since it is explicitly unsupported by oracle.
    Bjoern

  • Has anybody tried these speakers?

    Hi,
    I am kinda new here so I am not sure if this is the right place to post this question? I want to buy a set of external speakers for my kid's ipod, and he wants these giant earbud things. I found them on Amazon for $50, but then the same thing on ebay for $18.95 - apparently some sort of liquidation or something. Has anyone tried these? How is the sound?
    http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=160371596635&ssPageName=STRK: MESELX:IT

    Has anybody tried to transfer Hi-8 video to iDVD?
    I have done lots of that.
    To get your Hi-8 video into iMovie, use the Grassvalley ADVC300.  With the ADVC300 Audio and Video go in, FireWire comes out. It also comes with a nice Macintosh application that works flawlessly with iMovie 06 and iDVD 09/11 (I have used it a few times with iMovie 11).

  • Create XML docs with hierarchy of tags and attr defined in databaste tables

    Hi,
    My problem is a little unique one. I want the ability to define the structure of the XML document (i.e. the hierarchy of element tags and attribute names) in the database tables. The values of tags and attributes will also be populated at runtime in tables.
    Then write some generic API that reads the structure of the XML document through the database tables and spits out an XML document based on this structure and values stored in the tables.
    So, basically, I want the tag names and values both to be values in the database rather than the tag names being the columns in database tables.
    With this I should be able to have one procedure/function that can serve the purpose of creating XML documents with different structures by just specifying that structure in the form of database tables.
    Almost all the Oracle XML utilities I read about, create XML docs based on a SQL query with tag names being columns in the database tables. Any help will be highly appreciated.
    Thanks,
    Monika

    Which database release are you using...
    The computed constructors feature of XQuery may help.
    -Mark

Maybe you are looking for