anyURI validation failing in Xerces-J

Discussion in 'XML' started by dfielder@gmail.com, Nov 10, 2005.

  1. Guest

    I'm using the latest version of Xerces-J and parsing an XML file using
    the 'org.apache.xerces.parsers.SAXParser' parser. The problem I have
    is that a value such as 'file:///c:/#test#.jpg' is failing validation
    as xs:anyURI. What's interesting is that if I remove one of the pound
    signs, it validates just fine. The string with two pound signs
    validates with no problem in XMLSpy. Any ideas what's going on here?
    Here's the exact error coming out of the SAXParser:

    [Error] test.xml:9:48: cvc-datatype-valid.1.2.1:
    'file:///c:/#test#.jpg' is not a valid value for 'anyURI'

    If this is the wrong area to post this question, please let me know a
    more suitable place. Thanks for any help in advance.
    , Nov 10, 2005
    #1
    1. Advertising

  2. In article <>,
    <> wrote:

    >[Error] test.xml:9:48: cvc-datatype-valid.1.2.1:
    >'file:///c:/#test#.jpg' is not a valid value for 'anyURI'


    The # symbol is used to separate the main part of a URI from the fragment
    identifier, for example http://www.w3.org/TR/REC-xml/#sec-intro.

    You need to encode your # characters as %23:

    file:///c:/%23test%23.jpg

    The reason it works if you remove, say, the second # is that it is
    interpreting it as the test.jpg fragment of file:///c:/.

    -- Richard
    Richard Tobin, Nov 10, 2005
    #2
    1. Advertising

  3. JAPISoft Guest

    May be I miss something, but shouldn't it be : file://c:/#test#.jpg ?
    And also I think the # caracter is maybe reserved (this is anchor for
    sample with HTML and it is at the end part of the URL).

    Best regards,

    A.Brillant
    EditiX - XML Editor and XSLT Debugger
    http://www.editix.com

    wrote:
    > I'm using the latest version of Xerces-J and parsing an XML file using
    > the 'org.apache.xerces.parsers.SAXParser' parser. The problem I have
    > is that a value such as 'file:///c:/#test#.jpg' is failing validation
    > as xs:anyURI. What's interesting is that if I remove one of the pound
    > signs, it validates just fine. The string with two pound signs
    > validates with no problem in XMLSpy. Any ideas what's going on here?
    > Here's the exact error coming out of the SAXParser:
    >
    > [Error] test.xml:9:48: cvc-datatype-valid.1.2.1:
    > 'file:///c:/#test#.jpg' is not a valid value for 'anyURI'
    >
    > If this is the wrong area to post this question, please let me know a
    > more suitable place. Thanks for any help in advance.
    >
    JAPISoft, Nov 12, 2005
    #3
  4. In article <dl56fa$hgs$.9tel.net>,
    JAPISoft <> wrote:

    >May be I miss something, but shouldn't it be : file://c:/#test#.jpg ?


    No, it's an example of file://hostname/... where the hostname
    part is empty.

    -- Richard
    Richard Tobin, Nov 12, 2005
    #4
    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.
Similar Threads
  1. Hrvoje Somun
    Replies:
    2
    Views:
    899
    Hrvoje Somun
    Jan 8, 2004
  2. cvissy
    Replies:
    0
    Views:
    604
    cvissy
    Nov 16, 2004
  3. Jon

    Failing HTML Validation

    Jon, Dec 15, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    324
    Scott M.
    Dec 17, 2007
  4. peshrad
    Replies:
    0
    Views:
    145
    peshrad
    Jun 15, 2004
  5. Replies:
    0
    Views:
    167
Loading...

Share This Page