简体   繁体   English

publicId 和 systemId 之间需要空格

[英]White spaces are required between publicId and systemId

I am trying to make a ajax call to other domain locally from my computer by writing some proxy code in jsp.我正在尝试通过在 jsp 中编写一些代理代码,从我的计算机本地对其他域进行 ajax 调用。 And this is my jQuery AJAX code that is calling proxy.jsp page.这是我的 jQuery AJAX 代码,它正在调用 proxy.jsp 页面。

 var metadata = 'https://rest-search.host.com/machine/search/meta?id=';

var on_show_info= function() {

    var AjaxCall = data + current_doc_info.id;
    alert(AjaxCall);
                request_meta_info = $.ajax({
                url: "proxy.jsp?url=" + AjaxCall,
                type: 'GET',
                success: check,
                error: error
        });
    };

And my JSP file is:-我的 JSP 文件是:-

<%@ page language="java" import="org.w3c.dom.*,javax.xml.parsers.DocumentBuilder,javax.xml.parsers.DocumentBuilderFactory,java.net.*,java.io.*" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%

String urlToQuery = request.getParameter("url");
System.out.println("rj   " +urlToQuery);
URL url = new URL(urlToQuery);
final String login ="user";
final String password ="pass";

Authenticator.setDefault(new Authenticator() {
    protected PasswordAuthentication getPasswordAuthentication() {
        return new PasswordAuthentication (login, password.toCharArray());
    }
});
URLConnection conn = url.openConnection();

InputStream in = conn.getInputStream();

DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
DocumentBuilder db =dbf.newDocumentBuilder();
Document doc=db.parse(urlToQuery);


NodeList nl= doc.getElementsByTagName("attr");
%>


<%= nl.item(0).getFirstChild().getNodeValue() %> 

And When I check the response, I am getting this error for the XML file it is parsing:当我检查响应时,我收到它正在解析的 XML 文件的错误:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 500 White spaces are required between publicId and systemId.</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /proxy.jsp. Reason:
<pre>    White spaces are required between publicId and systemId.</pre></p><h3>Caused by:</h3><pre>org.xml.sax.SAXParseException: White spaces are required between publicId and systemId.
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:180)
    at org.apache.jsp.proxy_jsp._jspService(org.apache.jsp.proxy_jsp:70)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:109)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:389)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:486)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:380)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
    at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:327)
    at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:126)
    at org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:213)
    at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:171)
    at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
    at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
    at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:381)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:67)
    at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:122)
    at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:110)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
    at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
    at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:536)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:915)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:539)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:405)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
</pre>
<hr /><i><small>Powered by Jetty://</small></i><br/>                                                
</body>
</html>

And the XMl file is this:- XMl 文件是这样的:-

<results><result><attr value="HW/SW" name="Line"/><attr value="ASIC" name="Description"/><attr value="CD" name="Number"/><attr value="AS" name="DocumentType"/><attr value="" name="Date"/><</result></results>

What wrong I am doing here.. Any suggestions will be appreciated..我在这里做错了什么..任何建议将不胜感激..

The error message is actually correct if not obvious.如果不明显,错误消息实际上是正确的。 It says that your DOCTYPE must have a SYSTEM identifier.它说你的 DOCTYPE 必须有一个 SYSTEM 标识符。 I assume yours only has a public identifier.我假设你的只有一个公共标识符。

You'll get the error with (for instance):你会得到错误(例如):

<!DOCTYPE persistence PUBLIC
    "http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">

You won't with:你不会:

<!DOCTYPE persistence PUBLIC
    "http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" "">

Notice "" at the end in the second one -- that's the system identifier.注意第二个末尾的"" ——这是系统标识符。 The error message is confusing: it should say that you need a system identifier, not that you need a space between the publicId and the (non-existent) systemId.错误消息令人困惑:它应该说您需要一个系统标识符,而不是您需要在 publicId 和(不存在的)systemId 之间有一个空格。

By the way, an empty system identifier might not be ideal, but it might be enough to get you moving.顺便说一句,一个空的系统标识符可能并不理想,但它可能足以让你动起来。

I just found my self with this Exception, I was trying to consume a JAX-WS, with a custom URL like this:我刚刚发现自己遇到了这个异常,我试图使用 JAX-WS,使用自定义 URL,如下所示:

String WSDL_URL= <get value from properties file>;
Customer service = new Customer(new URL(WSDL_URL));
ExecutePtt port = service.getExecutePt();
return port.createMantainCustomers(part);

and Java threw:和 Java 抛出:

XML reader error: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,63]
Message: White spaces are required between publicId and systemId.

