Re: jdom-interest Digest, Vol 40, Issue 4

"Abhishek Parwal" <[email protected]>
Newsgroups gmane.comp.java.jdom.general
Message-ID <[email protected]>
thanks for the reply. The character coudnot be pasted in my editor. It
is a EOT(control code c0 ) chracter whose decimal value is 4. I have
read this is not allowed to be parsed by xml parser. but is there any
way it can be parsed.
Thanks and Regards,
Abhishek


On Tue, 2007-11-06 at 12:00 -0800, [email protected] wrote:
> Send jdom-interest mailing list submissions to
> 	[email protected]
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://www.jdom.org/mailman/listinfo/jdom-interest
> or, via email, send a message with subject or body 'help' to
> 	[email protected]
> 
> You can reach the person managing the list at
> 	[email protected]
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of jdom-interest digest..."
> 
> 
> Today's Topics:
> 
>    1. Re: Resetting the Root Element (Laurent Bihanic)
>    2. Issue with Jdom parsing control character (Abhishek Parwal)
>    3. Re: Resetting the Root Element (Grzegorz Kaczor)
>    4. Re: Resetting the Root Element (Sebastian Hinterw?lder)
>    5. Re: Issue with Jdom parsing control character (Laurent Bihanic)
>    6. Re: Resetting the Root Element (Jason Hunter)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Tue, 06 Nov 2007 09:57:42 +0100
> From: Laurent Bihanic <[email protected]>
> Subject: Re: [jdom-interest] Resetting the Root Element
> To: Sebastian Hinterw?lder <[email protected]>
> Cc: [email protected]
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> Hi,
> 
> Sebastian Hinterwlder wrote:
> > Now I want to set a different root element using JDOM. I already tried 
> > it by cloning the whole document but this doesn't work. A different 
> > solution for me would also be removing the namespaces from the root. I 
> > am quite new to JDOM - so I hope someone knows a solution!
> 
> You have to create a new root element and detach content from the old root to 
> add it to the new root :
>      Element newRoot = new Element(...);
>      newRoot.setContent(oldRoot.removeContent());
> 
> Unfortunately, there is no Element.removeAttributes() method. So you'll 
> probably have to iterate on the old root's attribute list to detach each 
> attribute (using Iterator.remove()) and add it to the new root.
> Any better way, someone ?
> 
> Laurent
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Tue, 06 Nov 2007 02:06:25 -0700
> From: "Abhishek Parwal" <[email protected]>
> Subject: [jdom-interest] Issue with Jdom parsing control character
> To: <[email protected]>
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset=US-ASCII
> 
> 
> 
> Hi,
> 
> When i try to parse the control chars the following exception occurs:
> 
> org.jdom.input.JDOMParseException: Error on line 1: Character reference
> "" is an invalid XML character. at
> org.jdom.input.SAXBuilder.build(SAXBuilder.java:381) at
> org.jdom.input.SAXBuilder.build(SAXBuilder.java:764) at
> com.novell.emframe.dev.DataHandlerHelper.setString(DataHandlerHelper.java:233) at com.novell.emframe.dev.DirUtils.writeAttributeXML(DirUtils.java:648) at com.novell.emframe.fw.Target.write(Target.java:715) at com.novell.emframe.fw.TargetCollection.write(TargetCollection.java:434) at com.novell.emframe.dev.DirPropertyBookPage.save(DirPropertyBookPage.java:111) at com.novell.emframe.dev.PropertyBookPage.cache(PropertyBookPage.java:324) at com.novell.emframe.dev.PropertyBook.doApply(PropertyBook.java:920) at com.novell.emframe.dev.PropertyBook.execute(PropertyBook.java:155) at com.novell.emframe.dev.Task.execute(Task.java:505) at com.novell.nps.gadgetManager.BaseGadgetInstance.processRequest(BaseGadgetInstance.java:849) at com.novell.nps.gadgetManager.BaseGadgetInstance.handleAction(BaseGad
 getInstance.java:2375) at com.novell.nps.gadgetManager.GadgetManager.processInstanceRequest(GadgetManager.java:1606) at com.novell.nps.gadgetManager.GadgetManager.processServiceRequest(Gadg!
 et!
>  Manager.java:1062) at com.novell.nps.PortalServlet.handleFrameService(PortalServlet.java:496) at com.novell.nps.PortalServlet.processRequest(PortalServlet.java:369) at com.novell.nps.PortalServlet.doPost(PortalServlet.java:275) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) at com.novell.emframe.fw.servlet.AuthenticatorServlet.service(AuthenticatorServlet.java:291) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) at org.apache.catalina.core.StandardValveContext.invokeNext(Standar
 dValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.j!
 av!
>  a:198) at org.apache.catalina.core.StandardContextValve.invoke(Standar
> dContextValve.java:152) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) 
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache!
 .c!
>  atalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:300) at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:374) at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:743) at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:675) at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:866) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:534) Caused by: org.xml.sax.SAXParseException: Character reference "" is an invalid XML character. 
 at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source) at org.apache.xerces.impl.XMLE!
 rr!
>  orReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLEr
> rorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source) at org.apache.xerces.impl.XMLScanner.scanCharReferenceValue(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanCharReference(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:370) .
 .. 48 more Caused by: org.xml.sax.SAXParseException: Character reference "" is an invalid XML character. at org.apache.xerces.util.ErrorHandlerWrapper.createSA
> 
> Please guide how to reasolve this problem.
> 
> Thanks and Regards,
> Abhishek Parwal
> 
> 
> 
> 
> 
> 
> ------------------------------
> 
> Message: 3
> Date: Tue, 6 Nov 2007 10:13:02 +0100
> From: "Grzegorz Kaczor" <[email protected]>
> Subject: Re: [jdom-interest] Resetting the Root Element
> To: " Sebastian Hinterw?lder " <[email protected]>
> Cc: [email protected]
> Message-ID:
> 	<[email protected]>
> Content-Type: text/plain; charset="iso-8859-2"
> 
> Hi,
> 
> you can create a new document and add to it contents of the root element.
> 
> Element root = new Element("new_root");
> root.addContent(oldRoot.removeContent());
> 
> or something similar (I am writing from memory).
> 
> Regards,
> Grzegorz
> 
> 2007/11/5, Sebastian Hinterwlder <[email protected]>:
> >
> > Hello,
> >
> > I have a question concerning the root element of a normal XML document.
> > Probably something like this already appeared in this list some time
> > ago, but I don't get my problem solved so far.
> >
> > I have a normal "ATOM feed" which looks something like this:
> >
> > <?xml version="1.0" encoding="utf-8"?>
> > <!-- generator="FeedCreator 1.6" -->
> > <feed xmlns="http://www.w3.org/2005/Atom"
> > xmlns:dc="http://purl.org/dc/elements/1.1/"
> > xml:lang="de">
> >     <title>Golem.de</title>
> >     <subtitle>IT-News fuer Profis</subtitle>
> >     ....
> >
> > Now I want to set a different root element using JDOM. I already tried
> > it by cloning the whole document but this doesn't work. A different
> > solution for me would also be removing the namespaces from the root. I
> > am quite new to JDOM - so I hope someone knows a solution!
> >
> > Thanks in advance
> >
> > Sebastian
> > _______________________________________________
> > To control your jdom-interest membership:
> > http://www.jdom.org/mailman/options/jdom-interest/[email protected]
> >
> 
> 
> 
> -- 
> "Cho tyle wiemy wasnym dowiadczeniem:
> W nas jest Raj, Pieko - i do obu - szlaki."
> J.K.
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://www.jdom.org/pipermail/jdom-interest/attachments/20071106/ff530b46/attachment-0001.htm
> 
> ------------------------------
> 
> Message: 4
> Date: Tue, 06 Nov 2007 10:35:20 +0100
> From: Sebastian Hinterw?lder  <[email protected]>
> Subject: Re: [jdom-interest] Resetting the Root Element
> To: [email protected]
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> Hello
> >
> > You have to create a new root element and detach content from the old 
> > root to add it to the new root :
> >     Element newRoot = new Element(...);
> >     newRoot.setContent(oldRoot.removeContent());
> >
> >
> Thanks a lot to you guys. That was exactly the solution I was searching 
> for. Great support.
> 
> Greets Sebastian
> 
> 
> ------------------------------
> 
> Message: 5
> Date: Tue, 06 Nov 2007 11:31:28 +0100
> From: Laurent Bihanic <[email protected]>
> Subject: Re: [jdom-interest] Issue with Jdom parsing control character
> To: Abhishek Parwal <[email protected]>
> Cc: [email protected]
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> Hi,
> 
> Abhishek Parwal wrote:
> > When i try to parse the control chars the following exception occurs:
> > 
> > org.jdom.input.JDOMParseException: Error on line 1: Character reference
> > "" is an invalid XML character. at
> ...
> > Caused by: org.xml.sax.SAXParseException: Character reference "" is an invalid 
> XML character.
> > 
> > Please guide how to reasolve this problem.
> 
> The error is reported by the underlying XML parser (Xerces). There is an 
> invalid character (NUL?) in the received XML document.
> The list of allowed characters in XML is defined here : 
> http://www.w3.org/TR/REC-xml/#charsets
> 
> Laurent
> 
> 
> ------------------------------
> 
> Message: 6
> Date: Tue, 06 Nov 2007 09:43:42 -0800
> From: Jason Hunter <[email protected]>
> Subject: Re: [jdom-interest] Resetting the Root Element
> To: Laurent Bihanic <[email protected]>
> Cc: Sebastian Hinterw?lder <[email protected]>,
> 	[email protected]
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> Laurent Bihanic wrote:
> > Hi,
> > 
> > Sebastian Hinterwlder wrote:
> >> Now I want to set a different root element using JDOM. I already tried 
> >> it by cloning the whole document but this doesn't work. A different 
> >> solution for me would also be removing the namespaces from the root. I 
> >> am quite new to JDOM - so I hope someone knows a solution!
> > 
> > You have to create a new root element and detach content from the old 
> > root to add it to the new root :
> >     Element newRoot = new Element(...);
> >     newRoot.setContent(oldRoot.removeContent());
> > 
> > Unfortunately, there is no Element.removeAttributes() method. So you'll 
> > probably have to iterate on the old root's attribute list to detach each 
> > attribute (using Iterator.remove()) and add it to the new root.
> > Any better way, someone ?
> 
> You can do elt.setAttributes(null).
> 
> (Or pass an empty list.)
> 
> -jh-
> 
> 
> ------------------------------
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/[email protected]
> 
> End of jdom-interest Digest, Vol 40, Issue 4
> ********************************************


_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.