Jethrie-JDuprez in the news
Usenet Archive
- Joined
- Apr 14, 2009
- Messages
- 2
- Reaction score
- 0
Hello,
I have to support an application which among other things consumes XML documents. There is a requirement that may be unusual, although I haven't detected it soon enough for lack of XML expertise. I submitted my question to a developper forum, as the XML processing is written in Java, but I suspect the problem is not in any java library but may be that the requirement is not compliant with XML standards. Here it is:
We have a requirement to process incoming XML documents that may or may not have a namespace specified. That is, the textual specification explicitly says that incoming document may be of the following two forms:
<DeliveryReport xmlns="http://my.company.com/schema/ DeliveryReport.xsd" > <Item ref="xxx" quantity="25"/> <Item ref="yyy" quantity="12"/> </DeliveryReport>
<DeliveryReport>
<Item ref="xxx" quantity="25"/>
<Item ref="yyy" quantity="12"/>
</DeliveryReport>
As you can see, one of the form has a namespace specifier, while the other has no namespace.
I don't know how to translate this requirement into an XML Schema:
either I specify a targetnamespace attribute, or I don't. Either way, one of the forms of incoming documents will not pass the validation performed by the JAXB XML library.
The solution (I meant, ugly hack) so far was to intercept incoming docs and replace on-the-fly occurences of "<DeliveryReport>" for the qualified form.
Is there some way, in XSD syntax, to specify that the namespace is not mandatory in the XML documents?
Thank you in advance.
J.
I have to support an application which among other things consumes XML documents. There is a requirement that may be unusual, although I haven't detected it soon enough for lack of XML expertise. I submitted my question to a developper forum, as the XML processing is written in Java, but I suspect the problem is not in any java library but may be that the requirement is not compliant with XML standards. Here it is:
We have a requirement to process incoming XML documents that may or may not have a namespace specified. That is, the textual specification explicitly says that incoming document may be of the following two forms:
<DeliveryReport xmlns="http://my.company.com/schema/ DeliveryReport.xsd" > <Item ref="xxx" quantity="25"/> <Item ref="yyy" quantity="12"/> </DeliveryReport>
<DeliveryReport>
<Item ref="xxx" quantity="25"/>
<Item ref="yyy" quantity="12"/>
</DeliveryReport>
As you can see, one of the form has a namespace specifier, while the other has no namespace.
I don't know how to translate this requirement into an XML Schema:
either I specify a targetnamespace attribute, or I don't. Either way, one of the forms of incoming documents will not pass the validation performed by the JAXB XML library.
The solution (I meant, ugly hack) so far was to intercept incoming docs and replace on-the-fly occurences of "<DeliveryReport>" for the qualified form.
Is there some way, in XSD syntax, to specify that the namespace is not mandatory in the XML documents?
Thank you in advance.
J.