• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

XML XLS related error. using java to parse from xlm to xlm ( rss )

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey im using a java application to convert a xml form into another xml using xls as the converter. This is the error i get "

ERROR: 'Invalid byte 2 of 3-byte UTF-8 sequence.'
FATAL ERROR: 'Could not compile stylesheet'
The following error occured: Could not compile stylesheet

"


http://pastebin.no/5498 xml http://pastebin.no/5499 xls
here is a link to the xml and xsl. the java application has been tested with other xml/xsl files which is much more simple and it worked. can someone help me?


Thanks

[ May 05, 2008: Message edited by: Sindre Knutsen ]
[ May 05, 2008: Message edited by: Sindre Knutsen ]
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Sindre xtra",
Please check your private messages regarding an important administrative matter.
-Ben
 
Marshal
Posts: 28298
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your stylesheet doesn't declare any encoding, so it must be encoded in either UTF-8 or UTF-16. For European languages, UTF-8 is more typical. So first of all, is it really encoded in UTF-8?

If so, are you passing the stylesheet to the transformer in such a way that the correct encoding is applied? Bad things to do include using a Reader which uses your system's default encoding (which isn't UTF-8).
 
Sindre Knutsen
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i added <?xml version="1.0" encoding="UTF-8"?> to the stylesheet and now im getting this error. Shouldn�t this list Aust-agder?

ERROR: 'Syntax error in 'normalize-space(weatherdata/forecast/text/location name)'.'
FATAL ERROR: 'Could not compile stylesheet'
The following error occured: Could not compile stylesheet
 
Paul Clapham
Marshal
Posts: 28298
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's like the error message says, there's a syntax error in that XPath expression. In particular there's a space in the middle of "locationname" which should not be there. XML element names cannot have spaces in them.
 
Paul Clapham
Marshal
Posts: 28298
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Paul Clapham:
It's like the error message says, there's a syntax error in that XPath expression. In particular there's a space in the middle of "locationname" which should not be there. XML element names cannot have spaces in them.



Edit: looking at your XML, it appears you want the value of the "name" attribute of the "location" element. The XPath way to say that is "location/@name".

In future would you post your code in this forum? It's inconvenient for people to follow links, which is why I didn't understand your question at first. And data in the forum is permanent, whereas data posted elsewhere may not be.
 
them good ole boys were drinking whiskey and rye singin' this'll be the day that I die. Drink tiny ad.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic