473,729 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Transform error in Java

first off, i'm a total newbie at this stuff so excuse any wrong usage of
terminology or whatever else.

i have a XSL to transform a Document such that all "text" nodes will
have a "SPAN" inserted around it. the XSL is given below:

<xsl:transfor m version="1.1"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:output method="xhtml" omit-xml-declaration="ye s"/>
<xsl:strip-space elements="*"/>
<xsl:template match="text()" priority="2">
<span lx="" ly="" ux="" uy="">
<xsl:copy/>
</span>
</xsl:template>

<xsl:template match="node()">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:transform>

so basically, i parse a HTML page into a Document using nekoHTML and
then run that Document through this XSL. this is all accomplished in
Java (1.4.2_06) using the javax.xml.trans form.Transforme r class.

this works pretty well on most pages except a few gives it problems.
for example, http://www.netsol.com does not work. i get the following
error:
-------------------------------------------------------------------
javax.xml.trans form.Transforme rException: org.w3c.dom.DOM Exception:
NAMESPACE_ERR: An attempt is made to create or change an object in a way
which is incorrect with regard to namespaces.
at
org.apache.xala n.transformer.C lonerToResultTr ee.cloneToResul tTree(ClonerToR esultTree.java: 268)
at
org.apache.xala n.templates.Ele mCopy.execute(E lemCopy.java:15 5)
at
org.apache.xala n.templates.Ele mApplyTemplates .transformSelec tedNodes(ElemAp plyTemplates.ja va:425)
at
org.apache.xala n.templates.Ele mApplyTemplates .execute(ElemAp plyTemplates.ja va:216)
at
org.apache.xala n.transformer.T ransformerImpl. executeChildTem plates(Transfor merImpl.java:23 39)
at
org.apache.xala n.templates.Ele mCopy.execute(E lemCopy.java:16 2)
at
org.apache.xala n.templates.Ele mApplyTemplates .transformSelec tedNodes(ElemAp plyTemplates.ja va:425)
at
org.apache.xala n.templates.Ele mApplyTemplates .execute(ElemAp plyTemplates.ja va:216)
at
org.apache.xala n.transformer.T ransformerImpl. executeChildTem plates(Transfor merImpl.java:23 39)
at
org.apache.xala n.transformer.T ransformerImpl. applyTemplateTo Node(Transforme rImpl.java:2160 )
at
org.apache.xala n.transformer.T ransformerImpl. transformNode(T ransformerImpl. java:1213)
at
org.apache.xala n.transformer.T ransformerImpl. transform(Trans formerImpl.java :668)
at
org.apache.xala n.transformer.T ransformerImpl. transform(Trans formerImpl.java :1129)
at
org.apache.xala n.transformer.T ransformerImpl. transform(Trans formerImpl.java :1107)
at ApplyTextSpan.a pplyXSL(ApplyTe xtSpan.java:79)
at ApplyTextSpan.m ain(ApplyTextSp an.java:40)
Caused by: org.w3c.dom.DOM Exception: NAMESPACE_ERR: An attempt is made
to create or change an object in a way which is incorrect with regard to
namespaces.
at
org.apache.xala n.transformer.R esultTreeHandle r.flushElem(Res ultTreeHandler. java:870)
at
org.apache.xala n.transformer.R esultTreeHandle r.flushPending( ResultTreeHandl er.java:954)
at
org.apache.xala n.transformer.R esultTreeHandle r.startElement( ResultTreeHandl er.java:243)
at
org.apache.xala n.transformer.C lonerToResultTr ee.cloneToResul tTree(ClonerToR esultTree.java: 219)
... 15 more
---------

maybe the error is in the java stuff i have, but as far as the XSL file
i posted above, does it look correct? thank you very much.

--
Xiaolei Li | xl***@uiuc.edu | www.xiaolei.org
Jul 20 '05 #1
0 3022

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1486
by: Mark McKay | last post by:
I'm trying to send XML messages over a socket to a server I've written. At the moment, I'm using the default DOM utilities to create DOM trees and then try to translate them to strings, which I would then send. I'm trying to do this with the Transformer.transform() method, passing in a DOMSource and a StreamResult, with the StreamResult wrapping a StreamWriter. While this works fine when I'm running this sort of code as an application,...
20
3845
by: Steffen Brinkmann | last post by:
Hi! I tried to modify the transform algorithm in a way that it doesn't take iterators, but a reference to a container class and a value, because Mostly I need to do an operation of a container and a single number (e.g. multiply all the values in a vector by 3 or so). So, this is my intent: #ifndef ALGORITHM_EXT_HH #define ALGORITHM_EXT_HH
0
2089
by: Brian K | last post by:
I am new to Apache Batik and I am now doing a SVG Editor for my project. I use Java as programming language. I use Batik to generate the SVG from Java Graphics2D, as I would like to transform the SVG to other graphics formats (e.g. JPG, PNG, TIFF), an error occured, the error is that the graphics don't specify the size of graphics, so that even I can transform to JPG (for example), but the JPG file cannot display any graphics. Then I...
2
3668
by: Antonio Amato | last post by:
Hi, I want to transform XML docbook to HTML with docbook stylesheet (docbook-xsl-1.67.0.zip). I'm using javax.xml.transform.TransformerFactory to apply XSLT to XML but it generates an exception: javax.xml.transform.TransformerException: java.net.ConnectException: Connection timed out: connect. Is somebody using docbook-xsl-1.67.0.zip to do this with another
6
2486
by: Stephen Cook | last post by:
Having worked through the problems around enabling the document function using an XmlUrlResolver I started work on building a useful class to hide the intricacies. Trying to generalise the process I've hit a snag. How do I resolve multiple external references? The transform method on a stylesheet only takes one resolver, not an array Stephen
4
2257
by: hawat.thufir | last post by:
Just for posterity: $ pwd /home/thufir/xalon/w3school $ whoami thufir $ ll total 24 -rw-rw-r-- 1 thufir thufir 239 Feb 19 09:16 foo.xml
4
1431
by: rob | last post by:
Hi all, I have some xml that has the cent character in it ( not sure it it will post but here it is -> ¢ ) I get this error (Location of error unknown)XSLT Error (javax.xml.transform.TransformerException): java.io.UTFDataFormatException: Invalid byte 1 of 1-byte UTF-8 sequence.
3
1993
by: @CL | last post by:
Hi,all I was confused with xml transform. I had a xml file like: <Details> <names> <name/> <name/> ......or more <name/> </names>
2
1444
by: Donald Adams | last post by:
I'm creating Word 2007 reports in asp.net 1.1 via xml transform. I get data from the SQL server in .5 sec., first transform takes less than a sec. and uses 10MB. I have 900MB free memory of the 2GB memory. On following reports generations, I get out of memory on the transform command and only half the file is written before it breaks. The asp.net memory limit isn't at 60%, I even set it to 100% but still get the same error. Is there a...
0
8921
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
9202
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9148
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8151
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4528
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2683
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2165
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.