Search Results

Search found 18472 results on 739 pages for 'vtd xml author'.

Page 29/739 | < Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >

  • Javascript - use to load xml data from URL

    - by spenf
    I have this url with some xml data in it: http://64.182.231.116/~spencerf/union_college/Upperclass_Sample_Menu.xml And I would like to load this xml data into my javascript script so I can parse it. I am using parse.com Javascript SDK, in there cloud code. Here is the code I have tried: Parse.Cloud.define("next", function(request, response) { response.success("Hello world!"); $.ajax({ url: 'http://64.182.231.116/~spencerf/union_college/Upperclass_Sample_Menu.xml', // name of file you want to parse dataType: "xml", // type of file you are trying to read success: parse, // name of the function to call upon success error: function(){alert("Error: Something went wrong");} }); }); But when I run this I get an error: $ is not defined at main.js:

    Read the article

  • Android, sending XML via HTTP POST (SOAP)

    - by Intosia
    Hi, I would like to invoke a webservice via Android. I need to POST some XML to a URL via HTTP. I found this snipped for sending a POST, but i dont know how to include/add the XML data itself. public void postData() { // Create a new HttpClient and Post Header HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://10.10.4.35:53011/"); try { // Add your data List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2); nameValuePairs.add(new BasicNameValuePair("Content-Type", "application/soap+xml")); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); // Where/how to add the XML data? // Execute HTTP Post Request HttpResponse response = httpclient.execute(httppost); } catch (ClientProtocolException e) { // TODO Auto-generated catch block } catch (IOException e) { // TODO Auto-generated catch block } } This is the complete POST message that i need to imitate: POST /a8103e90-f1e3-11dd-bfdb-8b1fcff1a110 HTTP/1.1 Host: 10.10.4.35:53011 Content-Type: application/soap+xml Content-Length: 602 <?xml version='1.0' encoding='UTF-8' ?> <s12:Envelope xmlns:s12="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"> <s12:Header> <wsa:MessageID>urn:uuid:fc061d40-3d63-11df-bfba-62764ccc0e48</wsa:MessageID> <wsa:Action>http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</wsa:Action> <wsa:To>urn:uuid:a8103e90-f1e3-11dd-bfdb-8b1fcff1a110</wsa:To> <wsa:ReplyTo> <wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address> </wsa:ReplyTo> </s12:Header> <s12:Body /> </s12:Envelope>

    Read the article

  • How to validate xml using a .dtd via a proxy and NOT using system.net.defaultproxy

    - by Lanceomagnifico
    Hi, Someone else has already asked a somewhat similar question: http://stackoverflow.com/questions/1888887/validate-an-xml-file-against-a-dtd-with-a-proxy-c-2-0/2766197#2766197 Here's my problem: We have a website application that needs to use both internal and external resources. We have a bunch of internal webservices. Requests to the CANNOT go through the proxy. If we try to, we get 404 errors since the proxy DNS doesn't know about our internal webservice domains. We generate a few xml files that have to be valid. I'd like to use the provided dtd documents to validate the xml. The dtd urls are outside our network and MUST go through the proxy. Is there any way to validate via dtd through a proxy without using system.net.defaultproxy? If we use defaultproxy, the internal webservices are busted, but the dtd validation works.# Here is what I'm doing to validate the xml right now: public static XDocument ValidateXmlUsingDtd(string xml) { var xrSettings = new XmlReaderSettings { ValidationType = ValidationType.DTD, ProhibitDtd = false }; var sr = new StringReader(xml.Trim()); XmlReader xRead = XmlReader.Create(sr, xrSettings); return XDocument.Load(xRead); } Ideally, there would be some way to assign a proxy to the XmlReader much like you can assign a proxy to the HttpWebRequest object. Or perhaps there is a way to programatically turn defaultproxy on or off? So that I can just turn it on for the call to Load the Xdocument, then turn it off again? FYI - I'm open to ideas on how to tackle this - note that the proxy is located in another domain, and they don't want to have to set up a dns lookup to our dns server for our internal webservice addresses. Cheers, Lance

    Read the article

  • How to Deserialize XMLDocument to object in C#?

    - by Deepfreezed
    I have a .Net webserivce that accepts XML in string format. XML String sent into the webserivce can represent any Object in the system. I need to check the first node to figure out what object to deserialize the XML string. For this I will have to load the XML into an XMLDocument (Don't want to use RegEx or string compare). I am wondering if there is a way to Deserialize the XMLDocument/XMLNode rather that deserializing the string to save some performance? Is there going to be any performance benefit serializing the XMLNode rather that the string? Method to Load XMLDocument public void LoadFromString(String s) { m_XmlDoc = new XmlDocument(); m_XmlDoc.LoadXml(s); } Thanks

    Read the article

  • Strange xml/html accent issue

    - by Ayrad
    I have an XML file that contains a message with html tags in it. The XML file is read by a java class that mails it to people. When the mail is received, the accents do not show. For example é doesn't show. I have tried &eacute; in the xml but it gives an error in eclipse saying that the entity has not been declared. I also tried simply inserting &#233; but that shows nothing in the final output. The 3rd thing I tried was using <![CDATA[é]]> but that broke the parser since it didn't output anything after it. However I noticed something weird. When i put something like this in the xml and added UTF-16 encoding <message>text bla bla blaa é&lt; it did ouput the é at the end like this bla bla blaa blaa é. EDIT <message>text bla bla blaa éé&lt; outputs ?é or just one é The file looks something like this: <?xml version="1.0"? encoding="UTF-16"> <message> &lt;b&gt;hello é &lt;/b&gt; </message> </xml> What gives?

    Read the article

  • XElement Add function adds xmlns="" to the XElement

    - by JJoos
    I have a function which generates xml for a list object: public XDocument ToXML() { foreach (var row in this) { var xml = row.ToXml(); template.Root.Add(xml); } return template; } The template.ToString() reads: <RootElement xmlns="urn:testTools"> The xml reads: <Example><SubElement>testData</SubElement></Example> After the add function has executed the template.ToString() reads: <RootElement xmlns="urn:testTools"><Example xmlns=""><SubElement>testData</SubElement></Example> So for some reason there was an empty namespace added, how can i prevent it from doing so?

    Read the article

  • Linq2XML not getting content of a node that contains html tags

    - by Dante
    Hi, I have an XML file that I'm trying to parse with Linq2XML. One of the nodes contains a bit of html, that I cannot retrieve. The XML resembles to: <?xml version="1.0" encoding="ISO-8859-1"?> <root> <image><img src="/Images/m1cznk4a6fh7.jpg" /></image> <contentType>Banner</contentType> </root> The code is: XDocument document = XDocument.Parse(content.XML); XElement imageElement = document.Descendants("image").SingleOrDefault(); image = imageElement.Value; // Doesn't get the content, while if I specify .Descendants("contentType") it works Any ideas? Thank you in advance

    Read the article

  • XML to WordML basics

    - by Level1Coder
    I'm new to the world of XML. I'm not sure which way to build the XML so I provided 2 examples below. My question is: Given the XML, how do I transform either Example#1 / #2 to the WordML Result? What technologies do I need to accomplish this? Example#1: <NumberedList1> <Paragraph>Paragraph one.</Paragraph> </NumberedList1> Example#2: <NumberedList>1</NumberedList> <Paragraph>Paragraph one.</Paragraph> After transformation... WordML Result: <w:p> <w:pPr> <w:pStyle w:val="ListParagraph"/> <w:numPr> <w:ilvl w:val="0"/> <w:numId w:val="1"/> </w:numPr> </w:pPr> <w:r> <w:t>Paragraph one.</w:t> </w:r> </w:p> If there is a way to transform the XML to WordML, maybe I can opt to save the data in XML format in the db instead of building both XML and WordML on the fly for 2 different formats.

    Read the article

  • How can I transform XML to invalid XML using XSLT?

    - by Damovisa
    I need to transform a valid XML document to the OFX v1.0.2 format. This format is more or less XML, but it's technically invalid and therefore cannot be parsed as XML. I'm having trouble getting my Xml transformation working because the .Net XslCompiledTransform object insists on interpreting the XSL as an XML document (which is fair enough). If I escape the xml-ish tags using &lt; and &gt, they get removed when I download the file. Here's the start of my XSLT: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="text"></xsl:output> <xsl:param name="currentdate"></xsl:param> <xsl:template match="Transactions"> OFXHEADER:100 DATA:OFXSGML VERSION:102 SECURITY:NONE ENCODING:USASCII CHARSET:1252 COMPRESSION:NONE OLDFILEUID:NONE NEWFILEUID:NONE <OFX> <SIGNONMSGSRSV1> <SONRS> <STATUS> <CODE>0 <SEVERITY>INFO </STATUS> <DTSERVER><xsl:value-of select="$currentdate" /> <LANGUAGE>ENG Any suggestions?

    Read the article

  • How do I get a list of child elements from XDocument object?

    - by Nick
    Hello.. I am trying to get all of the "video" elements and their attributes from an XML file that looks like this: <?xml version="1.0" encoding="utf-8" ?> <videos> <video title="video1" path="videos\video1.wma"/> <video title="video2" path="videos\video2.wma"/> <video title="video3" path="videos\video3.wma"/> </videos> The following will only select the root node and all of the children. I would like to get all of the 'video' elements into the IEnumerable. Can someone tell me what I'm doing wrong? IEnumerable<XElement> elements = from xml in _xdoc.Descendants("videos") select xml; The above returns a collection with a length == 1. It contains the root element and all the children.

    Read the article

  • search dataset from xml file

    - by Anelim
    Hi, I need to filter the results I obtain when I load my xml file. For example I need to search the xml data for items with keyword "Chemistry" for example. The below xml example is a summary of my xml file. The data is loaded in a gridview. Could you help? Thanks! Xml File (summary): <CONTRACTS> <CONTRACT> <CONTRACTID>779</CONTRACTID> <NAME>ContractName</NAME> <KEYWORDS>Chemistry, Engineering, Chemical</KEYWORDS> <CONTRACTSTARTDATE>1/8/2005</CONTRACTSTARTDATE> <CONTRACTENDDATE>31/7/2008</CONTRACTENDDATE> <COMMODITIES><COMMODITY><COMMODITYCODE>CHEM</COMMODITYCODE> <COMMODITYNAME>Chemicals</COMMODITYNAME></COMMODITY></COMMODITIES> </CONTRACT></CONTRACTS> My code behind code is: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim ds As DataSet = New DataSet() ds.ReadXml(AppDomain.CurrentDomain.BaseDirectory + "/testxml.xml") Dim dtContract As DataTable = ds.Tables(0) Dim dtJoinCommodities As DataTable = ds.Tables(1) Dim dtCommodity As DataTable = ds.Tables(2) dtContract.Columns.Add("COMMODITYCODE") dtContract.Columns.Add("COMMODITYNAME") Dim count As Integer = 0 Dim commodityCode As String = Nothing Dim commodityName As String = Nothing Dim dRowJoinCommodity As DataRow Dim trimChar As Char() = {","c, " "c} Dim textboxstring As String = "KEYWORDS like 'pencil'" For Each dRow As DataRow In dtContract.Select(textboxstring) commodityCode = "" commodityName = "" count = dtContract.Rows.IndexOf(dRow) dRowJoinCommodity = dtJoinCommodities.Rows(count) For Each dRowCommodities As DataRow In dtCommodity.Rows If dRowCommodities("COMMODITIES_Id").ToString() = dRowJoinCommodity("COMMODITIES_ID").ToString() Then commodityCode = commodityCode + dRowCommodities("COMMODITYCODE").ToString() + ", " commodityName = commodityName + dRowCommodities("COMMODITYNAME").ToString() + ", " End If Next commodityCode = commodityCode.TrimEnd(trimChar) commodityName = commodityName.TrimEnd(trimChar) dRow("COMMODITYCODE") = commodityCode dRow("COMMODITYNAME") = commodityName Next GridView1.DataSource = dtContract GridView1.DataBind() End Sub

    Read the article

  • Changing Element Value in Existing XML File Using DOM

    - by rylic38
    Hi All, I am trying to find examples of how to change an existing xml files Element Value. Using the following xml example: <book> <title>My Book</title> <author>John Smith</author> </book> If I wanted to replace the author element value 'John Smith' with 'Jim Johnson' in a Python script using DOM, how would I go about doing so? I've tried to look for examples on this, but have failed in doing so. Any help would be greatly appreciated. Regards, Rylic

    Read the article

  • How to make xml in C#?

    - by kacalapy
    i have not worked with XML in a while can someone post the syntax needed to build and save an xml node structure that resembles that of a tree structure that is created by a recursive function. basically i have a recursive function that saves data found an a page(url) and then follows each URL found on that page recursivley and does the same to it. to audit this i want an output as a xml file to disk so i can see how it is doing its recursion and parsing. the code i have is below. please add to it the needed xml calls needed to create a xml structure like the one i show below. (please include the full name space so i can see where the objects i need in .net are for this.) page1.htm has 2 links on it: <a href=page1_1.htm> <a href=page1_2.htm> page1_1.htm has 2 links on it <a href=page1_1_a.htm> (this then will have some links also) <a href=page1_1_b.htm> (this then will have no more links on it - dead end) the xml should do something like this: <node url=page1.htm> ...<node url=page1_1_a.htm> ...... <node url="xxx.htm"/> ...... <node url="yyy.htm".> ... </node> ...<node url=page1_1_b.htm /> </node>

    Read the article

  • XML Serialization Not Working For All Elements (C#)

    - by splatto
    I have an XML file that I'm trying to serialize into an object. Some elements are being ignored. My XML File: <?xml version="1.0" encoding="utf-8" ?> <License xmlns="http://schemas.datacontract.org/2004/07/MyApp.Domain"> <Guid>7FF07F74-CD5F-4369-8FC7-9BF50274A8E8</Guid> <Url>http://www.gmail.com</Url> <ValidKey>true</ValidKey> <CurrentDate>3/1/2010 9:39:28 PM</CurrentDate> <RegistrationDate>3/8/2010 9:39:28 PM</RegistrationDate> <ExpirationDate>3/8/2099 9:39:28 PM</ExpirationDate> </License> My class definition: [DataContract] public class License { [DataMember] public virtual int Id { get; set; } [DataMember] public virtual string Guid { get; set; } [DataMember] public virtual string ValidKey { get; set; } [DataMember] public virtual string Url { get; set; } [DataMember] public virtual string CurrentDate { get; set; } [DataMember] public virtual string RegistrationDate { get; set; } [DataMember] public virtual string ExpirationDate { get; set; } } And my Serialization attempt: XmlDocument Xmldoc = new XmlDocument(); Xmldoc.Load(string.Format(url)); string xml = Xmldoc.InnerXml; var serializer = new DataContractSerializer(typeof(License)); var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(xml)); License license = (License)serializer.ReadObject(memoryStream); memoryStream.Close(); The following elements are serialized: Guid ValidKey The following elements are not serialized: Url CurrentDate RegistrationDate ExpirationDate Replacing the string dates in the xml file with "blah" doesn't work either. What gives?

    Read the article

  • AS3: Array of objects parsed from XML remains with zero length

    - by Joel Alejandro
    I'm trying to parse an XML file and create an object array from its data. The data is converted to MediaAlbum classes (class of my own). The XML is parsed correctly and the object is loaded, but when I instantiate it, the Albums array is of zero length, even when the data is loaded correctly. I don't really know what the problem could be... any hints? import Nem.Media.*; var mg:MediaGallery = new MediaGallery("test.xml"); trace(mg.Albums.length); MediaGallery class: package Nem.Media { import flash.net.URLRequest; import flash.net.URLLoader; import flash.events.*; public class MediaGallery { private var jsonGalleryData:Object; public var Albums:Array = new Array(); public function MediaGallery(xmlSource:String) { var loader:URLLoader = new URLLoader(); loader.load(new URLRequest(xmlSource)); loader.addEventListener(Event.COMPLETE, loadGalleries); } public function loadGalleries(e:Event):void { var xmlData:XML = new XML(e.target.data); var album; for each (album in xmlData.albums) { Albums.push(new MediaAlbum(album.attribute("name"), album.photos)); } } } } XML test source: <gallery <albums <album name="Fútbol 9" <photos <photo width="600" height="400" filename="foto1.jpg" / <photo width="600" height="400" filename="foto2.jpg" / <photo width="600" height="400" filename="foto3.jpg" / </photos </album <album name="Fútbol 8" <photos <photo width="600" height="400" filename="foto4.jpg" / <photo width="600" height="400" filename="foto5.jpg" / <photo width="600" height="400" filename="foto6.jpg" / </photos </album </albums </gallery

    Read the article

  • Java split xml file

    - by CC
    Hi all, I'm working on a piece of code to split files. I want to split flat file (that's ok, it is working fine) and xml file. The idea is to split based of a number of files to split: I have a file, and I want to split it in x files (x is a parameters). I'm doing the split by taking the size of the file and spliting the size by the number of files to split. Then, mysolution was to use a BufferedReader and to use it like while ((n = reader.read(buffer, 0, buffer.length)) != -1) { { The main problem is that for the xml file I cannot just split it, but I have to split it based on a block delimited by a start xml tag and end xml tag: <start tag> bla bla xml stuff </end tag> So I cannot cut a block at the middle. So if when I'm at the half of a block, is the size of my new file is greater than my max, I will have to read until the end of the tag, and then, to start a next file. The problem is that I have all sort of cases, and is a bit difficult to search the end tag. - the block reads a text until the middle of the end tag - the block reads a text until the end of the end tag, and no more other caracter after - etc and in the same time to have a loop and read the next block. Some times the end of a block concatenated with the start of the next one, I have the end xml tag. I hope you get the idea. My question is, does anyone have some algorithm that does that more accurate and who i treating all special cases ? The idea is to split the file as quickly as possible. Thanks alot.

    Read the article

  • Serialize XML child and keep namespaces in Java

    - by Guido García
    I have an Document object that is modeling a XML like this one: <RootNode xmlns="http://a.com/a" xmlns:b="http://b.com/b"> <Child /> </RootNode> Using Java DOM, I need to get the <Child> node and serialize it to XML, but keeping the root node namespaces. This is what I currently have, but it does not serialize the namespaces: public static void main(String[] args) throws Exception { String xml = "<RootNode xmlns='http://a.com/a' xmlns:b='http://b.com/b'><Child /></RootNode>"; DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc = builder.parse(new ByteArrayInputStream(xml.getBytes())); Node childNode = doc.getFirstChild().getFirstChild(); // serialize to string StringWriter sw = new StringWriter(); DOMSource domSource = new DOMSource(childNode); StreamResult streamResult = new StreamResult(sw); TransformerFactory tf = TransformerFactory.newInstance(); Transformer serializer = tf.newTransformer(); serializer.transform(domSource, streamResult); String serializedXML = sw.toString(); System.out.println(serializedXML); } Current output: <?xml version="1.0" encoding="UTF-8"?> <Child/> Expected output: <?xml version="1.0" encoding="UTF-8"?> <Child xmlns='http://a.com/a' xmlns:b='http://b.com/b' />

    Read the article

  • Why am I getting the extra xmlns="" using LinqToXML?

    - by Hcabnettek
    Hello all, I'm using LinqToXML to generate a piece of XML. Everything works great except I'm throwing in some empty namespace declarations somehow. Does anyone out there know what I'm doing incorrectly? Here is my code private string SerializeInventory(IEnumerable<InventoryInformation> inventory) { var zones = inventory.Select(c => new { c.ZoneId , c.ZoneName , c.Direction }).Distinct(); XNamespace ns = "http://www.dummy-tmdd-address"; XNamespace xsi = "http://www.w3.org/2001/XMLSchema-instance"; var xml = new XElement(ns + "InventoryList" , new XAttribute(XNamespace.Xmlns + "xsi", xsi) , zones.Select(station => new XElement("StationInventory" , new XElement("station-id", station.ZoneId) , new XElement("station-name", station.ZoneName) , new XElement("station-travel-direction", station.Direction) , new XElement("detector-list" , inventory.Where(p => p.ZoneId == station.ZoneId).Select(plaza => new XElement("detector" , new XElement("detector-id", plaza.PlazaId))))))); xml.Save(@"c:\tmpXml\myXmlDoc.xml"); return xml.ToString(); } And here is the resulting xml. I hope it renders correctly? The browser may hide the tags. - <InventoryList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.dummy-tmdd-address"> <StationInventory xmlns=""> <station-id>999</station-id> <station-name>Zone 999-SEB</station-name> <station-travel-direction>SEB</station-travel-direction> <detector-list> <detector> <detector-id>7503</detector-id> </detector> <detector> <detector-id>2705</detector-id> </detector> </detector-list> </StationInventory> </InventoryList> Notice the empty namespace declaration in the first child element. Any ideas how I can remedy this? Any tips are of course appreciated. Thanks All, ~ck

    Read the article

  • SQL Server: Output an XML field as tabular data using a stored procedure

    - by Pawan
    I am using a table with an XML data field to store the audit trails of all other tables in the database. That means the same XML field has various XML information. For example my table has two records with XML data like this: 1st record: <client> <name>xyz</name> <ssn>432-54-4231</ssn> </client> 2nd record: <emp> <name>abc</name> <sal>5000</sal> </emp> These are the two sample formats and just two records. The table actually has many more XML formats in the same field and many records in each format. Now my problem is that upon query I need these XML formats to be converted into tabular result sets. What are the options for me? It would be a regular task to query this table and generate reports from it. I want to create a stored procedure to which I can pass that I need to query "<emp>" or "<client>", then my stored procedure should return tabular data.

    Read the article

  • GUI for generating XML

    - by Kenston
    Hello. Does anybody know of GUIs for generating XMLs? This means the user will not be presented with an IDE with support for XML for him to type XML codes. This would be helpful for non-technical people using the system. I know this sounds easy, given many libraries that can help in generating XMLs. The issue here is that the schema is really that flexible rather than being straightforward like representing books in a library with their properties. Imagine HTML, where we can create font tags inside a body, a table, a div, or nested even within itself. The solution is a WYSIWYG application that allows user to generate html codes (XML). However, that is good for XML applied in webpages since they involve visual aspect and design. My application of XML would focus on representing some conceptual and computational definitions, much like sql-like syntax, but more than that. I'm actually after the approach or previous works done or tried, although having a library/working framework for that would be better. Btw, I'm using Java for this project. Currently, I'm just thinking of presenting element tags where user will be able to drag and drop them and nest them with each other. And perhaps, assist them through a forms in inputing values for XML attributes. I'm still hoping if there are better ideas from the community. Thank you.

    Read the article

  • XML parsing using jQuery

    - by lmkk
    I have the following xml: <?xml version="1.0" encoding="utf-8"?> <Area xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Scenes> <Scene Index="1" Name="Scene1" /> <Scene Index="2" Name="Scene2" /> </Scenes> </Area> Which i am trying to parse with jquery: <script> $(document).ready(function(){ $.ajax({ type: "GET", url: "list.xml", dataType: "xml", success: function(xml) { $(xml).find('scenes').each(function(){ $(this).find('scene').each(function(){ var name = $(this).attr('name'); $('<div class="items" ></div>').html('<p>'+name+'</p>').appendTo('#page-wrap'); }); }); } }); }); </script> Why is this not working? Help!! first attempt at javascript/jquery This is based on a example I found, but have so far been unable to adapt it to my usage. / Lars

    Read the article

  • Appending and prepending to XML files with Clojure

    - by Isaac Copper
    I have an XML file with format similar to: <root> <baby> <a>stuff</a> <b>stuff</b> <c>stuff</c> </baby> ... <baby> <a>stuff</a> <b>stuff</b> <c>stuff</c> </baby> </root> And a Clojure hash-map similar to: {:a "More stuff" :b "Some other stuff" :c "Yet more of that stuff"} And I'd like to prepend XML (¶) created from this hash-map after the <root> tag and before the first <baby> (¶) The XML to prepend would be like: <baby> <a>More stuff</a> <b>Some other stuff</b> <c>Yet more of that stuff</c> </baby> I'd also like to be able to delete the last one (or n...) <baby>...</baby>s from the file. I'm struggling with coming up with an idiomatic was to prepend and append this data. I can do raw string manipulations, or parse the XML using xml/parse and xml-seq and then roll through the nodes and (somehow?) replace the data there, but that seems messy. Any tips? Ideas? Hints? Pointers? They'd all be much appreciated. Thank you!

    Read the article

  • How to read spring-application-context.xml and AnnotationConfigWebApplicationContext both in spring mvc

    - by Suvasis
    In case I want to read bean definitions from spring-application-context.xml, I would do this in web.xml file. <context-param> <param-name>contextConfigLocation</param-name> <param-value> /WEB-INF/applicationContext.xml </param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> In case I want to read bean definitions through Java Configuration Class (AnnotationConfigWebApplicationContext), I would do this in web.xml <servlet> <servlet-name>appServlet</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextClass</param-name> <param-value> org.springframework.web.context.support.AnnotationConfigWebApplicationContext </param-value> </init-param> <init-param> <param-name>contextConfigLocation</param-name> <param-value> org.package.MyConfigAnnotatedClass </param-value> </init-param> </servlet> How do I use both in my application. like reading beans from both configuration xml file and annotated class. Is there a way to load spring beans in xml file while we are using AppConfigAnnotatedClass to instantiate/use rest of the beans.

    Read the article

  • XMLReader mysteriously fails when parsing document

    - by Valrus
    I have a php script that takes in some XML data and parses it, displaying various bits of information I pull out of it. This has been working fine for over 6 months, until recently it now fails mysteriously on a certain tag. The XML is generated from an outside source(a conferencing bridge), so I have no control over how it is built. I have put the xml through an online validator and it returned no errors. The code also works fine when I connect to another conferencing bridge and get the same output. I have been using XMLReader class so far and tried switching to SmipleXML, but it fails when I create the SimpleXML object using the data. Here is the snippet of where it fails while parsing: <CDR_SUMMARY> <FILE_VERSION>1001</FILE_VERSION> <NAME>Conference Title Hidden</NAME> <ID>10227</ID> <STATUS_STR>Auto_termination,_everybody_quit</STATUS_STR> <STATUS>4</STATUS> <GMT_OFFSET>-4</GMT_OFFSET> <START_TIME>2010-04-14T15:00:33</START_TIME> <DURATION> <HOUR>0</HOUR> <MINUTE>39</MINUTE> <SECOND>37</SECOND> </DURATION> <RESERVE_START_TIME>2010-04-14T15:00:33</RESERVE_START_TIME> <RESERVE_DURATION> <HOUR>12</HOUR> <MINUTE>0</MINUTE> <SECOND>0</SECOND> </RESERVE_DURATION> <MCU_FILE_NAME>c11</MCU_FILE_NAME> <FILE_SAVED>0</FILE_SAVED> <GMT_OFFSET_MINUTE>0</GMT_OFFSET_MINUTE> </CDR_SUMMARY> The <SOUND> opening tag is the last one read before failing. And this is my code: `public function processResponse($xml) { print "Processing List..."; $reader = new XMLReader($xml); try { $reader->setSchema("./schemas/response_trans_cdr_list.xsd"); } catch(Exception $e) { print "Exception:".$e->getMessage(); } //verify xml if($reader->xml($xml)) { while($reader->read()) { //$currentstring = $reader->readstring(); if($reader->name === "ACTION") { //into meat of resposnse while($reader->read()) { //print "Looping..."; //$currentstring = $reader->readInnerXML(); //print $currentstring; if($reader->nodeType == XMLReader::ELEMENT) { if($reader->name === "ID") { $this->conferenceIDs[$this->counter] = $reader->readString(); print "<BR>Conf ID found: ".$this->counter." ID: ".$this->conferenceIDs[$this->counter]; $this->counter += 1; } else if($reader->name === "START_TIME") { //conference start time. print "<BR>Start Time Found! "; $this->conferenceStarts[$this->counter-1] = $reader->readString(); } else if($reader->name === "NAME") { print "<BR> Name Found!"; $this->conferenceNames[$this->counter] = $reader->readString(); } else if($reader->name === "MCU_FILE_NAME") { print "<BR> MCU_FILE_NAME Found!"; //print $this->counter." File Name: ".$reader->readstring()."<BR>"; } else if($reader->name === "RESERVE_START_TIME") { print "<BR> RESERVE_START_TIME Found!"; } else if($reader->name === "FILE_VERSION") { print "<BR> FILE_VERSION Found!"; } else if($reader->name === "STATUS_STR") { print "<BR> STATUS_STR Found!"; } else if($reader->name === "STATUS") { print "<BR> STATUS Found!"; } else if($reader->name === "GMT_OFFSET") { print "<BR> GMT_OFFSET Found!"; } else if($reader->name === "DURATION") { print "<BR> DURATION Found!"; } else if($reader->name === "RESERVE_START_TIME") { print "<BR> RESERVE_START_TIME Found!"; } else if($reader->name === "RESERVE_DURATION") { print "<BR> RESERVE_DURATION Found!"; } else if($reader->name === "FILE_SAVED") { print "<BR> FILE_SAVED Found!"; } else if($reader->name === "GMT_OFFSET_MINUTE") { print "<BR> GMT_OFFSET_MINUTE Found!"; } else if($reader->name === "HOUR") { print "<BR> HOUR Found!"; } else if($reader->name === "MINUTE") { print "<BR> MINUTE Found!"; } else if($reader->name === "SECOND") { print "<BR> SECOND Found!"; } }else if($reader->nodeType == XMLReader::END_ELEMENT) { print "Close Element".$reader->name; } } print "End Action Loop"; } } } else { print "Error reading response: Bad XML returned"; } }` Anyone have any ideas what could be causing this failure? the code exits gracefully and I see the "End Action Loop" message in my output. It's like it just spontaneously exits the loop.

    Read the article

< Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >