xsd

How to extend a complex type in a different namespace without changing name

人走茶凉 提交于 2021-02-18 07:08:59
问题 I have an existing namespace that I cannot change. I need to add elements to a complex type such that the resulting XML looks like this: Original XML: <?xml version="1.0"?> <Book xmlns="http://bookshop.com"> <Author>Frank Herbert</Author> <Title>Dune</Title> </Book> New XML: <?xml version="1.0"?> <Book xmlns="http://bookshop.com" xlmns:custom="http://custombookshop.com> <Author>Frank Herbert</Author> <Title>Dune</Title> <custom:Publisher>Ace</custom:Publisher> </Book> I have requirements that

In Java, how do I parse an xml schema (xsd) to learn what's valid at a given element?

天涯浪子 提交于 2021-02-17 22:42:13
问题 I'd like to be able to read in an XML schema (i.e. xsd) and from that know what are valid attributes, child elements, values as I walk through it. For example, let's say I have an xsd that this xml will validate against: <root> <element-a type="something"> <element-b>blah</element-b> <element-c>blahblah</element-c> </element-a> </root> I've tinkered with several libraries and I can confidently get <root> as the root element. Beyond that I'm lost. Given an element I need to know what child

In Java, how do I parse an xml schema (xsd) to learn what's valid at a given element?

时间秒杀一切 提交于 2021-02-17 22:42:02
问题 I'd like to be able to read in an XML schema (i.e. xsd) and from that know what are valid attributes, child elements, values as I walk through it. For example, let's say I have an xsd that this xml will validate against: <root> <element-a type="something"> <element-b>blah</element-b> <element-c>blahblah</element-c> </element-a> </root> I've tinkered with several libraries and I can confidently get <root> as the root element. Beyond that I'm lost. Given an element I need to know what child

wsimport Two declarations cause a collision

爷,独闯天下 提交于 2021-02-17 20:53:43
问题 I am trying to use wsimport on https://api.sendwordnow.com/webservices/v3/users.svc?wsdl. Here is the wsimport I am using. wsimport -B-XautoNameResolution -d C:\temp -extension -J-Djavax.xml.accessExternalSchema=all -J-Djavax.xml.accessExternalDTD=all -keep -verbose -XadditionalHeaders -Xnocompile https://api.sendwordnow.com/webservices/v3/users.svc?wsdl And here is the error. parsing WSDL... [WARNING] unknown extensibility element or attribute "EndpointReference" (in namespace "http://www.w3

wsimport Two declarations cause a collision

可紊 提交于 2021-02-17 20:52:31
问题 I am trying to use wsimport on https://api.sendwordnow.com/webservices/v3/users.svc?wsdl. Here is the wsimport I am using. wsimport -B-XautoNameResolution -d C:\temp -extension -J-Djavax.xml.accessExternalSchema=all -J-Djavax.xml.accessExternalDTD=all -keep -verbose -XadditionalHeaders -Xnocompile https://api.sendwordnow.com/webservices/v3/users.svc?wsdl And here is the error. parsing WSDL... [WARNING] unknown extensibility element or attribute "EndpointReference" (in namespace "http://www.w3

lxml include relative path

[亡魂溺海] 提交于 2021-02-17 02:07:32
问题 Using Python's lxml library, I'm trying to load a .xsd as schema. The Python script is in one directory and the schemas are in another: /root my_script.py /data /xsd schema_1.xsd schema_2.xsd The problem is that schema_1.xsd includes schema_2.xsd like this: <xsd:include schemaLocation="schema_2.xsd"/> Being schema_2.xsd a relative path (the two schemas are in the same directory), lxml doesn't find it and it rises and error: schema_root = etree.fromstring(open('data/xsd/schema_1.xsd').read()

lxml include relative path

我的未来我决定 提交于 2021-02-17 02:04:44
问题 Using Python's lxml library, I'm trying to load a .xsd as schema. The Python script is in one directory and the schemas are in another: /root my_script.py /data /xsd schema_1.xsd schema_2.xsd The problem is that schema_1.xsd includes schema_2.xsd like this: <xsd:include schemaLocation="schema_2.xsd"/> Being schema_2.xsd a relative path (the two schemas are in the same directory), lxml doesn't find it and it rises and error: schema_root = etree.fromstring(open('data/xsd/schema_1.xsd').read()

lxml include relative path

妖精的绣舞 提交于 2021-02-17 02:04:28
问题 Using Python's lxml library, I'm trying to load a .xsd as schema. The Python script is in one directory and the schemas are in another: /root my_script.py /data /xsd schema_1.xsd schema_2.xsd The problem is that schema_1.xsd includes schema_2.xsd like this: <xsd:include schemaLocation="schema_2.xsd"/> Being schema_2.xsd a relative path (the two schemas are in the same directory), lxml doesn't find it and it rises and error: schema_root = etree.fromstring(open('data/xsd/schema_1.xsd').read()

XSD (Xml Schema Definition)

对着背影说爱祢 提交于 2021-02-13 13:58:51
知识源自于世界,我只是一个传递者; 你帮我走过的路,我正在帮他走下去。 W3School有标准教程,网址: http://www.w3school.com.cn/schema/index.asp 下面,是本人的一些整理: ‍ 1.0、XML Schema(xsd) 是什么? ‍ XML Schema 语言也称作 XML Schema 定义(XML Schema Definition,XSD)。 实在不懂官方定义,可想成: xsd是交通法,xml是行人。 xsd(交通法)规定了红停绿行,xml(行人)需遵守xsd(交通法)的规定。 基本可以替代DTD。想要了解DTD,点击: http://www.w3school.com.cn/dtd/dtd_intro.asp ‍ 2.0、为什么要使用 XML Schema(xsd)? ‍ ‍ 你也可以不用,然后你会发现要么编译不过,要么编译过了,运行出错。 多数情况下的作用是一种校验。 例: 甲、乙公司交互,约定格式传参格式为 <password>password</password>。 甲方传<pwd>pwd</pwd>,如果没有xsd,等到交互时才发现失败。 如果有xsd,在编写程序时,就告诉你<pwd>pwd</pwd>是错的,不符合xsd规定。 ‍ ‍ 3.0、如何使用 XML Schema(xsd) ? ‍ 3.1、<schema>

XML schema - No matching global declaration available for the validation root

有些话、适合烂在心里 提交于 2021-02-11 10:24:59
问题 Im am trying to create an XML schema for the following XML document. https://www.nationalbanken.dk/_vti_bin/DN/DataService.svc/CurrencyRatesHistoryXML?lang=en Then I have installed installed the XML tools plugin to my Notepad++ and tried to validate the XML doc agains the schema. <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.ecb.int/vocabulary/2002-08-01/eurofxref" xmlns="http://www.ecb.int/vocabulary/2002-08-01