xml-attribute

XSLT - How to select XML Attribute by Attribute?

删除回忆录丶 提交于 2019-11-28 22:25:54
问题 this is the structure of my source xml: <root> <DataSet Value="A"> <Data Value1="1" Value2="anythingA1" /> <Data Value1="2" Value2="anythingA2" /> <Data Value1="3" Value2="anythingA3" /> <Data Value1="4" Value2="anythingA4" /> <Data Value1="5" Value2="anythingA5" /> </DataSet> </root> from which I like to create some variables e.g. from all with Value1="2" and all with Value1="5" should result myVar1 with anythingA2 and myVar2 with anythingA5 My approch looks like this <xsl:variable name=

Extracting Attributes from XML Fields in SQL Server 2008 Table

好久不见. 提交于 2019-11-28 17:30:38
I have a table with several columns, one of which is a xml column. I do not have a namespace to use in the query. The XML data is always the same structure for all records. Contrived Data create table #temp (id int, name varchar(32), xml_data xml) insert into #temp values (1, 'one', '<data><info x="42" y="99">Red</info></data>'), (2, 'two', '<data><info x="27" y="72">Blue</info></data>'), (3, 'three', '<data><info x="16" y="51">Green</info></data>'), (4, 'four', '<data><info x="12" y="37">Yellow</info></data>') Desired Results Name Info.x Info.y Info ----- ------- ------- ------- one 42 99 Red

Swift parsing attribute name for given elementName

强颜欢笑 提交于 2019-11-28 14:43:43
Here is a part of my URL <cities> <country name="Абхазия"> <city id="37188" region="27028" head="" type="3" country="Абхазия" part="" resort="" climate="">Новый Афон</city> <city id="37178" region="10282" head="" type="3" country="Абхазия" part="" resort="" climate="">Пицунда</city> <city id="37187" region="37187" head="" type="3" country="Абхазия" part="" resort="" climate="">Гудаута</city> <city id="37172" region="10280" head="" type="3" country="Абхазия" part="" resort="" climate="">Гагра</city> <city id="37189" region="10281" head="0" type="3" country="Абхазия" part="" resort="0" climate="

How do I remove a specific node using its attribute value in PHP XML Dom?

倖福魔咒の 提交于 2019-11-28 14:25:57
My question is best phrase as: Remove a child with a specific attribute, in SimpleXML for PHP except I'm not using simpleXML. I'm new to XML for PHP so I may not be doing the best way I have a xml created using the $dom->save($xml) for each individual user. (not placing all in one xml due to undisclosed reasons) It gives me that xml declaration <?xml version="1.0"?> (no idea how to make it to others, but that's not the point, hopefully) <?xml version="1.0"?> <details> <person>name</person> <data1>some data</data1> <data2>some data</data2> <data3>some data</data3> <category id="0">

With SAX Parser, get an attribute's value

二次信任 提交于 2019-11-28 13:18:18
I am parsing XML from the web using Android. The code below shows a sample of the XML. The problem I'm having is I can't get the string value of the item tag. When I use name = attributes.getQName(i); it outputs the name, not the value of the attribute. <weatherdata> <timetags> <item name="date"> <value>20/04/2012</value> <unit/> <image/> <class>dynamic</class> <description>The current date</description> </item> use attributes.getValue(i); instead of attributes.getQName(i); because as doc says : getQName : Return an attribute's qualified (prefixed) name. getValue : Look up an attribute's value

How to specify the order of XmlAttributes, using XmlSerializer

喜欢而已 提交于 2019-11-28 07:33:45
问题 XmlElement has an "Order" attribute which you can use to specify the precise order of your properties (in relation to each other anyway) when serializing using XmlSerializer. public class bookingList { [XmlElement(Order = 1)] public string error { get; set; } [XmlElement(Order = 2)] public int counter { get; set; } [XmlElement(ElementName = "booking", Order = 3)] public List<booking> bookings = new List<booking>(); } Is there a similar thing for XmlAttribute ? I just want to set the order of

How do I include &, <, > etc in XML attribute values

荒凉一梦 提交于 2019-11-27 23:25:06
I want to create an XML file which will be used to store the structure of a Java program. I am able to successfully parse the Java program and create the tags as required. The problem arises when I try to include the source code inside my tags, since Java source code may use a vast number of entity reference and reserved characters like & , < , > , & . I am not able to create a valid XML. My XML should go like this: <?xml version="1.0"?> <prg name="prg_name"> <class name= "class_name> <parent>parent class</parent> <interface>Interface name</interface> . . . <method name= "method_name">

how to get the attribute value of an xml node using java

吃可爱长大的小学妹 提交于 2019-11-27 22:49:30
I've an xml which looks like this: { <xml><ep><source type="xml">...</source><source type="text">..</source></ep></xml>} here i wanna retrieve the value of "source type" where type s an attribute. I 'd tried like this,But its not working: DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); try { DocumentBuilder builder = domFactory.newDocumentBuilder(); Document dDoc = builder.parse("D:/workspace1/ereader/src/main/webapp/configurations/config.xml"); System.out.println(dDoc); XPath xPath = XPathFactory.newInstance().newXPath(); Node node = (Node) xPath.evaluate("//xml

Is an xml attribute without a value, valid?

隐身守侯 提交于 2019-11-27 22:39:18
I want to have an XML attribute without any value, which simply has one meaning when it exists or does not exist. Is that valid? An attribute must be specified with the following syntax: Name Eq AttValue where Name is a legal XML name , Eq is = optionally preceded or followed by whitespace , and AttValue is a legal attribute value . This definition is true for both XML 1.0 and XML 1.1 . If you are trying to specify an attribute as below: <car owned/> then no, that is not valid. If you are trying to specify it this way: <car owned=""/> then yes, that is valid. No. Boolean attributes in XML are

How can I make @XmlAttribute in a special order by using JAXB?

馋奶兔 提交于 2019-11-27 18:22:31
问题 I have XML file which needs 3 attributes in an element. How can make the order of street, zip and city attribute as I wanted? <address street="Big Street" zip="2012" city="Austin"> </address> @XmlType(name="Street) @XmlRootElement(name = "Street") public class Street { @XmlAttribute private String name; @XmlAttribute private String type; ... set and get method } 回答1: You can use @XmlAccessorOrder(has predefined values) or @XmlType(Only works for properties) to govern the ordering. Samples