xml-nil

Selecting null value from XML in SQL Server

限于喜欢 提交于 2019-12-12 08:28:34
问题 I'm trying to select from XML that has a null as one of the attributes. Instead of returning a null, it returns a 0. What am I doing wrong? See code below to replicate: declare @a xml select @a = '<TestSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instace"> <Element> <Property1>1</Property1> <Property2>1</Property2> </Element> <Element> <Property1 xsi:nil="true" /> <Property2>2</Property2> </Element> <Element> <Property1>3</Property1> <Property2>3</Property2> </Element> </TestSet>' select

Soap WSDL with Null

本秂侑毒 提交于 2019-12-10 15:56:48
问题 I need to specify a parameter in a function which is nullable. This doesn't work: <message name="SaveRequest"> <part name="serialNumber" nillable="true" type="xsd:int"/> </message> 回答1: <serialNumber xsi:nil="true" /> See w3.org XML Schema 来源: https://stackoverflow.com/questions/2540507/soap-wsdl-with-null

Creating an XML element with xsi:nil and attributes in .Net/Jaxb

巧了我就是萌 提交于 2019-12-10 15:47:05
问题 I have an XML Schema that says: <xs:element name="employerOrganization" nillable="true" minOccurs="1" maxOccurs="1"> <xs:complexType> <xs:sequence> ... </xs:sequence> <xs:attribute name="classCode" type="EntityClassOrganization" use="required"/> <xs:attribute name="determinerCode" type="EntityDeterminerSpecific" use="required"/> </xs:complexType> </xs:element> That means I must be able to create an instance that looks like this: <employerOrganization classCode="ORG" determinerCode="INSTANCE"

Convert nil=“true” to null during unmarshal operation

限于喜欢 提交于 2019-12-05 19:36:06
I am receiving XML from a server whose schema specifies nearly every element as: <xs:element name="myStringElementName" type="xs:string" nillable="true" minOccurs="0"/> <xs:element name="myIntElementName" type="xs:int" nillable="true" minOccurs="0"/> I'm trying to find a clean way to convert every element that I receive that is marked as xsi:nil="true" to a null when it is unmarshalled into a JAXB object. So something like this: <myIntElementName xsi:nil="true" /> Should result in my JAXB object having a myIntElementName property with a value of null, rather than a JAXBElement object with a

c# xml serialization doesn't write null

跟風遠走 提交于 2019-12-04 09:50:49
when I serialize a c# object with a nullable DateTime in it, is there a way to leave the null value out of the xml file instead of having <EndDate d2p1:nil="true" xmlns:d2p1="http://www.w3.org/2001/XMLSchema-instance" /> You can use the Specified extended property to leave out null values (or any other value, for that matter). Basically, create another property with the same name as the serialized property with the word Specified added to the end as a boolean. If the Specified property is true , then the property it is controlling is serialized. Otherwise, if it is false , the other property

Selecting null value from XML in SQL Server

狂风中的少年 提交于 2019-12-04 02:52:27
I'm trying to select from XML that has a null as one of the attributes. Instead of returning a null, it returns a 0. What am I doing wrong? See code below to replicate: declare @a xml select @a = '<TestSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instace"> <Element> <Property1>1</Property1> <Property2>1</Property2> </Element> <Element> <Property1 xsi:nil="true" /> <Property2>2</Property2> </Element> <Element> <Property1>3</Property1> <Property2>3</Property2> </Element> </TestSet>' select ParamValues.TaskChainerTask.query('Property1').value('.','int') as Property1, ParamValues

Jaxb marshaller always writes xsi:nil (even when @XmlElement(required=false, nillable=true))

我怕爱的太早我们不能终老 提交于 2019-11-30 08:12:27
问题 I have a java property annotated with @XmlElement(required=false, nillable=true) . When the object is marshalled to xml, it is always outputted with the xsi:nil="true" attribute. Is there a jaxbcontext/marshaller option to direct the marshaller not to write the element, rather than write it with xsi:nil ? I've looked for answers to this and also had a look at the code, afaics, it will always write xsi:nil if nillable = true . Am I missing something? 回答1: If the property is annotated with

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 />

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

Jaxb marshaller always writes xsi:nil (even when @XmlElement(required=false, nillable=true))

▼魔方 西西 提交于 2019-11-29 06:22:01
I have a java property annotated with @XmlElement(required=false, nillable=true) . When the object is marshalled to xml, it is always outputted with the xsi:nil="true" attribute. Is there a jaxbcontext/marshaller option to direct the marshaller not to write the element, rather than write it with xsi:nil ? I've looked for answers to this and also had a look at the code, afaics, it will always write xsi:nil if nillable = true . Am I missing something? If the property is annotated with @XmlElement(required=false, nillable=true) and the value is null it will be written out with xsi:nil="true" . If