c#,xml,serialization,deserialization
Use the [XmlElement] attribute: [XmlElement(ElementName = "StyleProperties", Namespace="http://schemas.datacontract.org/2004/07/PPT_Styles_Tool")] public class StyleProperties { //... Also, if you use the XmlSerializer to serialize, then you should use the XmlSerializer to deserialize. Not the DataContractSerializer....
java,xml,rest,jackson,spring-boot
Try to add a @XmlRootElement(name="myRootTag") JAXB annotation with the tag you use as the root tag to the class MatchRequest. I have had similar issues when using both XML and JSON as transport format in a REST request, but using moxy instead of Jackson. In any case, proper JAXB annotations...
It is important to inspect the string returned by page.text and not just rely on the page source as returned by your Chrome browser. Web sites can return different content depending on the User-Agent, and moreover, GUI browsers such as your Chrome browser may change the content by executing JavaScript...
Using XSL 2.0 you can have multiple output documents and can define every file name, file content, etc. Default java support for XSL 2.0 is far from perfect, so I use the incredible Saxon (you can download saxon-he here, unzip it and add saxon9he.jar to your project). This is the...
You can switch rendering target version < 22. Try it once. You can install android versions from these steps as shown in screenshots. ...
If you are using them as meta-documents and they are sent to the parser, then converted as HTML and as long as the converted HTMLs do not have any irrelevant tags, it is fine! So, if the following code: <requirement> THE REQUIREMENT HERE </requirement> Gets converted into something like: <!--...
You need to add " around the value not single '. $XPost = "<MinPrice>{$_POST['first_name']}</MinPrice>"; with dobule quote you can do this $XPost = "<MinPrice>".$_POST["first_name"]."</MinPrice>"; Change your code like that. $strXml = '<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <SubmitLead...
Here is a basic example, it uses YQL to bypass CORS var pre = document.getElementById('out'), oReq = new XMLHttpRequest(), url = 'http://open.api.ebay.com/shopping?version=581&appid=EBAYU91VTR1SQ8H917BC11O3BW8U4J&action=getResults&callname=FindItemsAdvanced&QueryKeywords=Aston+Martin+V12+Vanquish&categoryId=220', yql = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent('select * from xml where url="' + url + '"') + '&format=xml&callback'; function updateProgress(oEvent) { if...
Use xmltable. Data setup: create table myt( col1 clob ); insert into myt values('<ServiceDetails> <FoodItemDetails> <FoodItem FoodItemID="6486" FoodItemName="CARROT" Quantity="2" Comments="" ServingQuantityID="142" ServingQuantityName="SMALL GLASS" FoodItemPrice="50" ItemDishPriceID="5336" CurrencyName="INR" CurrencyId="43"/> </FoodItemDetails> <BillOption> <BillDetails TotalPrice="22222" BillOption="cash"/> </BillOption> <Authoritativeness/> </ServiceDetails>' ); commit; Query:...
i haven't tried it .. but i think a leading '/' is missing here : <xsl:value-of select="root/generatorList/generator/E"/> try this please : <xsl:value-of select="/root/generatorList/generator/E"/> otherwise the xslt engine is trying to find a relative path "root/generatorList/generator/E" starting at the matched element (/root/fiberList/fiber) of the template but there is no /root/fiberList/fiber/root/generatorList/generator/E....
You're missing a set of parentheses (()) at the end of $XmlWriter.WriteEndElement: $xmlWriter.WriteStartElement("Disk$count") # Add tag for each drive $xmlWriter.WriteElementString("DriveLetter","$DriveLetter") # Write Drive Letter to XML $xmlWriter.WriteElementString("DriveSize","$DriveSize") # Write Drive Size to XML $xmlWriter.WriteElementString("DriveFreeSpace","$DriveFreeSpace") # Write Drive Free Space to XML $xmlWriter.WriteEndElement() # <-- Closing Drive Tag - don't forget...
XQuery does not know such macros, you could of course use any preprocessor to do such things. But I'd rather define a function for this: declare function local:outward($context as item()) { $context/ancestor-or-self::* }; Functions can also be applied in axis steps (remember to pass the current context .): let $xml...
c#,xml,xpath,xmldocument,xmlnodelist
If you're happy to convert it into LINQ to XML, it's really simple: XDocument original = ...; // However you load the original document // Separated out for clarity - could be inlined, of course string xpath = "//Person[not(PersonID = following::Person/PersonID)]" XDocument people = new XDocument( new XElement("Persons", original.XPathSelectElements(xpath) )...
you could use something like: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output method="text"/> <xsl:template match="/"> <xsl:text>UserNames: "</xsl:text> <xsl:value-of select="/Users/user/username" separator=";"/> <xsl:text>"
</xsl:text> <xsl:text>Names: "</xsl:text> <xsl:value-of select="/Users/user/name" separator=";"/>...
SQL Server does not implement the xPath function string-join, so you would need to adopt a two step process, the first would be to extract all the terms to rows using nodes(); SELECT n.value('.', 'VARCHAR(100)') AS parsedString FROM #temp AS t CROSS APPLY t.Response.nodes('/error/description2') r (n); Which gives you your...
I suppose you have your class MessageMapping.java which has in turn a list (or one? dunno) of message of type Message.java. Message.java in turn will be structured with a list of Field of type Field.java. The classes will be as follow: @XmlAccessorType(XmlAccessType.FIELD) public class Field { @XmlAttribute private String tag;...
<xsl:variable name="max_a_width"> <xsl:for-each select="data"> <xsl:sort select="string-length(@a)" data-type="number" /> <xsl:if test="position() = last()"> <xsl:value-of select="string-length(@a)" /> </xsl:if> </xsl:for-each> </xsl:variable> This is the general method of picking from an ordered list of derived values in XSLT 1.0. If you want to pick the minimum/maximum from actual (natively sortable) values, you can take...
XML tags are CaSe SenSitIve. complexType != complextype. You need to fix that throughout your schema - it's expecting to find <xs:complexType> but instead finding <xs:complextype>, which is not valid. It looks like you will have similar problems elsewhere - for example, simpleType, maxLength are other tags that have different...
To produce a valid output HTML document you just need to add exclude-result-prefixes="xsi xslFormatting" on the <ins:stylesheet> (root) element of your stylesheet. But indeed in your stylesheet you don't use the xsi and xslFormatting namespaces anywhere. Thus you could also modify your stylesheet by removing these namespaces declarations, leading you...
You're on the right track using <xs:whiteSpace> restriction, but the value should be preserve in order to not modify the original whitespace. You can use this pattern: [\w\d ]*[\w\d][\w\d ]* The central part ([\w\d]) says that a letter or a digit must appear. Before and after that compulsory alphanumeric character,...
In the link that I mentioned in the comment, you can find solutions using RCurl and httr package. Here, I provide the solution using rvest package. library(rvest) kk<-html("http://en.wikipedia.org/wiki/List_of_S%26P_500_companies")%>% html_table(fill=TRUE)%>% .[[1]] //table 1 only head(kk) Ticker symbol Security SEC filings GICS Sector GICS Sub Industry Address of Headquarters 1 MMM 3M...
One (unorthodox) way of doing it is like so: template1 = \ ''' <ParentTag> <orders orderid="%s"> <unitprice>%s</unitprice> <quantity>%s</quantity> </orders>%s </ParentTag> ''' template2 = \ ''' <details> <productid>%s</productid> <productname>%s</productname> </details> ''' Code: output = "" if (condition is met): output += output % template1(orderid, unitprice, quantity, "") else: output += template1...
xml,animation,sprite-sheet,roku,brightscript
Actually, you don't have to use XML files for sprite animations. Just be aware that frame's dimensions must be set. Follow the example bellow for a loading sprite with 128x128 dimensions and 12 frames: compositor = CreateObject("roCompositor") compositor.SetDrawTo(screen, &h80) compositor.NewAnimatedSprite(576, 296, GetLoadingSpriteRegions()) Function GetLoadingSpriteRegions() as Object arr = [] bitmap=createobject("robitmap","pkg:/images/loader_sprite.png")...
It's unclear to me what location is, but this sample: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output indent="yes"/> <xsl:template match="/"> <sample> <xsl:call-template name="interpret_text"> <xsl:with-param name="location" select="."/> </xsl:call-template> </sample> </xsl:template> <xsl:template name="interpret_text"> <xsl:param name="location"/> <xsl:for-each select="$location//text()"> <xsl:if...
Here is the solution: DECLARE @xml xml SELECT @xml = '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SOAP-ENV:Body> <webregdataResponse> <result>0</result> <regData /> <errorFlag>99</errorFlag> <errorResult>Not Processed</errorResult> </webregdataResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>' declare @table table...
Try to use css instead of xpath, this will work for you, doc = Nokogiri::XML(response.body) values = doc.css('Name').select{|name| name.text}.join',' puts values => Ram,Sam ...
Iterating through elements then through attributes seems not too hard to read : var xml = @"<?xml version='1.0' encoding='UTF-8'?> <root xmlns:test='urn:my-test-urn'> <Item name='Item one'> <test:AlternativeName>Another name</test:AlternativeName> <Price test:Currency='GBP'>124.00</Price> </Item> </root>"; var doc = XDocument.Parse(xml); XNamespace test = "urn:my-test-urn"; //get all elements in specific namespace and remove doc.Descendants() .Where(o => o.Name.Namespace...
You can use Apache FOP API and you need to write XSLT style for your output PDF. This API will help to convert your XML and XSLT stylesheet into PDF/PDF-A.
Look at this line of your stack trace: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mailSender' defined in class path resource [springConfig.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'int' for property 'port'; nested exception is java.lang.NumberFormatException: For input...
You can use javax.xml.stream.events.Comment.getText() to get the string data of a comment, or the empty string if it doesn't exist: ((javax.xml.stream.events.Comment) event).getText() ...
Sure you can. Even within the same Java program. Use Java HTTP Server. few lines of code and you have functional http server.
My guess is that you make a mistake while processing the result NodeList. Try the following approach: NodeList results = (NodeList) xpath.evaluate(..); for (int i = 0; i < nodelist.getLength(); i++) { Node node = (Node) nodelist.item(i); ... } ...
There are several issues with your approach. For example, instead of: <node><xsl:value-of select="node"/></node> which creates empty node elements (because your node elements are empty), you should be using something like: <node><xsl:copy-of select="@*"/></node> and instead of: <xsl:for-each select="/tag"> which selects nothing, because tag is not a child of the / root...
c#,xml,asp.net-mvc,asp.net-mvc-4
Sourced: from this link The web.config (or app.config) is a great place to store custom strings: in web.config: <appSettings> <add key="message" value="Hello, World!" /> </appSettings> in cs: string str = ConfigurationSettings.AppSettings["message"].toString(); ...
javascript,jquery,xml,jquery-mobile
EMI and CustomerName are elements under json so you can use .find() to find those elements and then text() to get its value. $(data).find("json").each(function (i, item) { var heures = $(item).find("CustomerName").text(); var nbr = $(item).find("EMI").text(); console.log(heures); }); .attr() is used to get the attribute value of an element like in...
You always have the option to create extension methods to find elements by local name. Whether you like it or not, you have to "use an if within the foreach," that's an ovherhead you'll have to accept. This implementation is in terms of LINQ but you could always write it...
Here's one way: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:strip-space elements="*"/> <!-- identity transform --> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="c"> <xsl:apply-templates/> </xsl:template> </xsl:stylesheet> Here's another:...
It sounds like your XML is coming straight from your database, which means you need to transform it into something else based on the structure you have presently. While you could learn XSLT, you could also do this using LINQ to XML, querying the document you have parsed in order...
c#,.net,xml,xml-parsing,xelement
As others have said, this format is truly horrible, and will break as soon as the XML embedded in the JSON will contain double quotes (because in the JSON they will be encoded as \", which will make the XML invalid). The JSON should really be embedded as CDATA. Now,...
simplexml_load_file() itself returns an object on success, not a string, while file_put_contents() as a second argument expects a string to be written. So you're trying to save an object instead of raw string. In this scenario you can simply do something like this: $xml = file_get_contents($signedUrl); $file = "c:/wamp/www/products.xml"; file_put_contents($file,...
Is "User Info" and "Course Data" is a different entity. If it is so, I think you may encapsulate them in one entity. XmlTextWriter writer = new XmlTextWriter(path, System.Text.Encoding.UTF8); writer.WriteStartDocument(true); writer.Formatting = Formatting.Indented; writer.Indentation = 4; writer.WriteStartElement("My Entity"); /* It is a biggest one*/ writer.WriteStartElement("User Info"); writer.WriteStartElement("Name"); writer.WriteString(userName); writer.WriteEndElement(); writer.WriteStartElement("Tutor...
You have 2 errors in your xml: First is nonmatching root tags. Second, more important, you are quering nodes('/Aprroval/Aprrove'), but inner tag is Approve not Aprrove. Fiddle http://sqlfiddle.com/#!3/66b08/3...
c#,xml,validation,datagridview,xsd
If the question is why can't the file be deleted, it is because the XmlReader has the file open - call read.Close() before trying to delete the file.
All you need is the identity template to copy existing nodes... <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> Then another template to ignore nodes that aren't lower-case. In XSLT 1.0 this can be done by using the translate statement, to translate uppercase letters to lowercase, and checking if the result...
c#,xml,csv,optimization,type-conversion
IEnumerable<string> values = new List<string>(); values = … Probably not going to be a big deal, but why create a new List<string>() just to throw it away. Replace this with either: IEnumerable<string> values; values = … If you need values defined in a previous scope, or else just: Enumerable<string> values...
Well //@* gives you all attribute nodes, add a predicate //@*[. = 'zzz'] and you have all attribute nodes with the value zzz.
Yep, you need to do the adding within the loop. I'd use a List<string> as it supports LINQ: XmlNodeList skillNameNodeList=SkillXML.GetElementsByTagName("name"); List<string> skills = new List<string>(); foreach (XmlNode skillNameNode in skillNameNodeList) { skills.Add(skillNameNode.Attributes["value"].Value); } ...
You can use xs:unique to constrain Reference_number to be unique: <?xml version="1.0" encoding="utf-8"?> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="Items"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" name="Item"> <xs:complexType> <xs:sequence> <xs:element name="Name" type="xs:string" /> <xs:element name="Reference_number" type="xs:string" />...
Would this XSLT do: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text" /> <xsl:strip-space elements="*"/> <xsl:template match="/*"> <xsl:apply-templates select=".//line"/> </xsl:template> <xsl:template match="line"> <xsl:variable name="pos" select="position() + (3 * count(preceding::data))"/> <xsl:value-of select="concat(format-number($pos, '00000 '), ., '
')"/> </xsl:template> <xsl:template...
Here is the solution: ClassPathResource classPathResource = new ClassPathResource("samples/form2/data/test.xml"); XMLInputFactory xmlInputFactory = XMLInputFactory.newFactory(); xmlInputFactory.setProperty(XMLInputFactory.IS_COALESCING, true); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(classPathResource.getInputStream()); JAXBContext jaxbContext = JAXBContext.newInstance(EntityRecordData.class); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); int eventType = xmlStreamReader.next();...
If it's the case that you want your script to build an XML packet as you've shown, there are a few issues. You're doing a lot of swapping of variables around, simply to convert them to strings - for the most part you can just use the Python string conversion...
If you're willing to give xml2 a go, you can get to begin in a few lines: library(xml2) library(magrittr) # get a vector doc <- read_xml("~/Dropbox/Data.xml") doc %>% xml_find_all("//d1:event/d1:begin", ns=xml_ns(doc)) %>% xml_text() %>% as.numeric() ## [1] 0.24 0.73 1.25 1.75 2.24 2.75 3.27 3.76 4.30 4.77 5.28 5.78 6.32 6.82...
Try it this way: <xsl:key name="kFirstText" match="*[not(self::type1[not(preceding-sibling::*[1][self::type1])])]" use="generate-id(preceding-sibling::type1[not(preceding-sibling::*[1][self::type1])][1])"/> This excludes the "leader" nodes from the group retrieved by the key....
Your xsl is not valid This one is correct and gives you the result expected <?xml version="1.0" ?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:element name="parent"> <xsl:apply-templates select="/root/gereratorList/generator"/> </xsl:element> </xsl:template> <xsl:template match="generator"> <xsl:if test="id='10'"> <xsl:element name="child"> <xsl:element name="test"> <xsl:value-of select="A"/>...
It's difficult to provide an answer without seeing the input. I believe you need to do something like the following: XSLT 1.0 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="visualChildren"> <xsl:variable name="bundles"> <xsl:call-template name="create-bundles"> <xsl:with-param name="n" select="4" />...
An XSL transformation that meets your requirement may be like the following: <?xml version="1.0" encoding="utf-16" ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml"/> <!-- the update source file: --> <xsl:param name="usource" select="'updatesource.xml'"/> <xsl:template match="Material"> <!-- Material's position: --> <xsl:variable name="pos"> <xsl:value-of select="count(preceding::Material)+1"/> </xsl:variable>...
$data = array( "line1" => "sample data", "line2" => "sample data 2", ); $data_string = json_encode($data); $url = "http://test.com/webservicerequest.asmx"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); // set url to post to curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen($data_string))...
c#,.net,xml,serialization,.net-4.0
As you've noticed, there are lots of characters that may not be present in an XML document. These can be included in your data, however, using the proper escape sequence. The default settings of the XmlTextReader cause it to mishandle this -- I think it interprets the escape sequences prematurely,...
i want an xslt template which removes the other event node along with child nodes in which other event type value is OriginalCommitDateTime. The standard method to exclude specific nodes is to start with the identity transform template to copy all nodes as the rule, then add an empty...
php,xml,symfony2,deserialization,jmsserializerbundle
It depends on your intention. If you want to directly push part or all of the XML to an entity/document object for saving to a database then the JMSSerializerBundle can do this very smartly and is definitely the best way to do it. If however you just want to extract...
android,xml,character-encoding,xmlpullparser,questionmark
Content encoding and character encoding are not the same thing. Content encoding refers to compression such as gzip. Since getContentEncoding() is null, that tells you there's no compression. You should be looking at conn.getContentType(), because the character encoding can usually be found in the content-type response header. conn.getContentType() might return...
This is the complete code [HttpPost] public ActionResult SURV_Answer_Submit(List<AnswerQuestionViewModel> viewmodel, int Survey_ID, string Language) { if (ModelState.IsValid) { var query = from r in db.SURV_Question_Ext_Model.ToList() join s in db.SURV_Question_Model on r.Qext_Question_ID equals s.Question_ID where s.Question_Survey_ID == Survey_ID && r.Qext_Language == Language orderby s.Question_Position ascending select new { r, s };...
It's something related with /var/www/html/app/code/core/Mage/Core/Model/Layout/Update.php so I would edit that file and I would go to the line 450. Just before that line write: Mage::log(print_r($filename, true)); Make sure that your logging is enabled and refresh the page. After that, take a look to var/log/system.log. The last xml is probably what...
sql,xml,stored-procedures,sql-insert
You have a few options: You can read the XML nodes before inserting into the database, and insert normalized table column values. You can shred the XML in a stored procedure, by passing the XML string as an input parameter. You can read up on how to shred the XML...
you need cut result string $n = strlen('<?xml encoding="utf-8" ?>'); $content_text_fixHTML = substr($H->purify($content_text), $n); ...
Actually the program as posted originally works fine, there is just one small error: "ParentNode.RemoveChild()" should be called on node instead of doc.
I actually looked around and figured out how to do this. I found it under a different topic but figured that I might help anyone else with this specific question. To get to these multiple array items, you have to put in the index like this: console.log(jsonXML.ProfileGroup.File["0"].Profile.WayPt["0"].distance); When iterating through...
As Arthur Elrich pointed out in the comments, you should make the factory namespace aware and provide a namespace context to the XPath instance. DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.parse( new InputSource(new StringReader(...))); XPath xpath = XPathFactory.newInstance().newXPath(); xpath.setNamespaceContext(new MyNamespaceContext()); String s = xpath.evaluate("//location:address/text()",...
You can ignore pretty much all your code, the issue is just this: XDocument people = new XDocument("Persons"); You can't create an XDocument containing a string, you need to add an element: XDocument people = new XDocument( new XElement("Persons", original.XPathSelectElements(xpathFilterDups))); ...
You want to bind open generic types, so this type definition should do the trick: <bind service="Base.IJsonProvider`1, Base" to="Base.JsonProvider`1, Base" name ="Config"/> ...
Try it this way? <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/template/L"> <html> <body> <ul> <xsl:for-each select="Q"> <li> <xsl:value-of select="text()"/> <ul> <xsl:for-each select="R"> <li> <xsl:value-of select="."/> </li> </xsl:for-each> </ul> </li> </xsl:for-each> </ul> </body> </html> </xsl:template> </xsl:stylesheet> Explanation: When...
This should work : XmlNodeList xnList2 = xml.SelectNodes("/roor/body/queries"); foreach (XmlNode xn2 in xnList2) { foreach (XmlNode childNode in xn2.ChildNodes) { queries = childNode.InnerText; // text should return only first query text, but I need all the query text query_string = "INSERT INTO Customer_Queries values (@query)"; using(SqlConnection myConnection = new SqlConnection(constr))...
Change your final loop to: for idx, image in enumerate(imgPath): #img resizing goes here count_remaining = len(imgPath) - (idx+1) if count_remaining > 0: print("There are {} images left to resize.".format(count_remaining)) response = input("Resize image #{}? (Y/N)".format(idx+2)) #use `raw_input` in place of `input` for Python 2.7 and below if response.lower() !=...
javascript,ruby-on-rails,ruby,xml,api
Net::HTTP is Ruby's built in library for sending HTTP requests. Rails also has built in features for serializing models to XML. Lets say you bind your form to a User model: class User < ActiveModel::Base # attr_accessor is not needed if these are real DB columns. attr_accessor :firstname attr_accessor :surname...
This will be not a very rigours analysis, but the problem seems to be with the BasicTransformer's transform(Seq[Node]) method[1]. The child transform method will be called twice for a node which is changed. Specifically in your example all the nodes will be called twice for this reason. And you are...
You can use a key in order to count the properties in the sort instruction. A stylesheet containing the following: <xsl:key name="p" match="property" use="@agency"/> <xsl:template match="/immo"> <result> <xsl:for-each select="agency"> <xsl:sort select="count(key('p', @name))"/> <res id="{ @name }" count="{ count(key('p', @name)) }"/> </xsl:for-each> </result> </xsl:template> when applied to the following input: <immo>...
You can't get this to work with XSD 1.0. An "all" is not allowed as part of a choice. That's actually true in 1.1 as well. But what are you actually trying to achieve? You've got a choice with only one branch, which is obviously redundant, except that it specifies...
c#,xml,wpf,visual-studio,relative-path
First, ensure that the file is definitely copied into your output ./bin/ directory on compile: This worked perfectly for me in my WPF application: const string imagePath = @"pack://application:,,,/Test.txt"; StreamResourceInfo imageInfo = Application.GetResourceStream(new Uri(imagePath)); byte[] imageBytes = ReadFully(imageInfo.Stream); If you want to read it as binary (e.g. read an image...
I guess, but I think your XML is only present in your memory. You have to trigger somethink like tsFileXml.WriteToFile(filename) to store your changes to a file on your filesystem.
You need a FrameLayout. In a FrameLayout, the children are overlapped on top of each other with the last child being at the topmost. activity_main.xml <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:fab="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent"...
python,xml,python-2.7,pandas,lxml
There are several things wrong here. (Asking questions on selecting a library is against the rules here, so I'm ignoring that part of the question). You need to pass in a file handle, not a file name. That is: y = BeautifulSoup(open(x)) You need to tell BeautifulSoup that it's dealing...
This demonstrates the problem: >>> root = ET.fromstring("<a><b /><c><d /></c></a>") >>> for e in root: ... print(e) ... <Element 'b' at 0x7f76c6d6cd18> <Element 'c' at 0x7f76c6d6cd68> >>> for e in root: ... print(e) ... root.remove(e) ... <Element 'b' at 0x7f76c6d6cd18> So, modifying the object that you are iterating affects the...
If you mean the ampersand, it is not in a tag, it is in the text that appears between two tags. The reason people choose to use XML for data interchange is that it's a standard, and there's lots of software around to handle it. That advantage disappears entirely if...
To remove some nodes start with the identity transformation template <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template> then add an empty template for the nodes to be removed: <xsl:template xmlns:xhtml="http://www.w3.org/1999/xhtml" match="xhtml:div/@style | xhtml:li/@style | xhtml:td/@style | xhtml:span/@style"/> ...
Make a base class which will have id,x,y,z, and have Vendors,Bankers and Hospitals extend it. Then you can have a collection of the base class, and add to it the classes that inherit from it....
You're blocked by a non-orthogonality of XML Schema. You'd think that the following should work: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="top"> <xs:complexType> <xs:sequence> <xs:all> <xs:element name="A" minOccurs="0"/> <xs:element name="B" minOccurs="0"/> <xs:element name="C" minOccurs="0"/> <xs:element name="D" minOccurs="0"/> </xs:all> <xs:element name="E" minOccurs="1"...
html,xml,converter,xquery,basex
BaseX has integration for TagSoup, which will convert HTML to well-formed XHTML. Most distributions of BaseX already bundle TagSoup, if you installed BaseX from a Linux repository, you might need to add it manually (for example, on Debian and Ubuntu it's called libtagsoup-java). Further details for different installation options are...
use android:fillViewport="true" for scroll view and change ImageView scale type to android:scaleType="fitXY" <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="bottom" > <ScrollView android:id="@+id/scroll" android:fillViewport="true" android:layout_width="fill_parent" android:layout_height="fill_parent"> <RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="match_parent" android:layout_height="match_parent" > <ImageView...
java,android,xml,android-activity,android-listfragment
You are operating on the original data instead of filtered data. You should maintain a reference to original data and use the filtered data for all other purposes. So that the original data is displayed when search is cleared. Replace all usages of mData with mFilteredData as below and only...
$str = '<root><Pages> <copyright>me inc. 2015,</copyright> <author>Me</author> <lastUpdate>2/1/1999</lastUpdate> <Home>--------------------</Home> <About>--------------------</About> <Contact>------------------</Contact> </Pages></root>'; $xml = simplexml_load_string($str); $result = $xml->xpath('//Pages/*[(name() = "Home") or following-sibling::Home]'); if ($result === false) { $this->parseError(); //To return xml Error code...
I only need the 2 files. legacy.xml (bookIds not 10 in length) & current.xml (bookIds with length of 10). Then I would suggest you do it this way: XSLT 2.0 <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/books"> <books> <xsl:copy-of select="book[string-length(bookId)=10]" /> </books> <xsl:result-document href="file:/C:/devFiles/legacy.xml"> <books> <xsl:copy-of...