简体   繁体   English

针对.xsd文件验证.xml的XML错误

[英]XML error validating .xml against .xsd file

each time I run my app engine application in the devserver locally the appengine-application.xml file seems to be automatically re-generating. 每次我在本地devserver中运行我的App Engine应用程序时,appengine-application.xml文件似乎都会自动重新生成。 Each time it reverts back to a version with a simple syntax error. 每次它还原到带有简单语法错误的版本。

Question: where is the file regenerated/copied from? 问题:从何处重新生成/复制文件? How do I edit it and cause the changes to persist? 如何编辑它并使更改保持不变?

There is an opening < missing at the beginning of this file. 在此文件的开头缺少开头<。 I have done the following to attempt to edit and save the file:used terminal commands vi- vim- and nano as an admin and a root user, as well as xcode and a plain text editor. 我已经做了以下尝试来编辑和保存文件:使用终端命令vivim和nano作为管理员和root用户,以及xcode和纯文本编辑器。

here is the file with the error, appengine-application.xml ( missing and oppening '<' before '?xml version="1.0 encoding=...'). 这是带有错误appengine-application.xml的文件(缺少并在'?xml version =“ 1.0 encoding = ...'之前添加'<')。

file path:../guestbook/guestbook-ear/target/guestbook-ear-1.0-SNAPSHOT/META-INF/appengine-application.xml 文件路径:../ guestbook / guestbook-ear / target / guestbook-ear-1.0-SNAPSHOT / META-INF / appengine-application.xml

?xml version="1.0" encoding="utf-8" standalone="no"?>
<appengine-application xmlns="http://appengine.google.com/ns/1.0">
<application>single-loop-665 </application>
</appengine-application>

here is the appengine-application.xsd 这是appengine-application.xsd

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"     targetNamespace="http://appengine.google.com/ns/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="appengine-application" type="ns:appengine-applicationType" xmlns:ns="http://appengine.google.com/ns/1.0"/>
 <xs:complexType name="appengine-applicationType">
    <xs:all>
        <xs:element type="xs:string" name="application"/>
    </xs:all>
</xs:complexType>
</xs:schema>

this is the error: 这是错误:

[INFO] Caused by: com.google.apphosting.utils.config.AppEngineConfigException: XML error validating /Users/jamesjohnson/guestbook/guestbook-ear/target/guestbook-ear-1.0-SNAPSHOT/META-INF/appengine-application.xml against /Users/jamesjohnson/.m2/repository/com/google/appengine/appengine-java-sdk/1.9.8/appengine-java-sdk/appengine-java-sdk-1.9.8/docs/appengine-application.xsd [INFO]原因:com.google.apphosting.utils.config.AppEngineConfigException:验证/Users/jamesjohnson/guestbook/guestbook-ear/target/guestbook-ear-1.0-SNAPSHOT/META-INF/appengine-application的XML错误。针对/Users/jamesjohnson/.m2/repository/com/google/appengine/appengine-java-sdk/1.9.8/appengine-java-sdk/appengine-java-sdk-1.9.8/docs/appengine-application的xml。 XSD

Solved! 解决了!

so it appears as though there is a copy made of the app each time it is run. 因此,似乎每次运行时都有该应用程序的副本。 This means that all the xml files and everything else contained in the guestbook-war/src directory is copied into a file called appname-version-SNAPSHOT. 这意味着将guestbook-war / src目录中包含的所有xml文件和其他所有内容都复制到名为appname-version-SNAPSHOT的文件中。 It appears that the SNAPSHOT file is where the source code for the app is compiled and run from. 似乎SNAPSHOT文件是编译和运行应用程序源代码的位置。

In order for edits to persist you must edit the files contained in your 为了使修改持续进行,您必须编辑您的文件中包含的文件

appname-war/src/main 

directory. 目录。

The confusing part is that the error thrown will point you to the copy of the code located in the 令人困惑的是,抛出的错误将使您指向位于

appname-ear/target/appname-ear-1.0-SNAPSHOT/appname-war-1.0-SNAPSHOT.war appname-ear / target / appname-ear-1.0-SNAPSHOT / appname-war-1.0-SNAPSHOT.war

if you edit the code in these files it will have no significance at run time. 如果您在这些文件中编辑代码,则在运行时将没有任何意义。 These files are generated each time the app is run. 每次运行应用程序时都会生成这些文件。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM