首页 \ 问答 \ 大型模式文件的xml架构验证(xml schema validation for large schema files)

大型模式文件的xml架构验证(xml schema validation for large schema files)

我正在尝试使用xmllint来验证架构,我相信它使用下面的libxml2库。

问题是我有一个大约10MB的异常大的模式文件。 我这样做的时候:

xmllint --schema j9.xsd --noout jsample.xml

我收到以下错误:

j9.xsd:65535: element annotation: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}complexType': The content is not valid. Expected is (annotation?, (simpleContent | complexContent | ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?)))).
j9.xsd:65535: element annotation: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}complexType': The content is not valid. Expected is (annotation?, (simpleContent | complexContent | ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?)))).

.....这种情况一直持续下去。 显然错误的行号不应该是65535,如果有错误的话。 我想知道是否有其他库没有此限制,或者如果有人知道如何解决此错误。 谢谢!


I'm trying to use xmllint to validate the schema, which I believe uses the libxml2 library underneath.

The problem is I have a unusually large schema file in about 10MB. When I do this:

xmllint --schema j9.xsd --noout jsample.xml

I got the following errors:

j9.xsd:65535: element annotation: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}complexType': The content is not valid. Expected is (annotation?, (simpleContent | complexContent | ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?)))).
j9.xsd:65535: element annotation: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}complexType': The content is not valid. Expected is (annotation?, (simpleContent | complexContent | ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?)))).

..... This goes on and on. Apparently the line number of error should NOT be 65535, if there is an error. I'm wondering if there is another library that do not have this limitation, or if someone knows how to fix this bug. Thanks!


原文:https://stackoverflow.com/questions/2410806
更新时间:2023-11-22 21:11

最满意答案

你是什​​么意思,你有屏幕上的所有组件,你必须在一分钟内一次ping每个组件?

如果您认为您的应用是平安的,那么会检查网址的时间响应,然后您可以尝试使用此代码进行操作:

var ldr:URLLoader = new URLLoader();
ldr.addEventListener(HTTPStatusEvent.HTTP_STATUS, ldrStatus);

var url:String = "URL-TO-SITE";
var limit:int = 10;

var time_start:Number;
var time_stop:Number;
var times:int;

ping();

function ping():void
{
    trace("pinging", url);

    times = 0;
    doThePing();
}

function doThePing():void
{
    time_start = getTimer();
    ldr.load(new URLRequest(url));
}

function ldrStatus(evt:*):void
{
    if(evt.status == 200)
    {
        time_stop = getTimer();
        trace("got response in", time_stop - time_start, "ms");
    }

    times++;
    if(times < limit) doThePing();
}

这没什么特别的, URLLoader尝试加载url,并监听响应。 如果status200 ,那么获得了成功的“ping”。 或者乒乓球。

另一方面,您可以随时运行服务器端的ping程序,并使用flash进行控制。

如果你的意思是一个应用程序,比如上传下载速度测试程序,它也是以类似的方式开始的,而不是使用Loader对象。

希望这可以帮助。

编辑:

防止缓存问题,您可以使用:

ldr.load(new URLRequest(url + "?rnd="+Math.random()));

现在,此页面可能不会返回网站的确切内容,但可能足以估计响应时间。 用闪光灯。

总的来说,这可以清除缓存并每次加载站点以提供更好的结果。


What do you mean by you have all the components on the screen and you have to ping every component once in a minute?

If by ping you mean an app, what checks the time-response of a url, then you can try to play with this code:

var ldr:URLLoader = new URLLoader();
ldr.addEventListener(HTTPStatusEvent.HTTP_STATUS, ldrStatus);

var url:String = "URL-TO-SITE";
var limit:int = 10;

var time_start:Number;
var time_stop:Number;
var times:int;

ping();

function ping():void
{
    trace("pinging", url);

    times = 0;
    doThePing();
}

function doThePing():void
{
    time_start = getTimer();
    ldr.load(new URLRequest(url));
}

function ldrStatus(evt:*):void
{
    if(evt.status == 200)
    {
        time_stop = getTimer();
        trace("got response in", time_stop - time_start, "ms");
    }

    times++;
    if(times < limit) doThePing();
}

This is nothing special, the URLLoader tries to load the url, and listens to the response. If the status is 200, then got a successful "ping". Or pong.

On the other hand, you can always run a server-side ping program, and control that with flash.

If you mean an app, like an upload-download-speedtester, that also starts with something like this, but rather with the Loader object.

Hope this helps.

EDIT:

Preventing cache problems, you can use:

ldr.load(new URLRequest(url + "?rnd="+Math.random()));

Now, this page might not give back the exact content of a site, but might be good enough to estimate the response time. With flash.

So overall, this could clear the cache and load the site everytime to give a better result.

相关问答

更多

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。