小编kjh*_*hes的帖子

XPath // div [contains(text(),'string')]无法选择包含'string'的div

这是HTML代码:

<div>  <span></span>  Elangovan  </div>
Run Code Online (Sandbox Code Playgroud)

我想div根据其包含的文本编写一个XPath .我试过了

//div[contains(text(),'Elangovan')]
Run Code Online (Sandbox Code Playgroud)

但这不起作用.

html xpath

15
推荐指数
2
解决办法
2万
查看次数

使用XSD时xmllint验证错误"找不到DTD"

我正在尝试使用xmllint来检查我的工作,同时开发一个基本的XSD即XML Schema架构.但它给了我一个错误

验证失败:未找到DTD.

我究竟做错了什么?

我的xmllint命令:

xmllint --noout --valid --schema simple.xsd lucas-basic.xml
lucas-basic.xml:5: validity error : Validation failed: no DTD found !
        >
        ^
lucas-basic.xml validates
Run Code Online (Sandbox Code Playgroud)

测试XSD文件:

<?xml version = "1.0" encoding = "UTF-8"?>
<!--Generated by XML Authority. Conforms to w3c http://www.w3.org/2001/XMLSchema-->
<xsd:schema xmlns:xsd = "http://www.w3.org/2001/XMLSchema">
        <xsd:element name = "vehicles">
                <xsd:complexType>
                        <xsd:sequence>
                                <xsd:element name = "nickname" type = "xsd:string" maxOccurs = "unbounded"/>
                        </xsd:sequence>
                </xsd:complexType>
        </xsd:element>
Run Code Online (Sandbox Code Playgroud)

测试XML文件:

<?xml version="1.0"?>
<vehicles
                xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
                xsi:noNamespaceSchemaLocation = "http://lucas.ucs.ed.ac.uk/xml-schema/xmlns/simple.xsd"
        >
        <nickname>Bog Hopper</nickname>
        <nickname>Wee Beastie</nickname>
        <nickname>Count …
Run Code Online (Sandbox Code Playgroud)

xml xsd libxml2 xsd-validation xmllint

15
推荐指数
1
解决办法
2万
查看次数

小册子地图在bootstrap 3.0模式中没有正确显示

我有一个大问题.我想在模态中打开传单地图.但地图显示不正确.瓷砖没有加载.

这是脚本:

http://bootply.com/98730

<a href="#myModal" role="button" class="btn btn-primary" data-toggle="modal">Open Map</a>

<div id="myModal" class="modal">
<div class="modal-dialog">
  <div class="modal-content">
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
      <h4 class="modal-title">Map</h4>
    </div>
    <div class="modal-body">
      <div class="modal-body" id="map-canvas"></div>
    </div>
    <div class="modal-footer">
      <button type="button" class="btn" data-dismiss="modal" aria-hidden="true">OK</button>
    </div>
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

$.getScript('http://cdn.leafletjs.com/leaflet-0.7/leaflet.js',function(){

 /* map settings */
 var map = new L.Map('map-canvas');
 var cloudmade = new    L.TileLayer('http://{s}.tile.cloudmade.com/f1376bb0c116495e8cb9121360802fb0/997/256/{z}/{x} /{y}.png', {
 attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a>   contributors, Imagery © <a href="http://cloudmade.com">CloudMade</a>',
 maxZoom: 18
 });
 map.addLayer(cloudmade).setView(new L.LatLng(41.52, -71.09), 13);


 });
Run Code Online (Sandbox Code Playgroud)

任何帮助很多apreciated

modal-dialog twitter-bootstrap leaflet

14
推荐指数
3
解决办法
1万
查看次数

在 Typescript 中使用类作为类型时如何解决循环依赖?

我如何使用不会遇到循环依赖错误的打字稿?

尽管当代码编译为有效的 JS 时应该删除导入,但似乎还是发生了循环依赖错误。这是一个错误吗?

用户模型.ts

import { Post } from '../post-model'

export class User {
  Posts: Post[];
}
Run Code Online (Sandbox Code Playgroud)

后模型.ts

import { User } from '../user-model'

export class Post {
  User: User;
}
Run Code Online (Sandbox Code Playgroud)

我听说过两种可能的解决方案,但都不令我满意。

一是,新建一个与类匹配的接口: 导入typescript类型导致的循环依赖

我在 typegraphql 的文档中读到了一些内容: https ://typegraphql.com/docs/types-and-fields.html

他们在那里说:

为什么使用函数语法而不是简单的 { type: Rate } 配置对象?因为,通过使用函数语法我们解决了循环依赖的问题(例如Post <--> User),所以它被采用作为约定。如果您想保存一些击键,则可以使用简写语法 @Field(() => Rate),但对其他人来说可能不太可读。

我也没有找到任何选项来禁用打字稿中的循环依赖警告。

我正在 Nrwl/Angular 9.x 工作

circular-dependency typescript typescript-typings typegraphql

13
推荐指数
2
解决办法
7459
查看次数

允许任何内容的XML Schema(xsd:any)

我需要一个XML模式的例子,它将允许任何事物和一切.

这可能听起来很奇怪,但我需要调试我当前的架构.问题是我有一个复杂的对象,我在一个函数(我无法控制的DLL的一部分)和一个模式中使用,并且该函数返回XML.现在,该函数抛出异常,因为在使用模式进行验证时出现错误,但不应该有一个异常.所以,我想要一个空白模式,一个不会导致任何验证错误的模式,所以我可以看到该函数输出的XML.

我试图采用我当前的架构,并只保留xs:schema标签来创建一个空架构,但这显然不起作用.

xml xsd

12
推荐指数
1
解决办法
7289
查看次数

带有CSS的半椭圆形

我正在尝试在椭圆和半圆之间创建混合.

半圆可以在CSS中创建:

.halfCircle{
     height:45px;
     width:90px;
     border-radius: 90px 90px 0 0;
     -moz-border-radius: 90px 90px 0 0;
     -webkit-border-radius: 90px 90px 0 0;
     background:green;
}
Run Code Online (Sandbox Code Playgroud)

椭圆形可以像这样制作:

.oval { 
    background-color: #80C5A0;
    width: 400px;
    height: 200px;
    margin: 100px auto 0px;
    border-radius: 200px / 100px;
}
Run Code Online (Sandbox Code Playgroud)

但我怎样才能做出半椭圆形呢?到目前为止,这是我的尝试.发生的问题是我有平顶,在这里找到.谢谢!

html css css-shapes

11
推荐指数
2
解决办法
2万
查看次数

在移动设备上进行A/B测试有什么好的策略吗?

根据我所知,A/B测试框架用于处理网站.例如,您想知道"购买"按钮中的哪种蓝/红颜色会鼓励用户点击它.

由于用户界面的网站信息来自服务器,并且浏览器显示它,因此可以进行A/B测试.但是,由于移动应用程序的用户界面是本机和静态的,因此不可能以相同的方式实现A/B测试(如果我没有记错的话).

所以,我的问题是如何从数据库/服务一直到本机移动应用程序实现A/B测试框架.

任何建议将不胜感激.谢谢.

testing optimization mobile frameworks ab-testing

11
推荐指数
2
解决办法
2224
查看次数

对于xsd:any,processContents strict vs lax vs skip

master.xsd:

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.gworks.cn/waf_profile"
    xmlns:tns="http://www.gworks.cn/waf_profile" elementFormDefault="qualified">
    <element name="profile">
        <complexType>
            <sequence>
                <element name="aspect">
                    <complexType>
                        <sequence minOccurs="1" >
                            <any processContents="strict" />
                        </sequence>
                        <attribute name="id" type="string" use="required"></attribute>
                        <attribute name="class" type="string" use="required"></attribute>
                        <attribute name="desc" type="string" use="optional"></attribute>
                    </complexType>
                </element>
            </sequence>
            <attribute name="name" type="string" use="required"></attribute>
        </complexType>
    </element>
</schema>
Run Code Online (Sandbox Code Playgroud)

我是否可以针对此架构编写XML文件,如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<profile name="??" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://www.gworks.cn/waf_profile"
    xsi:schemaLocation="http://www.gworks.cn/waf_profile http://www.gworks.cn/waf_profile.xsd">
    <aspect id="security" class="cn.gworks.waf.config.SecurityConfig" desc="????">
        <security xsi:schemaLocation="http://www.gworks.cn/config_security http://www.gworks.cn/config_security.xsd">
            <authService impl="com.bgzchina.ccms.security.SSOAuthService" enabled="true">
                <certificate>
                    <field name="Token" isKey="true" />
                </certificate>
            </authService>
            <authService impl="com.bgzchina.ccms.security.NoAuthService" enabled="true">
                <certificate>
                    <field name="username" isKey="true" /> …
Run Code Online (Sandbox Code Playgroud)

xml xsd

11
推荐指数
1
解决办法
1万
查看次数

针对XML Schema(XSD)验证JSON

是否可以在Java中验证JSON和XSD?我有一个应用程序,我收到JSON响应,我想对现有的XSD进行验证.我的应用程序的另一部分使用XML,这就是为什么如果它们都可以对现有的XSD进行验证最简单的原因.

java xml json xsd xml-validation

10
推荐指数
1
解决办法
2万
查看次数

如何在xmlstarlet中声明XPath名称空间?

我是xmlstarlet的新手,所以希望这个答案很简单.

我正在编写一个脚本来从命令行修改Inkscape SVG文件.我选择了xmlstarlet工具.

在测试文件上测试命令语法后,我在真正的SVG文件上遇到了麻烦.我认为使用命名空间会让我失望.

示例文件:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->    
<svg
   xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:xlink="http://www.w3.org/1999/xlink"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   width="603"
   height="1000"
   viewBox="0 0 159.54375 264.58334"
   version="1.1"
   id="svg8"
   inkscape:version="0.92.1 r"
   sodipodi:docname="test.svg"
   inkscape:export-filename="/home/user/dev/inkscape/test/1.png"
   inkscape:export-xdpi="96"
   inkscape:export-ydpi="96">
  <defs
     id="defs2">
    <linearGradient
       inkscape:collect="always"
       id="linearGradient6204">
      <stop
         style="stop-color:#8f1a22;stop-opacity:1;"
         offset="0"
         id="stop6200" />
      <stop
         style="stop-color:#8f1a22;stop-opacity:0;"
         offset="1"
         id="stop6202" />
    </linearGradient>
  </defs>
</svg>
Run Code Online (Sandbox Code Playgroud)

我想换Gradient6204Gradient9999.

我写了这个命令,它不起作用(只返回原始文件).

xmlstarlet ed -u "/svg/defs/linearGradient[@id='linearGradient6204']/@id" -v 'linearGradient9999' text.txt
Run Code Online (Sandbox Code Playgroud)

我也再次尝试,添加名称空间与-N但没有运气.我发现如果删除该行:

xmlns="http://www.w3.org/2000/svg"
Run Code Online (Sandbox Code Playgroud)

从文件然后我上面写的命令工作.

以我描述的方式更新上面的SVG文件的正确语法是什么?

xml xpath svg xml-namespaces xmlstarlet

10
推荐指数
1
解决办法
1303
查看次数