Problem validating XML file with external schema file

Hi All
I am having trouble at the moment trying to validate an xml file using an external xsd file that sits on my server. I have followed the basic option but at the moment to no avail. I am using a DOMParser and am setting all the features and properties correctly ... well I think I am anyway.....below is a fragment of the code
DOMParser parser = new DOMParser ();
// Setting the validation on for the parser.
parser.setFeature ( "http://xml.org/sax/features/validation", true );
parser.setFeature ( "http://apache.org/xml/features/validation/schema", true);
parser.setProperty ( "http://apache.org/xml/properties/schema/externalnoNamespaceSchemaLocation", "c://testing.xsd" );
parser.setErrorHandler ( this );
I am getting an error telling me that the root element cannot be found.....see below
org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'mainhome'.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
at org.apache.xerces.impl.XMLNamespaceBinder.handleStartElement(Unknown Source)
at org.apache.xerces.impl.XMLNamespaceBinder.startElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at com.cibenix.aps.util.MenuXMLParser.process(MenuXMLParser.java:163)
at com.cibenix.aps.actions.MenuAddAction.execute(MenuAddAction.java:80)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:193)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:589)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:666)
Any help would be greatly appreciated
thanks

In the schema root element xs:schema add namespace declaration.
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
In the XML document root element add xmlns:xsi and xsi:noNamespaceSchemaLocation attributes.
<root_element xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file://c:/testing.xsd">

Similar Messages

  • 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.

  • Problems in Frame 1 with External HTML files

    I am having an issue with loading two external html files within
    my website.
    I have a case study page with a
    dynamic textbox and a scrollbar attached to it.
    I have another page "news" that
    contains another dynamic textbox with a scrollbar attached to
    it.
    I created two .txt files with my
    information for both pages.
    Working in Flash CS3 with
    Actionscript 2.0 at 30fps.
    My problem is this:
    I can go to my news page and the .txt file will be visible,
    but once I go to the other case study page and reveal that .txt
    file, I go back to the news page and the .txt file is no longer
    visible. Only a nonworking scrollbar is displayed with no text and
    nothing else.
    I believe I need to do something different in Frame 1's
    Actioncode. I just don't know how to get the other .txt file to
    work along with the other. I will be adding more .txt files in
    dynamic textboxes later and I really need to resolve this issue so
    I am able to add them with no problems. Appreciate anyone's help
    immediately if you can.
    Here is the temporary website link so you can test and see my
    problem. Don't forget to go the the news button first in the
    navbar. Then go to the case studies link and find the MAX Cat
    Packaging and view that .txt file, then go back and you will see my
    problem.
    Click Here to
    Visit Site

    well I made a separate layer and placed the symbol with the
    text box and scrollbar attached. That was the only thing on the
    layer as you mentioned to separate it. I don't see how I could
    separate the scrollbar from it as it is needed. So I made some
    keframes, selected the textbox inside the symbol and added the code
    you told me to add:
    caseStudyMC._visible=false; In the other frames where I
    needed it visible I added the code:
    caseStudyMC._visible=true;
    When I tested the movie. I didn't see the text but I saw the
    scroll bar still and the text still failled to appear after viewing
    the MC Case study text.
    Is the code supposed to go in Frame1? What do I do with the
    scroll bar image? I tried to Make it all disappear using the alpha
    at 0, but it still didn't work.
    thanks for all your help. hope you understand what I
    wrote.

  • AquaLogic Service Bus Perspective - WSDL Files with External Schemas

    I am using the AquaLogic Service Bus Perspective in WebLogic Workshop to create my proxy services, business services, wsdls, schemas, etc. I have a wsdl that imports a schema based on its registered namepsace...not its schemaLocation. This works fine in the ALSB console, but in the WebLogic Workshop perspective, I cannot Publish my WSDL because the WSDL is not aware of any global resources...such as this Schema definition that is external to the WSDL. How do you make Globally aware resources in WebLogic Workshop? The same thing works in through the ALSB Web-based console...but that same file produces a wsdl validation error in my IDE because it has no idea about that schema.
    Thanks -jay

    Thanks to both of you who replied to my question - it is very much appreciated
    We had a theory that you could just store everything under 'sbconfig' in CVS and restore it - but I thought that might be a bit hacky and less upgrade resistant.
    Do you use build scripts for setting up dev/qa/prod endpoints because 'customisation files' are new or did you find a problem with 'customisation files' that made you resort to using a build script?
    We were hoping to have some process like
    Export JAR
    Export Customisation File for Dev/QA/Prod
    In Dev, we import the JAR + dev customisation file
    In QA, we import the JAR + QA customisation file
    In Prod, we import the JAR + prod customisation file
    I know I have no chance, but you wouldn't care to share said document for my reading (not copying) pleasure? No worries if you don't :)
    Thanks for your comments guys :)
    Dan.
    just in case
    email is daniel prosser at gmail com
    dots between my name and com
    Edited by dan_prosser at 08/14/2007 6:33 PM

  • Xml file with external css file trying to pull in is not working

    Can anyone tell me where I'm going wrong?
    I have thumbnails loading and then as you click on each one a
    larger pic &
    description shows.
    I'm pulling the large pic & description in from
    studio.xml, and the css is
    in xmlstyles.css.
    Now when I assign &myText= to <desc> in the xml, it
    loads up *all* the
    <desc> into that first picture/description instead of
    throughout.
    Any help is very appreciated!
    function loadXML(loaded) {
    if (loaded) {
    /////////////////////////add xml
    data////////////////////////////////////////////
    xmlNode = this.firstChild;
    image = [];
    title = [];
    thumbnails = [];
    description = [];
    total = xmlNode.childNodes.length;
    for (i=0; i<total; i++) {
    //start child stuff
    image
    = xmlNode.childNodes.childNodes[0].firstChild.nodeValue;
    thumbnails
    = xmlNode.childNodes.childNodes[1].firstChild.nodeValue;
    thumbnails_fn(i);
    title
    = xmlNode.childNodes.childNodes[2].firstChild.nodeValue;
    description
    = xmlNode.childNodes.childNodes[3].firstChild.nodeValue;
    thumbnails_fn(i);
    firstImage();
    } else {
    content = "file not loaded!";
    xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData.onLoad = loadXML;
    xmlData.load("studio.xml");
    ////////////////////////// load style
    sheet///////////////////////////////////////////
    myStyle = new TextField.StyleSheet();
    myStyle.load("xmlstyles.css");
    desc_txt.styleSheet = myStyle;
    thisText = new LoadVars();
    thisText.load("studio.xml");
    thisText.onLoad = function(success) {
    if (success) {
    desc_txt.text = thisText.myText;
    listen = new Object();
    listen.onKeyDown = function() {
    if (Key.getCode() == Key.LEFT) {
    prevImage();
    } else if (Key.getCode() == Key.RIGHT) {
    nextImage();
    Key.addListener(listen);
    previous_btn.onRelease = function() {
    prevImage();
    next_btn.onRelease = function() {
    nextImage();
    p = 0;
    this.onEnterFrame = function() {
    filesize = picture.getBytesTotal();
    loaded = picture.getBytesLoaded();
    preloader._visible = true;
    if (loaded != filesize) {
    preloader.preload_bar._xscale = 100*loaded/filesize;
    } else {
    preloader._visible = false;
    if (picture._alpha<100) {
    picture._alpha += 10;
    function nextImage() {
    if (p<(total-1)) {
    p++;
    if (loaded == filesize) {
    //here's what you load up
    picture._alpha = 0;
    picture.loadMovie(image[p], 1);
    title_txt.text = title[p];
    picture_num();
    desc_txt.text = description[p];
    function prevImage() {
    if (p>0) {
    p--;
    picture._alpha = 0;
    picture.loadMovie(image[p], 1);
    title_txt.text = title[p];
    picture_num();
    desc_txt.text = description[p];
    function firstImage() {
    if (loaded == filesize) {
    //content
    picture._alpha = 0;
    picture.loadMovie(image[0], 1);
    title_txt.text = title[0];
    picture_num();
    desc_txt.text = description[0];
    function picture_num() {
    current_pos = p+1;
    pos_txt.text = current_pos+" / "+total;
    function thumbNailScroller() {
    ///////////////////////////////////////////// thumbnail
    code!///////////////////////////////////////////
    this.createEmptyMovieClip("tscroller", 1000);
    scroll_speed = 10;
    tscroller.onEnterFrame = function() {
    if ((_root._ymouse>=thumbnail_mc._y) &&
    (_root._ymouse<=thumbnail_mc._y+thumbnail_mc._height)) {
    if ((_root._xmouse>=(hit_right._x-40)) &&
    (thumbnail_mc.hitTest(hit_right)))
    thumbnail_mc._x -= scroll_speed;
    } else if ((_root._xmouse<=40) &&
    (thumbnail_mc.hitTest(hit_left))) {
    thumbnail_mc._x += scroll_speed;
    } else {
    delete tscroller.onEnterFrame;
    function thumbnails_fn(k) {
    thumbnail_mc.createEmptyMovieClip("t"+k,
    thumbnail_mc.getNextHighestDepth());
    tlistener = new Object();
    tlistener.onLoadInit = function(target_mc) {
    //next line is where you add total thumbnail width plus a
    little extra so
    they are spaced nicely
    target_mc._x =
    hit_left._x+(eval("thumbnail_mc.t"+k)._width+85)*k;
    target_mc.pictureValue = k;
    target_mc.onRelease = function() {
    p = this.pictureValue-1;
    nextImage();
    target_mc.onRollOver = function() {
    this._alpha = 50;
    thumbNailScroller();
    target_mc.onRollOut = function() {
    this._alpha = 100;
    image_mcl = new MovieClipLoader();
    image_mcl.addListener(tlistener);
    image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);

    I aOn to my problem:
    When I open the iTunesSteup this is the error I recieve:
    "The feature you are trying to use is on a network resource that is unavaible.
    I'm also having the exact same problem. Does any one know how tyo help us!!!
    A few things work like podcast. But when i download them they wont go onto my 5th GEn Ipod video. and i cant get the firmware updated when I go to "settings" "about" it says version 1.0. Could someone help me out? where do I download the newer version. Why wont my Podcasts work?

  • 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);

  • 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 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

  • Validating xml with external schema

    Hi,
    I want to validate a xml against an external schema using java and the xml WILL NOT contain any reference to the schema. Any help in the matter is most welcome.
    A typical example of such an xml is given below:
    <Envelope >
    <Body>
    " Some content here"
    </Body>
    </Envelope>
    I used the following code but it did not validate the xml.It simply parsed.
    public class TestParser {
         public static void main(String[] args) {
              final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
              final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
              try {
                   SAXParserFactory saxpfactory = SAXParserFactory.newInstance();
                   saxpfactory.setNamespaceAware(true);//
                   saxpfactory.setValidating(true);//
                   SAXParser parser = saxpfactory.newSAXParser();
                   parser.setProperty(JAXP_SCHEMA_LANGUAGE, "http://www.w3.org/2001/XMLSchema");//
                   parser.setProperty(JAXP_SCHEMA_SOURCE, "http://www.w3.org/2001/06/soap-envelope");//
                   parser.parse(new File("C:\\TEMP\\request.xml"), new DefaultHandler());
              } catch (FileNotFoundException fileNotFoundException) {
                   fileNotFoundException.printStackTrace();
              } catch (IOException ioException) {
                   ioException.printStackTrace();
              } catch (SAXException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (ParserConfigurationException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              System.out.println("exiting main ");
    Regards

    In the schema root element xs:schema add namespace declaration.
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    In the XML document root element add xmlns:xsi and xsi:noNamespaceSchemaLocation attributes.
    <root_element xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file://c:/testing.xsd">

  • Problem validating XML with XSD

    Hi everyone. I have an xsd schema and I want to validate some XML doc with the schema using SAX parser.
    The user make the xml and then upload it to the server.
    I want to enable client side validation but, for security reasons, I want also to validate this document when it's uploaded to the server.
    The schema called ContentSchema.xsd
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
         targetNamespace="www.mysite.com/Content" xmlns="www.mysite.com/Content">
         <xs:element name="content">
              <xs:complexType>
    A document produced by the client starts in this way:
    <?xml version="1.0" encoding="UTF-8"?>
    <p:content xmlns:p="www.mysite.com/Content" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="www.mysite.com/Content ContentSchema.xsd">
    in this way users can validate the XML doc before uploading. If the XSD is in the same folder of the uploaded XML the validation is ok.
    The problem is that, on the server, I've stored the xsd file in a folder and I want the SAX parser to use this xsd to validate the XML. Even I pass the complete URI of the file to the parser, it won't work:
    SAXParserFactory spf = SAXParserFactory.newInstance();
              spf.setValidating(true);
              spf.setNamespaceAware(true);
              spf.setFeature("http://apache.org/xml/features/validation/schema",true);
              spf.setFeature("http://apache.org/xml/features/validation/schema-full-checking", true);
              SAXParser sp=spf.newSAXParser();
              sp.setProperty("http://apache.org/xml/properties/schema/external-schemaLocation", schemaURL );
    I set the schemURL with setProperty method but it's like the parser is looking for the XSD in the URL declared in the XML doc and not in the URI I specify. Anyone can help me?
    Thank you very much

    You will have to associate the schema with the namespace, like in your xsi:schemaLocation attribute.
    Try something like this:
    sp.setProperty("http://apache.org/xml/properties/schema/external-schemaLocation", "www.mysite.com/Content "+schemaURL);

  • Validate a XML file against multiple schema files

    Hello everybody!
    How can I validate a XML file against multiple schema files?
    I have the following XML file:
    <?xml version="1.0" encoding="UTF-8"?>
    <bulkCmConfigDataFile xmlns:es="SpecificAttributes.3.0.xsd"
                             xmlns:xn="genericNrm.xsd"
    xmlns="configData.xsd">
    <fileHeader fileFormatVersion="32.615 V4.2" vendorName=""/>
    <configData dnPrefix="Undefined">
    <xn:SubNetwork id="3G">
    <xn:SubNetwork id="RNC01">
    <xn:MeContext id="RNC01">
    <xn:VsDataContainer id="RNC01">
    <xn:attributes>
    <xn:vsDataType>vsDataMeContext</xn:vsDataType>
    <xn:vsDataFormatVersion>SpecificAttributes.3.0</xn:vsDataFormatVersion>
    <es:vsDataMeContext>
    <es:userLabel>RNC01</es:userLabel>
    <es:ipAddress>172.21.3.17</es:ipAddress>
    <es:neMIMversion>vF.5.0</es:neMIMversion>
    </es:vsDataMeContext>
                                  </xn:attributes>
    </xn:VsDataContainer>
    </xn:MeContext>
    </xn:SubNetwork>
    </xn:SubNetwork>
    </configData>
    <fileFooter dateTime="2006-11-24T11:56:07Z"/>
    </bulkCmConfigDataFile>
    I want to load this file into a table, validate it (against SpecificAttributes.3.0.xsd, genericNrm.xsd and configData.xsd) and query that table. How would the INSERT .. and the SELECT ... for userLabel attribute look like?
    Many thanks!

    Hi Peter,
    Please use the validateXML BPEL Property : This property validates incoming and outgoing XML documents. If set to true, the Oracle BPEL Process Manager applies schema validation for incoming and outgoing XML documents. This property is applicable to both durable and transient processes. The default value is false.
    Cheers
    A

  • Swf with external .as files not working in Captivate

    Hello,
    I am using Flash Professional CS5.5 & Captivate 5.5 (purchased with eLearning suite).
    When I insert swf animations into Captivate that have external .as files they do not work.
    Tried both insert animation & insert animation slide - same results.
    I placed the .as files in the same file as my Captivate project and have tried multiple setting options.
    The FPS are set to 30.
    I had the same problem with external audio files and had to embed the audio into my fla to get it to play in Captivate.
    Does Captivate just not allow external files?
    Any help/insight is appreciated!!
    Les-

    The most likely reason for this failure is that since your SWF is now embedded into another SWF (the Captivate project) the paths to the AS files need to be altered in Flash to allow for this.
    You need to investigate how this would be done in AS code if your Flash SWF was a symbol inside another Flash SWF.

  • "Use RAW files with external editor" greyed out for Photoshop CS2?

    I've just upgraded from iPhoto 5, and the "Use RAW files with external editor" option in the advanced preferences is greyed out when I select Photoshop CS2 as my external editor (back in the General pane).
    It works fine when Preview.app is selected. I can understand that pre-CS2 Photoshop wouldn't be available, but CS2 is capable of editing RAW images.
    Has anyone been able to get iPhoto 6 to send a RAW image to Photoshop CS2 using this preference? I've written an Applescript to do it in iPhoto 5, but I'd rather use something cleaner...
    15" PowerBook G4   Mac OS X (10.4.4)  

    Works great with Photoshop Elements, opens with Camera Raw. The issue is you can't save it so that iPhoto gets the changes.
    You have to save it and then re-import. I tried all permutations of saving it in originals and modified folders in the library. No luck. The only thing I didn't try is to save it as a jpeg over the top of the full sized one iPhoto created on import.

  • Dreamweaver very slow when opening files with external links

    Is there any way to fix Dreamweaver CS5 (Windows 7, 64bit) when opening files with external references?
    For example, I have a very simple CSS file, and toward the top the file has a line that says:
    @import url("https://fonts.googleapis.com/css?family=Ubuntu:500,700");
    This causes the file to take around 20 seconds to open in DW. If I comment out the line or remove it, the file opens almost instantly. This behaviour is also present in files that contain an SSI.
    DW often crashes before being able to open the file and I need to restart the app.
    Can I disable DW from attempting to load the references?? It's obviously what is causing the issue IMO and would love to make DW workable again!

    "Enable Related Files" isn't the fix for this issue. It's slightly different - I wanted to still load related files, but only the ones local to the file I was editing.
    The fix was to use DW's Resolve To IP Address feature. It required adding a registry value - it fixed the issue straight away
    This Adobe support doc helped: http://kb2.adobe.com/cps/887/cpsid_88742.html

  • Problem validating XMl document

    Hi everyone,
    I'm facing a problem validating a XML document with Apache toolkit under windows XP and eclipse 3.0
    I generate a pair of public/private keys using the RSA algorithm. The keys are of arbitrary length, but satisfying RSA conditions, ie we can encrypt and decrypt.
    I can sign my XML document, but no way to validate it. Validation is only ok when I generate random keys using the KeyPairGenerator.
    Do you think that arbitrary length keys don't allow to validate XML document. And do you have any idea how to solve the problem ( I'm not allowed to generate fixed length keys) ?
    Thansk a lot for your precious help.

    solved!
    urghh...forgot to load th eschema..duh. (must be friday)
    here's the fixed code:
        // parse the xml document (validate the xml string using a schema  file)
        // the xml document does not specified the System ID or location of
        // schema..and use no namespace
        public void parse(HandlerType type, String xmldoc) throws SAXException, IOException {
            File           schema      = schemaMap.get(type);
            DefaultHandler handler     = handlerMap.get(yype);
            XMLReader   reader = XMLReaderFactory.createXMLReader(VENDOR);
            InputSource source = new InputSource(new StringReader(xmldoc));
            reader.setContentHandler(handler);
            reader.setFeature("http://xml.org/sax/features/validation", true);
            reader.setFeature("http://apache.org/xml/features/validation/schema", true);
            reader.setFeature("http://apache.org/xml/features/validation/schema-full-checking", true);
            reader.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",
            "file:///" + schema.getAbsolutePath());
            reader.parse(source);          
        }

Maybe you are looking for

  • Logic Pro loops disappear when I re-index?

    I'm trying to delete some of the loops in logic to save some space on my SSD as I know I will never touch some of then. However I located them in finder and moved them to the trash, but when I try and re-index my loops library, I enter my password an

  • Why can I no longer import Mp4r files from my desktop (Macbook Pro) to iTunes??

    Why can I no longer import Mp4r files from my desktop (Macbook Pro) into Itunes?  Seemed to work perfectly well before the latest upgrade.  Feeling quite annoyed, especially when all the forums seem to give the same advice, which no longer seems to w

  • Adding subnet IP range to VLAN in SGE2000P switch

    hi, I am unable to add subnet IP range to VLAN in SGE2000P switch. Can anyone help me to configure same. Thanks in advance I want to configure 3 VLAN in my SGE2000P switch. as a router I am using my Fortigate firewall 50b. I have done all required co

  • Reader Slow Loading?

    Hi, Since getting Safari 5.0.1 with Reader, it seems Safari is much slower loading pages now. I'm not certain that it is reader slowing page loading but going to the same sites in Firefox and other browsers the pages load much faster. I'll open a pag

  • WSA block Mobile applications from accessing internet

    Dear All I have s680 to control internet access. I set my ASA to forward any ip traffic to the WSA ( WCCP ,Service Identifier: 90 ), All the computers can access the internet perfectly, but on Mobiles some applications can't access (facebook and yout