XML validation problem

Discussion in 'Java' started by steve_marjoribanks@hotmail.com, Mar 1, 2006.

  1. Guest

    I've posted this here and in the comp.lang.java.programmer group
    because I'm not really sure if it's a Java problem or an XML problem!

    Basically I have written a Java application which loads an XML file and
    validates it (it is going to do other stuff with it as well once I get
    this validation problem sorted!). I am using JDOM and Xerces-J 2.7.1.
    It starts to validate fine but then reports a whole load of errors
    which I obtained the details of using Java. The first few look like
    this:

    WARNING: schema_reference.4: Failed to read schema document
    'http://schemas.opengis.net/gml/3.1.1/base/feature.xsd', because 1)
    could not find the document; 2) the document could not be read; 3) the
    root element of the document is not <xsd:schema>. at line 16, column
    121 in entity
    http://www.dur.ac.uk/s.j.marjoribanks/geotechml/rawData.xsd

    WARNING: schema_reference.4: Failed to read schema document
    'http://schemas.opengis.net/gml/3.1.1/base/feature.xsd', because 1)
    could not find the document; 2) the document could not be read; 3) the
    root element of the document is not <xsd:schema>. at line 10, column
    121 in entity http://www.dur.ac.uk/s.j.marjoribanks/agsml/agsml.xsd

    WARNING: schema_reference.4: Failed to read schema document
    'http://schemas.opengis.net/gml/3.1.1/base/feature.xsd', because 1)
    could not find the document; 2) the document could not be read; 3) the
    root element of the document is not <xsd:schema>. at line 9, column 121
    in entity
    http://www.dur.ac.uk/s.j.marjoribanks/agsml/holeInformation.xsd

    WARNING: schema_reference.4: Failed to read schema document
    'AgsmlBase.xsd', because 1) could not find the document; 2) the
    document could not be read; 3) the root element of the document is not
    <xsd:schema>. at line 10, column 43 in entity
    http://www.dur.ac.uk/s.j.marjoribanks/agsml/holeInformation.xsd

    WARNING: schema_reference.4: Failed to read schema document
    'http://schemas.opengis.net/gml/3.1.1/base/feature.xsd', because 1)
    could not find the document; 2) the document could not be read; 3) the
    root element of the document is not <xsd:schema>. at line 9, column 121
    in entity
    http://www.dur.ac.uk/s.j.marjoribanks/agsml/laboratoryTesting.xsd


    The first few errors are all like that, reporting that it could not
    access a schema file and then there are loads which i think are
    probably as a result of the schema file being inaccessible.
    My schema imports quite a few other schemas, but there only seems to be
    a problem loading 3 of them. The AgsmlBase.xsd one which is in the same
    directory as the target schema of my instance document, the
    http://www.schemas.opengis.net/gml/3.1.1/base/feature.xsd schema and an
    XLinks one as well (not shown in the errors above). I don't understand
    why it is not able to access them though? If I validate my file in
    XMLSpy2006 it is ok (apart from one nasty bug which the Altova support
    team inform me is a problem with the software). I have checked the URLs
    and the schemas are definitley there and I can access them so why can't
    it access them?

    One though I did have was that if one of them is already imported into
    one of the schemas which I import, could this cause a problem? It
    doesn't in XMLSpy though and I don't think it should really?

    Thanks

    Steve
    , Mar 1, 2006
    #1
    1. Advertising

  2. Guest

    Ok, well I've fixed the problem with the agsmlBase schema, one of the
    schemas had a typo and was trying to find AgsmlBase instead.

    However, the problem still remains with the other one
    (http://schemas.opengis.net/gml/3.1.1/base/feature.xsd). It says it
    either can't find it, can't access it or it's not a schema. However, if
    you navigate to the URI in a web broswer it is obviously available and
    a valid schema as well. I tried validating it using the XSV validator
    (http://www.w3.org/2001/03/webdata/xsv) and it said it was fine.

    Why when I try and validate my file using Xerces (and Crimson) in my
    Java application can it not find the schema mentioned above even though
    it is obviously there? I validated the schema I am using with the XSV
    tool also and it said that too was fine.

    Anyone got any idea?!!!

    Steve

    Steve
    , Mar 1, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page