| By XMLDEV Mailing List: An Email Discussion Forum for W3C XML technologies and XML development trends. | Article Rating: |
|
| January 4, 2009 01:37 PM EST | Reads: |
875 |
Hi Michael,
The following statements generated state.xml file:
URL stateUrl = new URL("http://www.abc.com");
URLConnection stateconnection = stateUrl.openConnection();
stateisInHtml = stateconnection.getInputStream();
statedisInHtml = new DataInputStream(new BufferedInputStream(stateisInHtml));
System.out.flush();
statefosOutHtml = new FileOutputStream("state.html");
while ((oneChar=statedisInHtml.read()) != -1)
statefosOutHtml.write(oneChar);
.....
statefrInHtml = new FileReader("state.html");
statebrInHtml = new BufferedReader(statefrInHtml);
SAXBuilder statesaxBuilder = new SAXBuilder("org.ccil.cowan.tagsoup..Parser", false);
org.jdom.Document statejdomDocument = statesaxBuilder.build(statebrInHtml);
XMLOutputter stateoutputter = new XMLOutputter();
statefwOutXml = new FileWriter("state.xml");
statebwOutXml = new BufferedWriter(statefwOutXml);
stateoutputter.output(statejdomDocument, statebwOutXml);
XPath had no problem looking up state.xml.
Thanks,
Jack
From: Michael Kay <[email protected]>
To: Jack Bush <[email protected]>; Robert Koberg <[email protected]>
Cc: [email protected]
Sent: Monday, 5 January, 2009 2:13:33 AM
Subject: RE: JDOM XSLT TransformerConfigurationException
java.io.UTFDataFormatException: Invalid byte 1 of 1-byte UTF-8 sequence.There's only one explanation of that: the parser is expecting the document to be encoded in UTF-8 but it isn't. To understand why it isn't, you need to examine how the document was created and any transcodings that might have taken place before it reached the parser.
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...)>
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?It's certainly inelegant to bind the same namespace to two prefixes like this, though it's not incorrect. Again to prevent it happening we need to understand how you created the document.Michael Kay
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...
Published January 4, 2009 Reads 875
Copyright © 2009 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
Sep. 8, 2018 09:45 PM EDT Reads: 3,205 |
By Liz McMillan Sep. 7, 2018 07:45 PM EDT Reads: 2,979 |
By Zakia Bouachraoui Sep. 6, 2018 07:30 PM EDT |
By Zakia Bouachraoui Sep. 5, 2018 10:00 PM EDT |
By Pat Romanski Sep. 5, 2018 04:00 PM EDT Reads: 1,658 |
By Yeshim Deniz Sep. 4, 2018 11:45 PM EDT Reads: 3,210 |
By Yeshim Deniz Sep. 4, 2018 03:00 PM EDT Reads: 3,665 |
By Pat Romanski Sep. 2, 2018 06:45 PM EDT Reads: 1,727 |
By Yeshim Deniz Aug. 31, 2018 12:30 PM EDT |
By Elizabeth White IoT is rapidly becoming mainstream as more and more investments are made into the platforms and technology. As this movement continues to expand and gain momentum it creates a massive wall of noise that can be difficult to sift through. Unfortunately, this inevitably makes IoT less approachable for people to get started with and can hamper efforts to integrate this key technology into your own portfolio. There are so many connected products already in place today with many hundreds more on the h...Aug. 30, 2018 06:30 PM EDT Reads: 2,058 |

IoT is rapidly becoming mainstream as more and more investments are made into the platforms and technology. As this movement continues to expand and gain momentum it creates a massive wall of noise that can be difficult to sift through. Unfortunately, this inevitably makes IoT less approachable for people to get started with and can hamper efforts to integrate this key technology into your own portfolio. There are so many connected products already in place today with many hundreds more on the h...



















