473,397 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

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:transform version="1.1"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xhtml" omit-xml-declaration="yes"/>
<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.transform.Transformer 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.transform.TransformerException: org.w3c.dom.DOMException:
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.xalan.transformer.ClonerToResultTree.cl oneToResultTree(ClonerToResultTree.java:268)
at
org.apache.xalan.templates.ElemCopy.execute(ElemCo py.java:155)
at
org.apache.xalan.templates.ElemApplyTemplates.tran sformSelectedNodes(ElemApplyTemplates.java:425)
at
org.apache.xalan.templates.ElemApplyTemplates.exec ute(ElemApplyTemplates.java:216)
at
org.apache.xalan.transformer.TransformerImpl.execu teChildTemplates(TransformerImpl.java:2339)
at
org.apache.xalan.templates.ElemCopy.execute(ElemCo py.java:162)
at
org.apache.xalan.templates.ElemApplyTemplates.tran sformSelectedNodes(ElemApplyTemplates.java:425)
at
org.apache.xalan.templates.ElemApplyTemplates.exec ute(ElemApplyTemplates.java:216)
at
org.apache.xalan.transformer.TransformerImpl.execu teChildTemplates(TransformerImpl.java:2339)
at
org.apache.xalan.transformer.TransformerImpl.apply TemplateToNode(TransformerImpl.java:2160)
at
org.apache.xalan.transformer.TransformerImpl.trans formNode(TransformerImpl.java:1213)
at
org.apache.xalan.transformer.TransformerImpl.trans form(TransformerImpl.java:668)
at
org.apache.xalan.transformer.TransformerImpl.trans form(TransformerImpl.java:1129)
at
org.apache.xalan.transformer.TransformerImpl.trans form(TransformerImpl.java:1107)
at ApplyTextSpan.applyXSL(ApplyTextSpan.java:79)
at ApplyTextSpan.main(ApplyTextSpan.java:40)
Caused by: org.w3c.dom.DOMException: 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.xalan.transformer.ResultTreeHandler.flu shElem(ResultTreeHandler.java:870)
at
org.apache.xalan.transformer.ResultTreeHandler.flu shPending(ResultTreeHandler.java:954)
at
org.apache.xalan.transformer.ResultTreeHandler.sta rtElement(ResultTreeHandler.java:243)
at
org.apache.xalan.transformer.ClonerToResultTree.cl oneToResultTree(ClonerToResultTree.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 2989

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

Similar topics

0
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...
20
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...
0
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...
2
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...
6
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...
4
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
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...
3
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
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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,...
0
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...

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.