Turns out that the URL string used to construct the service was missing the "?wsdl" at the end.事实证明,用于构建服务的 URL 字符串最后缺少“?wsdl”。 For instance:例如:

Bad:坏的:

http://www.host.org/service/Customer

Good:好的:

http://www.host.org/service/Customer?wsdl

Change the order of statments.更改语句的顺序。 For me, changing the block of code对我来说,改变代码块

xsi:schemaLocation="http://www.springframework.org/schema/beans 
                    http://www.springframework.org/schema/context
                    http://www.springframework.org/schema/beans/spring-beans.xsd" 

with

xsi:schemaLocation="http://www.springframework.org/schema/beans 
                    http://www.springframework.org/schema/beans/spring-beans.xsd
                    http://www.springframework.org/schema/context"

is valid.已验证。

I just found this post: http://forum.springsource.org/showthread.php?68949-White-spaces-are-required-between-publicId-and-systemId./page2&s=c69fe19798f5a071d22eaf681ca84a56我刚刚发现这个帖子: http://forum.springsource.org/showthread.php?68949-White-spaces-are-required-between-publicId-and-systemId./page2&s=c69fe19798f58a07

A couple people here had success by switching the lines around in an XML file.这里有几个人通过在 XML 文件中切换行来取得成功。

If you're working from some network that requires you to use a proxy in your browser to connect to the internet (likely an office building), that might be it.如果您在某个网络上工作,该网络需要您在浏览器中使用代理来连接到 Internet(可能是办公楼),那么可能就是这样。 I had the same issue and adding the proxy configs to the network settings solved it.我有同样的问题,将代理配置添加到网络设置解决了它。

  • Go to your preferences (Eclipse -> Preferences on a Mac, or Window -> Preferences on a Windows) Go 到您的首选项(Eclipse -> Mac 上的首选项,或 Window -> Windows 上的首选项)
  • Then -> General -> expand to view the list underneath -> Select Network Connections (don't expand)然后 -> General -> 展开查看下面的列表 -> Select Network Connections(不要展开)
  • At the top of the page that appears there is a drop down, select "Manual."在出现的页面顶部有一个下拉菜单,select“手册”。
  • Then select "HTTP" in the list directly below the drop down (which now should have all it's options checked) and then click the "Edit" button to the right of the list.然后 select 在下拉列表正下方的列表中“HTTP”(现在应该检查所有选项),然后单击列表右侧的“编辑”按钮。
  • Enter in the proxy url and port you need to connect to the internet in your web browser normally.在 web 浏览器中正常输入您需要连接到 Internet 的代理 url 和端口。
  • Repeat for "HTTPS."重复“HTTPS”。

If you don't know the proxy url and port, talk to your network admin.如果您不知道代理 url 和端口,请咨询您的网络管理员。

It may not be related to the mistake of the person who opened the title, but I wanted to share it because it is the same error as the title.可能和打开标题的人的错误没有关系,但是我想分享一下,因为和标题一样的错误。

It was an error I got in one of my runs jsf primeface on glassfish server with netbeans and maven.这是我在使用 netbeans 和 maven 的 glassfish 服务器上的一次运行 jsf primeface 中遇到的错误。

This was the way of give me fail:这是给我失败的方式:

 <.DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1:0 Transitional//EN""http.//www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

But I returned this way and I didn't get any error:但是我以这种方式返回,并没有收到任何错误:

 <!DOCTYPE html>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:publicId 和 systemId 之间需要空格 - Error: White spaces are required between publicId and systemId publicId和systemId之间必须有空格 - White spaces are required between publicId and systemId 解析KML文档时,publicId和systemId之间需要空格 - White spaces are required between publicId and systemId while parsing KML document org.xml.sax.SAXParseException; publicId和systemId之间必须有空格 - org.xml.sax.SAXParseException; White spaces are required between publicId and systemId Java:如何防止EntityResolver中的&#39;systemId&#39;#resolveEntity(String publicId,String systemId)从绝对化到当前工作目录 - Java: How to prevent 'systemId' in EntityResolver#resolveEntity(String publicId, String systemId) from being absolutized to current working directory 如何读取空格之间的整数? - How to read integers between white spaces? 扫描较大的文本,并在行与行之间留空格 - Scanning a larger text with white spaces between lines 页面显示单词和行之间没有输入或空白 - Page shows no enters or white spaces between words and lines 字符串中单词之间多余的空格的正则表达式条件 - Regex condition for extra white spaces between words in a string 正则表达式在字符串之间以及空格之间获取字符串 - Regex get string after string and between white spaces
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM