标签: xsd

任何从XML实例文档生成XSD架构的工具?

我正在寻找一个工具,它将采用XML实例文档并输出相应的XSD架构.

我当然认识到,与手工创建模式相比,生成的XSD模式将受到限制(它可能不会处理可选或重复元素或数据约束),但它至少可以作为一个快速起点.

xml xsd

146
推荐指数
8
解决办法
18万
查看次数

如何可视化XML模式?

我已经制作了一个XML Schema - 基本上都是代码 - 并且想知道代码是否可以生成这样的代码:

在此输入图像描述

如果是这样我该怎么办?

xml xsd

133
推荐指数
10
解决办法
18万
查看次数

XML Schema:包含仅包含文本的属性的元素?

我很难找到这个.如何在XML模式文件中为XML定义一个如下所示的元素:

<option value="test">sometext</option>
Run Code Online (Sandbox Code Playgroud)

我无法弄清楚如何定义一个类型的元素,xs:string也有一个属性.

这是我到目前为止所得到的:

<xs:element name="option">
    <xs:complexType>
        <xs:attribute name="value" type="xs:string" />
    </xs:complexType>
</xs:element>
Run Code Online (Sandbox Code Playgroud)

xml xsd

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

xsi:schemaLocation的用途是什么?

我看到我们有多个url作为此属性的值,如spring:

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
Run Code Online (Sandbox Code Playgroud)

为什么需要它以及它用于什么?Spring会进入网址并验证吗?xmlns和xsi:schemaLocation有什么区别?

xsd

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

从.XSD文件生成Java类......?

我有一个巨大的QuickBooks SDK .XSD模式文件,它定义了我可以从QuickBooks发送/接收的XML请求/响应.

我希望能够从这些.XSD文件轻松生成Java类,然后我可以使用它来将XML编组为Java对象,将Java对象编组为XML.

是否有捷径可寻...?

理想情况下,在运行时不需要基本Java发行版外部的任何库.但我很灵活......

java xml xsd

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

XSD:xs:integer和xs:int之间有什么区别?

我已经开始创建XSD和几个例子为发现xs:integerxs:int.

xs:integer和之间有什么区别xs:int?什么时候应该用xs:integer?什么时候应该用xs:int

xsd

108
推荐指数
3
解决办法
9万
查看次数

使用Notepad ++根据XSD验证XML

有人可以解释如何使用Notepad ++来针对xsd验证xml文件."XML工具"插件下拉列表中没有提供指定XSD文件的选项.XML插件在plugins子目录中正确安装,3个DLL被复制到Notepad ++ EXE子目录.其他XML"验证"功能可以工作,但无法验证XSD.

xml xsd notepad++

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

XML和XSD有什么区别?

可扩展标记语言(XML)和XML Schema(XSD)之间有什么区别?

xml xsd

104
推荐指数
5
解决办法
12万
查看次数

XSD - 如何允许任何次序的元素?

我正在尝试创建一个XSD,并尝试使用以下要求编写定义:

  • 允许指定的子元素出现任意次数(0到无界)
  • 允许子元素按任何顺序排列

我环顾四周,发现像各种解决方案这样:

<xs:element name="foo">
  <xsl:complexType>
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element name="child1" type="xs:int"/>
      <xs:element name="child2" type="xs:string"/>
    </xs:choice>
  </xs:complexType>
</xs:element>
Run Code Online (Sandbox Code Playgroud)

但据我所知xs:choice仍然只允许单个元素选择.因此,将MaxOccurs设置为无界限应该只意味着子元素中的"任何一个"可以多次出现.这准确吗?

如果上述解决方案不正确,我怎样才能实现我在上述要求中所说的内容?

编辑:如果要求如下,该怎么办?

  • 元素child1 child2可以出现任意次数(0到无界)
  • 元素以任何顺序排列
  • 元素child3和child4应该只出现一次.

例如,此xml有效:

<foo>
<child1> value </child1>
<child1> value </child1>
<child3> value </child3>
<child2> value </child2>
<child4> value </child4>
<child1> value </child1>
</foo>
Run Code Online (Sandbox Code Playgroud)

但这不是(缺少孩子3)

<foo>
<child1> value </child1>
<child1> value </child1>
<child2> value </child2>
<child4> value </child4>
<child1> value </child1>
</foo>
Run Code Online (Sandbox Code Playgroud)

xml xsd

102
推荐指数
4
解决办法
10万
查看次数

没有互联网连接时,Spring schemaLocation失败

我使用的是Spring,application-context.xml我有以下定义:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:util="http://www.springframework.org/schema/util"
   xmlns:context="http://www.springframework.org/schema/context"
   xmlns:aop="http://www.springframework.org/schema/aop"
   xmlns:tx="http://www.springframework.org/schema/tx"
   xmlns:p="http://www.springframework.org/schema/p"
   xmlns:security="http://www.springframework.org/schema/security"
   xsi:schemaLocation="
   http://www.springframework.org/schema/beans 
   http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
   http://www.springframework.org/schema/util 
   http://www.springframework.org/schema/util/spring-util-2.0.xsd
   http://www.springframework.org/schema/context
   http://www.springframework.org/schema/context/spring-context-2.1.xsd
   http://www.springframework.org/schema/tx
   http://www.springframework.org/schema/tx/spring-tx.xsd
   http://www.springframework.org/schema/aop
   http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
   http://www.springframework.org/schema/security
   http://www.springframework.org/schema/security/spring-security-2.0.xsd"
   >
Run Code Online (Sandbox Code Playgroud)

.....

当我的互联网连接丢失时,我无法通过tomcat或jetty运行我的应用程序.

它给:

[main] WARN  org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Ignored XML validation warning
org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document '/spring-beans-2.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.warning(ErrorHandlerWrapper.java:96)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:380)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318) …
Run Code Online (Sandbox Code Playgroud)

java xml spring xsd

101
推荐指数
5
解决办法
16万
查看次数

标签 统计

xsd ×10

xml ×8

java ×2

notepad++ ×1

spring ×1