Welcome!

Industrial IoT Authors: William Schmarzo, Elizabeth White, Stackify Blog, Yeshim Deniz, SmartBear Blog

RSS Feed Item

Re: JDOM XSLT TransformerConfigurationException

Hi Michael and Robert,
 
Thanks for reponding to this question.
 
You are right about it my Java application is having diffulty reading stateStyleSheet.xsl. I have overcame it by moving it to a new project and suspects that the order of jar files in CLASSPATH were in the wrong order. Nevertheless, I now encountered another issue this time:
 
java.io.UTFDataFormatException: Invalid byte 1 of 1-byte UTF-8 sequence.
        at org.apache.xerces.impl.io.UTF8Reader.invalidByte(Unknown Source)
        at org.apache.xerces.impl.io.UTF8Reader.read(Unknown Source)
        at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
        at org.apache.xerces.impl.XMLEntityScanner.skipChar(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
        at org.apache..xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces..parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.jdom.input.SAXBuilder.build(SAXBuilder.java:489)
        at org.jdom.input.SAXBuilder.build(SAXBuilder.java:928)
        at JDOMTrAXPojoInvestmentBean.main(JDOMTrAXPojoInvestmentBean.java:45)
The header of state.xml is as follows:
 
  <?xml version="1.0" encoding="UTF-8" ?>
  <!DOCTYPE html (View Source for full doctype...)>
- <html xmlns="http://www.w3.org/1999/xhtml" xmlns:html="http://www.w3.org/1999/xhtml">

Any ideas on what is the cause of this issue and how to overcome it? Likewise, how to define the correct proper namespace prefix? Is it possible that this document has two namespaces. A default one and one with prefix 'html'? If so, which one should I use?
 
Many thanks again,
 
Jack

From: Michael Kay <[email protected]>
To: Jack Bush <[email protected]>; [email protected]
Sent: Saturday, 3 January, 2009 1:02:10 AM
Subject: RE: JDOM XSLT TransformerConfigurationException

I would suspect that
 
new StreamSource("stateStyleSheet.xsl")
 
isn't finding the stylesheet.
 
Try supplying an absolute URI, or using the constructor
 
new StreamSource(new File("stateStyleSheet.xsl"))
 
Michael Kay
http://www.saxonica.com/


From: Jack Bush [mailto:[email protected]]
Sent: 02 January 2009 13:54
To: [email protected]
Subject: JDOM XSLT TransformerConfigurationException

Hi All,

I am getting the following exception when trying to do simple transformation (newbie in JDOM XSLT) using either XSLTransformer/TrAX in JDOM:

 

javax.xml.transform.TransformerConfigurationException: java.io.EOFException: no more input

at com.icl.saxon.PreparedStyleSheet.prepare(PreparedStyleSheet.java:121)

at com.icl.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:120)

at com.icl.saxon.TransformerFactoryImpl..newTransformer(TransformerFactoryImpl.java:72)

at standaloneClientRemoteInvestmentBean.JDOMTrAXPojoInvestmentBean.retrieveAreaZipcode(JDOMTrAXPojoInvestmentBean.java:68)

at standaloneClientRemoteInvestmentBean.JDOMTrAXPojoInvestmentBean.main(JDOMTrAXPojoInvestmentBean.java:37)

Caused by: java.io..EOFException: no more input

at com.icl.saxon.aelfred.XmlParser.popInput(XmlParser.java:4083)

at com.icl.saxon.aelfred.XmlParser.pushURL(XmlParser.java:3620)

at com.icl.saxon.aelfred.XmlParser.doParse(XmlParser.java:159)

at com.icl.saxon.aelfred.SAXDriver.parse(SAXDriver.java:320)

at com.icl.saxon.om.Builder.build(Builder.java:265)

at com.icl.saxon.PreparedStyleSheet.prepare(PreparedStyleSheet..java:111)

... 4 more

 

Below is the stateStyleSheet:

<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet version="1.0"

xmlns:xsl="http://www..w3.org/1999/XSL/Transform">

<xsl:template match="/">

<html>

<body>

<h2>Transformed State Detail</h2>

<table border="1">

<tr bgcolor="lightblue">

<th align="left">Area Link</th>

<th align="left">Area Name</th>

</tr>

<xsl:for-each select="/ns:html/ns:body/ns:div[@id='content']/ns:table[@class='sresults']/ns:tr/ns:td/ns:a">

<tr>

<td><xsl:value-of select="@href"/></td>

<td><xsl:value-of select="@title"/></td>

</tr>

</xsl:for-each>

</table>

</body>

</html>

</xsl:template>

</xsl:stylesheet>

 

The Java program that calls this stateStyleSheet is as follows:

    SAXBuilder statesaxBuilder = new SAXBuilder("org.ccil.cowan.tagsoup.Parser", false);

    org.jdom.Document stateDocument = statesaxBuilder.build("state.xml");

    TransformerFactory factory = TransformerFactory.newInstance();

    Transformer transformer = factory.newTransformer(new StreamSource("stateStyleSheet.xsl"));

    JDOMSource source = new JDOMSource(stateDocument);

    JDOMResult result = new JDOMResult();

    transformer.transform(source, result);

    Document tranformedDocument = result.getDocument();

    ......

 

Could this exception have been caused by incorrectly formatted stateStyleSheet? The search path "/ns:html/ns:body/ns:div[@id='content']/ns:table[@class='sresults']/ns:tr/ns:td/ns:a" has successfully worked in XPath such as the following lines:

 

    XPath statePath = XPath.newInstance("/ns:html/ns:body/ns:div[@id='content']/ns:table [@class='sresults']/ns:tr/ns:td/ns:a");

    statePath.addNamespace("ns", http://www.w3.org/1999/xhtml);

 

Whether including namespace ("ns") or not doesn't make any difference.

I am running JDK1.6, Netbeans 6.1, JDOM 1.1, Saxon 6.5, TagSoup 1.2 on Windows XP platform.

Your assistance would be much appreciated.

Many thanks,

Jack



Stay connected to the people that matter most with a smarter inbox. http://au.rd.yahoo.com/galaxy/mail/tagline2/*http://au.docs.yahoo.com/mail/smarterinbox.


Stay connected to the people that matter most with a smarter inbox. http://au.rd.yahoo.com/galaxy/mail/tagline2/*http://au.docs.yahoo.com/mail/smarterinbox.


Stay connected to the people that matter most with a smarter inbox. http://au.rd.yahoo.com/galaxy/mail/tagline2/*http://au.docs.yahoo.com/ma....

Read the original blog entry...

IoT & Smart Cities Stories
Bill Schmarzo, Tech Chair of "Big Data | Analytics" of upcoming CloudEXPO | DXWorldEXPO New York (November 12-13, 2018, New York City) today announced the outline and schedule of the track. "The track has been designed in experience/degree order," said Schmarzo. "So, that folks who attend the entire track can leave the conference with some of the skills necessary to get their work done when they get back to their offices. It actually ties back to some work that I'm doing at the University of San...
In his general session at 19th Cloud Expo, Manish Dixit, VP of Product and Engineering at Dice, discussed how Dice leverages data insights and tools to help both tech professionals and recruiters better understand how skills relate to each other and which skills are in high demand using interactive visualizations and salary indicator tools to maximize earning potential. Manish Dixit is VP of Product and Engineering at Dice. As the leader of the Product, Engineering and Data Sciences team at D...
When talking IoT we often focus on the devices, the sensors, the hardware itself. The new smart appliances, the new smart or self-driving cars (which are amalgamations of many ‘things'). When we are looking at the world of IoT, we should take a step back, look at the big picture. What value are these devices providing. IoT is not about the devices, its about the data consumed and generated. The devices are tools, mechanisms, conduits. This paper discusses the considerations when dealing with the...
Bill Schmarzo, author of "Big Data: Understanding How Data Powers Big Business" and "Big Data MBA: Driving Business Strategies with Data Science," is responsible for setting the strategy and defining the Big Data service offerings and capabilities for EMC Global Services Big Data Practice. As the CTO for the Big Data Practice, he is responsible for working with organizations to help them identify where and how to start their big data journeys. He's written several white papers, is an avid blogge...
Dynatrace is an application performance management software company with products for the information technology departments and digital business owners of medium and large businesses. Building the Future of Monitoring with Artificial Intelligence. Today we can collect lots and lots of performance data. We build beautiful dashboards and even have fancy query languages to access and transform the data. Still performance data is a secret language only a couple of people understand. The more busine...
If a machine can invent, does this mean the end of the patent system as we know it? The patent system, both in the US and Europe, allows companies to protect their inventions and helps foster innovation. However, Artificial Intelligence (AI) could be set to disrupt the patent system as we know it. This talk will examine how AI may change the patent landscape in the years to come. Furthermore, ways in which companies can best protect their AI related inventions will be examined from both a US and...
Enterprises have taken advantage of IoT to achieve important revenue and cost advantages. What is less apparent is how incumbent enterprises operating at scale have, following success with IoT, built analytic, operations management and software development capabilities - ranging from autonomous vehicles to manageable robotics installations. They have embraced these capabilities as if they were Silicon Valley startups.
Chris Matthieu is the President & CEO of Computes, inc. He brings 30 years of experience in development and launches of disruptive technologies to create new market opportunities as well as enhance enterprise product portfolios with emerging technologies. His most recent venture was Octoblu, a cross-protocol Internet of Things (IoT) mesh network platform, acquired by Citrix. Prior to co-founding Octoblu, Chris was founder of Nodester, an open-source Node.JS PaaS which was acquired by AppFog and ...
The deluge of IoT sensor data collected from connected devices and the powerful AI required to make that data actionable are giving rise to a hybrid ecosystem in which cloud, on-prem and edge processes become interweaved. Attendees will learn how emerging composable infrastructure solutions deliver the adaptive architecture needed to manage this new data reality. Machine learning algorithms can better anticipate data storms and automate resources to support surges, including fully scalable GPU-c...
Cloud-enabled transformation has evolved from cost saving measure to business innovation strategy -- one that combines the cloud with cognitive capabilities to drive market disruption. Learn how you can achieve the insight and agility you need to gain a competitive advantage. Industry-acclaimed CTO and cloud expert, Shankar Kalyana presents. Only the most exceptional IBMers are appointed with the rare distinction of IBM Fellow, the highest technical honor in the company. Shankar has also receive...