xsi

Deserialize XML with multiple types

谁都会走 提交于 2020-01-15 09:48:28
问题 I'm trying to deserialize XML where some same name tags have different xsi types: <user-defined-data-row> <field name="entity"> <field-value xsi:type="field-text-valueType"> <value>Test</value> </field-value> </field> <field name="expiry_date"> <field-value xsi:type="field-date-valueType"> <value>2001-10-07</value> </field-value> </field> </user-defined-data-row> This is easily achieved by deserializing the xml into this model: [XmlRoot(ElementName = "field-value", Namespace = "http://www

XMLSerializer warns about unknown nodes/attributes when deserializing derived types

眉间皱痕 提交于 2020-01-13 20:40:14
问题 I recently registered event handlers for unknown nodes, elements and attributes with the XMLSerializer I use to deserialize complex types from a type hierarchy. I did this because some of the XML I receive is from third parties; I am interested in data format changes which could cause trouble on my end. In the XML the XMLSerializer produces it uses the standard XML attribute xsi:type="somederivedtypename" to identify the actual derived type represented by an XML element. I was surprised to

Remove xsi:type, xmlns:xs, and xmlns:xsi from JAXB Generics

末鹿安然 提交于 2019-12-19 19:52:36
问题 When using JAXB, I'd like to remove the excess namespaces/types from my XML elements when using Generics. How can I do this or what am I doing wrong? I'd like to use Generics so that I only have to write a block of code once. Example code: public static void main(String[] args) { try { TestRoot root = new TestRoot(); root.name.value = "bobby"; root.age.value = 102; root.color.value = "blue"; JAXBContext context = JAXBContext.newInstance(root.getClass()); Marshaller marsh = context

Can I test if a file descriptor is of the right type for read()?

 ̄綄美尐妖づ 提交于 2019-12-11 02:29:56
问题 There are plenty of fds that can't be read from (for example, a listening socket). How do I test whether a read (2) on the fd will return EINVAL , without risking taking data out? Things that don't work: We could do a read() with a zero-byte buffer passed. This is ruled out though: Implementations are allowed, but not required, to perform error checking for read() requests of zero bytes. [From POSIX 1003.1-2008] We might be tempted to call select() on the descriptor. Unfortunately, select()

What is the difference between xsd and xsi?

假如想象 提交于 2019-12-04 07:52:27
问题 What exactly is the difference between XML Schema Document and XML Schema Instance ? xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Please elaborate. 回答1: xsd and xsi Similarities Both are XML namespace prefixes, abbreviations for an XML namespace. Both are, as are all namespace prefixes, arbitrarily named; other namespace prefix abbreviations could equally well be used. However, both prefixes are conventional and therefore recommended. (An

What is the difference between xsd and xsi?

时间秒杀一切 提交于 2019-12-02 18:12:23
What exactly is the difference between XML Schema Document and XML Schema Instance ? xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Please elaborate. kjhughes xsd and xsi Similarities Both are XML namespace prefixes , abbreviations for an XML namespace . Both are, as are all namespace prefixes, arbitrarily named; other namespace prefix abbreviations could equally well be used. However, both prefixes are conventional and therefore recommended. (An also-conventional alternative to xsd is xs .) xsd and xsi Differences The xsd (or xs ) prefix

What's the difference between <a_element /> and <a_element xsi:nil=“true” />?

六眼飞鱼酱① 提交于 2019-11-30 08:05:40
do you know if there's a difference between these tags on XML/XSD? <a_element /> and <a_element xsi:nil="true"/> e.g: <SpreadCurve> <Index>3M</Index> <IndexNumber>4587</IndexNumber> <BusinessArea xsi:nil="true" /> </SpreadCurve> and <SpreadCurve> <Index>3M</Index> <IndexNumber>4587</IndexNumber> <BusinessArea /> </SpreadCurve> Are these equivalent ? If I have a XSD element: <xsd:element name="BusinessArea" type="xsd:string"/> this means that it is by default xsi:nil="false". And this means it will not accept a null value for this element. My doubt is, will it accept this one? <BusinessArea />

How to Reference Local XSD File By Relative Path

Deadly 提交于 2019-11-29 11:37:00
This is a follow up on How to Configure Eclipse to Work with `ehcache` and there is an example of absolute path in How to reference a local XML Schema file correctly? Since the xsd file is not longer being hosted, I downloaded a copy of it from the archive. I've put the file in my resource directory and would like to reference it in my xsi:schemaLocation from a relative path of my project. We have both windows and mac developers, so an absolute path convention like file:///c:/project/foo won't work. Another alternative to relative path would be if there is a way to reference system properties

What's the difference between <a_element /> and <a_element xsi:nil=“true” />?

点点圈 提交于 2019-11-29 11:04:55
问题 do you know if there's a difference between these tags on XML/XSD? <a_element /> and <a_element xsi:nil="true"/> e.g: <SpreadCurve> <Index>3M</Index> <IndexNumber>4587</IndexNumber> <BusinessArea xsi:nil="true" /> </SpreadCurve> and <SpreadCurve> <Index>3M</Index> <IndexNumber>4587</IndexNumber> <BusinessArea /> </SpreadCurve> Are these equivalent ? If I have a XSD element: <xsd:element name="BusinessArea" type="xsd:string"/> this means that it is by default xsi:nil="false". And this means it

How to Reference Local XSD File By Relative Path

▼魔方 西西 提交于 2019-11-28 05:04:03
问题 This is a follow up on How to Configure Eclipse to Work with `ehcache` and there is an example of absolute path in How to reference a local XML Schema file correctly? Since the xsd file is not longer being hosted, I downloaded a copy of it from the archive. I've put the file in my resource directory and would like to reference it in my xsi:schemaLocation from a relative path of my project. We have both windows and mac developers, so an absolute path convention like file:///c:/project/foo won