www.webdeveloper.com
Results 1 to 5 of 5

Thread: Byte order mark

  1. #1
    Join Date
    Apr 2008
    Location
    Slovenia
    Posts
    88

    Byte order mark

    In some application I use a XSD schema. When I open it in java with java.io.File somehow a byte order mark is added to the front of the file which makes it invalid. If I download this schema from the server, I get it without the byte order mark.

    Anyone have any ideas?

  2. #2
    Join Date
    Dec 2002
    Location
    Calgary, Canada
    Posts
    6,123
    post your code here that you are using to read a file.
    Cheers

    Khalid

    Message Posting Guidelines In These Forums, Please read these before posting any question.
    Web site: webapplikations.com
    Web Resources Page:Web Resources

  3. #3
    Join Date
    Apr 2008
    Location
    Slovenia
    Posts
    88
    Code:
    ServletContext sc = request.getSession().getServletContext();
    String application_path = sc.getRealPath("");
    String schema_path = application_path.concat("generateXML\\DOD_DDPO_6.xsd");
    File schemaLocation = new File(schema_path); // java.io.File
    
    Schema schema = factory.newSchema(schemaLocation); // this triggers the exception, message reads "Content is not allowed in prolog."
    // if I read the file the first line is ???<?xml version="1.0" encoding="utf-8"?> where "???" is the byte order mark

  4. #4
    Join Date
    Dec 2002
    Location
    Calgary, Canada
    Posts
    6,123
    a bit more code here, I wanted to see the actual file reading code where you get the BoM in the file. As in java you can set a particular format before you read the file and my guess(rignt now) is that it will resolve it. But lets see the actual file reading code
    Cheers

    Khalid

    Message Posting Guidelines In These Forums, Please read these before posting any question.
    Web site: webapplikations.com
    Web Resources Page:Web Resources

  5. #5
    Join Date
    Apr 2008
    Location
    Slovenia
    Posts
    88
    Actually this is it. I just need to pass a java.io.File parameter to the factory.newSchema(File schema).

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles