On Wed, Nov 11, 2009 at 4:07 PM, ctrlspace <chris.huis...@gmail.com> wrote:

>
> Sorry for what may seem like a stupid question, but I am very new to
> scala/lift.
>
> PCDataXmlParser solved my issue with w3 dtd but I am now getting a
> parse error when I get a http stream.
>

It's looking like what you are trying to parse is not XML, but HTML.  You'd
be best off using an HTML parser:
http://java-source.net/open-source/html-parsers


>
> :96:5: '<' not allowed in attrib valuegoogle_ad_type =
> "text_image";    ^
> Exception in thread "main" java.lang.ExceptionInInitializerError
>        at ca.ctrlspace.loveItHateItWeb.xml.UpcDatabaseFeed.main
> (UpcDatabaseFeed.scala)
> Caused by: java.lang.IllegalArgumentException: line 97 does not exist
>        at scala.io.Source.getLine(Source.scala:280)
>        at scala.io.Source.report(Source.scala:368)
>        at scala.io.Source.reportError(Source.scala:355)
>        at scala.io.Source.reportError(Source.scala:344)
>        at scala.xml.parsing.MarkupParser$class.reportSyntaxError
> (MarkupParser.scala:1113)
>        at net.liftweb.util.PCDataXmlParser.reportSyntaxError
> (PCDataMarkupParser.scala:91)
>
> it looks like the following is causing this:
>
>  <script type="text/javascript"><!--
> google_ad_client = "pub-2938286402422382";
> google_ad_width = 160;
> google_ad_height = 600;
> google_ad_format = "160x600_as";
> google_ad_type = "text_image";
> google_ad_channel = "";
> google_color_border = "ffffff";
> google_color_bg = "ffffff";
> google_color_link = "0000cc";
> google_color_url = "0000cc";
> google_color_text = "000000";
> //--></script>
>
> Is it possible to ask PCDataXmlParser not to grab certain xml
> elements?
> What is the proper way to use PCDataXmlParser?
>
> As an aside why does PCDataXmlParser not give the w3 dtd exception?
>

Because it's not trying to do any validation, so it's not looking at the
DOCTYPE and thus not trying to load the dtd.


>
> Thanks,
>
> Chris.
>
> On Nov 9, 11:33 pm, David Pollak <feeder.of.the.be...@gmail.com>
> wrote:
> > It's not an issue of Lift's output working with XML.load, it's an issue
> of
> > the W3C blocking the Java libraries.  This has nothing to do with Lift or
> > the XML Lift emits.
> >
> > If you want to parse XML and not run into that problem, use
> > net.liftweb.util.PCDataXmlParser
> >
> >
> >
> >
> >
> > On Mon, Nov 9, 2009 at 7:11 PM, Alex Black <a...@alexblack.ca> wrote:
> >
> > > I read these two:
> >
> > >http://old.nabble.com/Exception-loading-XML-with-DTD-td25213294.html
> >
> > >http://stackoverflow.com/questions/1096285/is-scala-java-not-respecti.
> ..
> >
> > > Not sure what the answer is, some ugly work arounds are presented...
> >
> > > Presumably Lift's XML output *should* work with XML.Load?
> >
> > > - Alex
> >
> > > On Nov 9, 10:01 pm, Naftoli Gugenheim <naftoli...@gmail.com> wrote:
> > > > Don't know but it's been asked so you should be able to search for
> it;
> > > I'm not sure whether on this list or scala-user or both.
> >
> > > > -------------------------------------
> >
> > > > Alex Black<a...@alexblack.ca> wrote:
> >
> > > > Exception:
> >
> > > > java.io.IOException: Server returned HTTP response code: 503 for URL:
> > >http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
> > > >         at sun.net.www.protocol.http.HttpURLConnection.getInputStream
> > > > (HttpURLConnection.java:1313)
> > > >         at
> >
> > >
> com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity
> > > > (XMLEntityManager.java:677)
> > > >         at
> > > > com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity
> > > > (XMLEntityManager.java:1315)
> > > >         at
> > > >
> com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity
> > > > (XMLEntityManager.java:1282)
> > > >         at
> > > >
> com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource
> > > > (XMLDTDScannerImpl.java:283)
> > > >         at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl
> > > > $DTDDriver.dispatch(XMLDocumentScannerImpl.java:1193)
> > > >         at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl
> > > > $DTDDriver.next(XMLDocumentScannerImpl.java:1090)
> > > >         at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl
> > > > $PrologDriver.next(XMLDocumentScannerImpl.java:1003)
> > > >         at
> > > com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next
> > > > (XMLDocumentScannerImpl.java:648)
> > > >         at
> >
> > >
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scan
> Document
> > > > (XMLDocumentFragmentScannerImpl.java:510)
> > > >         at
> > > com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse
> > > > (XML11Configuration.java:807)
> > > >         at
> > > com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse
> > > > (XML11Configuration.java:737)
> > > >         at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse
> > > > (XMLParser.java:107)
> > > >         at
> > > com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse
> > > > (AbstractSAXParser.java:1205)
> > > >         at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl
> > > > $JAXPSAXParser.parse(SAXParserImpl.java:522)
> > > >         at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
> > > >         at
> > > scala.xml.parsing.FactoryAdapter.loadXML(FactoryAdapter.scala:292)
> > > >         at scala.xml.parsing.NoBindingFactoryAdapter.loadXML
> > > > (NoBindingFactoryAdapter.scala:60)
> > > >         at scala.xml.XML$.load(XML.scala:72)
> > > >         at
> > > com.snapsort.dataServer.api.ServerTest$$anonfun$testBasic$1.apply
> > > > (ServerTest.scala:16)
> > > >         at
> > > com.snapsort.dataServer.api.ServerTest$$anonfun$testBasic$1.apply
> > > > (ServerTest.scala:14)
> > > >         at com.snapsort.common.Using$.apply(Using.scala:12)
> > > >         at
> > > com.snapsort.dataServer.api.ServerTest.testBasic(ServerTest.scala:
> > > > 14)
> > > >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> > > >         at sun.reflect.NativeMethodAccessorImpl.invoke
> > > > (NativeMethodAccessorImpl.java:39)
> > > >         at sun.reflect.DelegatingMethodAccessorImpl.invoke
> > > > (DelegatingMethodAccessorImpl.java:25)
> > > >         at java.lang.reflect.Method.invoke(Method.java:597)
> > > >         at junit.framework.TestCase.runTest(TestCase.java:168)
> > > >         at junit.framework.TestCase.runBare(TestCase.java:134)
> > > >         at junit.framework.TestResult$1.protect(TestResult.java:110)
> > > >         at
> junit.framework.TestResult.runProtected(TestResult.java:128)
> > > >         at junit.framework.TestResult.run(TestResult.java:113)
> > > >         at junit.framework.TestCase.run(TestCase.java:124)
> > > >         at junit.framework.TestSuite.runTest(TestSuite.java:232)
> > > >         at junit.framework.TestSuite.run(TestSuite.java:227)
> > > >         at org.junit.internal.runners.JUnit38ClassRunner.run
> > > > (JUnit38ClassRunner.java:83)
> > > >         at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run
> > > > (JUnit4TestReference.java:46)
> > > >         at org.eclipse.jdt.internal.junit.runner.TestExecution.run
> > > > (TestExecution.java:38)
> > > >         at
> > > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests
> > > > (RemoteTestRunner.java:467)
> > > >         at
> > > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests
> > > > (RemoteTestRunner.java:683)
> > > >         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run
> > > > (RemoteTestRunner.java:390)
> > > >         at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main
> > > > (RemoteTestRunner.java:197)
> >
> > > > On Nov 9, 9:43 pm, Alex Black <a...@alexblack.ca> wrote:
> >
> > > > > Hi, I'm attempting to write a basic unit test for a webservice I'm
> > > > > implementing in Lift, by test looks like this:
> >
> > > > >       val foo = XML.load("http://localhost:8080";)
> >
> > > > > I'm getting an exception I assume because the XML parser is trying
> to
> > > > > download the DTD and is getting denied.  Whats the best way to work
> > > > > around this?
> >
> > > > > - Alex
> >
> > --
> > Lift, the simply functional web frameworkhttp://liftweb.net
> > Beginning Scalahttp://www.apress.com/book/view/1430219890
> > Follow me:http://twitter.com/dpp
> > Surf the harmonics
>
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to