[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 646
  • Last Modified:

XSL FO exception : Document root element is missing

I am trying to use XSL-FO to convert XML files to PDF using a java program
with embedded FOP.
It generates the pdf files alright but whenver XML file is saved with UTF-8 encoding I receive an exception ..
javax.xml.transform.TransformerException: Document root element is missing

If I execute fop from cmd line using same xml and xsl files there are no issues.

I need the XML to be in UTF-8 since it is suppose to have multilangual characters.
Can anyone please help on this?
0
pratikbm
Asked:
pratikbm
  • 4
  • 3
  • 3
3 Solutions
 
CEHJCommented:
What program are you saving it with in UTF-8?
0
 
pratikbmAuthor Commented:
Notepad
0
 
pratikbmAuthor Commented:
I have created the XML and XSL files manually (using Notepad) and using that in the Java prog.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
pratikbmAuthor Commented:
Also I am able to generate .fo file out of the same xml file using xalan
0
 
objectsCommented:
Use a different editor, notepad can create problems.
0
 
CEHJCommented:
Make sure there's no BOM at the beginning of the file. Some Java APIs can't handle these special characters
0
 
objectsCommented:
Notepad does, thats why I suggested not using it :)
0
 
objectsCommented:
avoid all M$ editors in fact.
(Use your IDE to edit your XML, eg. Eclipse)
0
 
pratikbmAuthor Commented:
Bull eye !!
I created the file through RAD and it works smooth.....same file I edited through notepad and it failed.

Thanks.
0
 
CEHJCommented:
:-)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now