xml-attribute

How to reference an attribute in xsd

南楼画角 提交于 2020-01-15 05:43:07
问题 I tried to define an attribute that could be referenced in subsequent element definitions. <xs:attribute name="ridref" type="xs:string"/> Later I use it like this: <xs:element name="coordRegRef"> <xs:complexType> <!--xs:attribute name="ridref" type="xs:string"/ this works but I want to use ref --> <xs:attribute ref="ridref" use="required"/> </xs:complexType> </xs:element> XSD compiles fine with xmllint xmllint --schema pc-ar.xsd pc-ar.xml But xmllint says pc-ar.xml:41: element coordRegRef:

How to reference an attribute in xsd

梦想的初衷 提交于 2020-01-15 05:43:07
问题 I tried to define an attribute that could be referenced in subsequent element definitions. <xs:attribute name="ridref" type="xs:string"/> Later I use it like this: <xs:element name="coordRegRef"> <xs:complexType> <!--xs:attribute name="ridref" type="xs:string"/ this works but I want to use ref --> <xs:attribute ref="ridref" use="required"/> </xs:complexType> </xs:element> XSD compiles fine with xmllint xmllint --schema pc-ar.xsd pc-ar.xml But xmllint says pc-ar.xml:41: element coordRegRef:

XML schema; multiple from a list of valid attribute values

吃可爱长大的小学妹 提交于 2020-01-01 10:52:16
问题 I'm reasonably new to working with XML schemas, so excuse my incompetence if this is more trivial than I myself believe it must be. I'm trying to create a required attribute that must contain 1 or more white-space-separated string values from a list. The list is the 4 typical HTTP request methods; get , post , put , and delete . So valid elements would include: <rule methods="get" /> <rule methods="get post" /> <rule methods="post put delete" /> Whereas invalid elements would include: <rule

XML schema; multiple from a list of valid attribute values

巧了我就是萌 提交于 2020-01-01 10:51:29
问题 I'm reasonably new to working with XML schemas, so excuse my incompetence if this is more trivial than I myself believe it must be. I'm trying to create a required attribute that must contain 1 or more white-space-separated string values from a list. The list is the 4 typical HTTP request methods; get , post , put , and delete . So valid elements would include: <rule methods="get" /> <rule methods="get post" /> <rule methods="post put delete" /> Whereas invalid elements would include: <rule

How to use XmlElementAttribute for List<T>?

淺唱寂寞╮ 提交于 2020-01-01 09:29:11
问题 I have a class like this: public class Level { [XmlAttribute] public string Guid { get; set; } } public class LevelList : List<Level> { } public class Test { public LevelList CalLevelList { get; set; } } Using XmlSerializer, I get the output like this: <CalLevelList> <Level Guid="0de98dfb-ce06-433f-aeae-786b6d920aa6"/> <Level Guid="0de98dfb-ce06-433f-aeae-786b6d920aa7"/> </CalLevelList> Which is technically correct. However, without changing the class names, I'd like to make the output look

Swift parsing attribute name for given elementName

一曲冷凌霜 提交于 2019-12-29 02:10:42
问题 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="">Гагра<

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

走远了吗. 提交于 2019-12-29 01:57:05
问题 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>

XML get attributes

孤街醉人 提交于 2019-12-24 19:17:06
问题 I saw lots of tutorials here in overflow, but I could not understand what I am missing.. So I need some help.. I have an XML which it is online and I am trying to parse it like this: <products> <product> <id>13389</id> <name><![CDATA[ product name ]]></name> <category id="14"><![CDATA[ Shoes > test1 ]]></category> <price>41.30</price> </products> As far, I am reading the XML and parsing it like this: $reader = new XMLReader(); $reader->open($product_xml_link); while($reader->read()) { if(

How can I get the WordPress language_attributes function to return valid XHTML 1.1?

二次信任 提交于 2019-12-24 07:35:56
问题 I have a WordPress template that contains the following element: <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes('xhtml'); ?>> This returns: <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" xml:lang="en-US"> Unfortunately the "lang" attribute is invalid XHTML 1.1 - and the client would like this level of validation. WordPress' general-template.php file contains the following code: if ( get_option('html_type') == 'text/html' || $doctype == 'html' )

How to add prefix in front of xml element using attribute in c#

假如想象 提交于 2019-12-24 01:57:22
问题 with the programming is this: As a result I want to have this: <rootprefix:rootname noPrefix="attribute with no prefix" firstprefix:attrOne="first atrribute" secondprefix:attrTwo="second atrribute with different prefix"> ...other elements... </rootprefix:rootname> The way to do this by coding is: NameTable nt = new NameTable(); nt.Add("key"); XmlNamespaceManager ns = new XmlNamespaceManager(nt); ns.AddNamespace("firstprefix", "fp"); ns.AddNamespace("secondprefix", "sp"); root.SetAttribute(