Search Results

Search found 58802 results on 2353 pages for 'system xml'.

Page 48/2353 | < Previous Page | 44 45 46 47 48 49 50 51 52 53 54 55  | Next Page >

  • Is using a StringBuilder for writing XML ok?

    - by Jack Lawson
    It feels dirty. But maybe it isn't... is it ok to use a StringBuilder for writing XML? My gut instinct says "although this feels wrong, it's probably pretty darn performant because it's not loading extra libraries and overhead." Here's what it looks like. I'm building an OpenSearch XML doc based on the domain you come in from. public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/xml"; string domain = WebUtils.ReturnParsedSourceUrl(null); //returns something like www.sample.com string cachedChan = context.Cache[domain + "_opensearchdescription"] as String; if (cachedChan == null) { StringBuilder sb = new StringBuilder(); sb.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); sb.Append("<OpenSearchDescription xmlns=\"http://a9.com/-/spec/opensearch/1.1/\" xmlns:moz=\"http://www.mozilla.org/2006/browser/search/\">"); sb.Append(" <ShortName>Search</ShortName>"); sb.Append(" <Description>Use " + domain + " to search.</Description>"); sb.Append(" <Contact>[email protected]</Contact>"); sb.Append(" <Url type=\"text/html\" method=\"get\" template=\"http://" + domain + "/Search.aspx?q={searchTerms}\" />"); sb.Append(" <moz:SearchForm>http://" + domain + "/Search.aspx</moz:SearchForm>"); sb.Append(" <Image height=\"16\" width=\"16\" type=\"image/x-icon\">http://" + domain + "/favicon.ico</Image>"); sb.Append("</OpenSearchDescription>"); cachedChan = sb.ToString(); context.Cache.Insert(domain + "_opensearchdescription", cachedChan, null, DateTime.Now.AddDays(14), TimeSpan.Zero); } context.Response.Write(cachedChan); }

    Read the article

  • Bitrate Switching in xml playlist not loading video

    - by James Williams
    Using JW Player ver 5.4 and JW Embedder. Plugins are grid by Dabbler and fbit (Facebook). The Bitrate switching is not working. Does work fine for one video with HTML5 Video tag. When more than one video, it only shows the first video pic. Works fine with no bitrate switching. Code - HTML5 <script type="text/javascript" src="jwplayer/jwplayer.js"></script> <video id="container"></div> <script type="text/javascript"> jwplayer("container").setup({ flashplayer: "jwplayer/player.swf", streamer: "rtmp://server/location/", playlistfile: "playlists/playlist.xml", plugins: { grid: { rows: 4, distance: 60, horizontalmargin: 75, verticalmargin: 75 }, fbit: { link: "http://www.domain.com" } }, height: 375, width: 850, dock: true }); </script> XML - ATOM/MEDIA xmlns:jwplayer='http://developer.longtailvideo.com/trac/wiki/FlashFormats' Demostration Playlist Video 1 rtmp rtmp://server/location/ Video 2 rtmp rtmp://server/location/ have tried it with both video and div tags for the container. Div tag just shows a blank video area and a Null exception on Line 1 char 1863, this is probably the jwplayer.js file. XML is larger than this, this is to give you a brief syntax of my code and xml. I have searched for over 6 hrs on both longtail and search engine searches. Thank you in advance.

    Read the article

  • Sorting an XML in Java

    - by Java Guy
    Hello I have an XML similiar to below, which needed to be sorted using the date field. <root> <Node1><date></date></Node1> <Node1><date></date></Node1> <Node1> <date></date></Node1> <Node1> <date></date></Node1> <Node2> <date></date></Node2> <Node2> <date></date></Node2> <Node2> <date></date></Node2> <Node2> <date></date> </Node2> </root> I would like to sort the XML based on the date(say asc order), irrespective of whether the date is under Node1 or Node2. Actually in Java code I have two seperate lists, one with Node1 objects and other with Node2 obects. I can sort the list in any order sperately inside java. But I need to have the dates sorted irrespective of the nodes it is apperaing on the XML. What is the best approach to sort this way in Java? Actaully I am using Castor for marshalling the java objects to XML. If you know this can be done with Castor, that will be great!

    Read the article

  • Linq to XML Document Traversal

    - by Perpetualcoder
    I have an xml document like this: <?xml version="1.0" encoding="utf-8" ?> <demographics> <country id="1" value="USA"> <state id ="1" value="California"> <city>Long Beach</city> <city>Los Angeles</city> <city>San Diego</city> </state> <state id ="2" value="Arizona"> <city>Tucson</city> <city>Phoenix</city> <city>Tempe</city> </state> </country> <country id="2" value="Mexico"> <state id ="1" value="Baja California"> <city>Tijuana</city> <city>Rosarito</city> </state> </country> </demographics> How do I setup LINQ queries for doing things like: 1. Get All Countries 2. Get All States in a Country 3. Get All Cities inside a state of a paricular country ? I gave it a try and I am kind of confused when to use Elements["NodeName"] and Descendants etc. I know I am not the brightest XML guy around. Is the format of the XML file even correct for simple traversal?

    Read the article

  • Gravatar XML-RPC request problem in Objective-C

    - by Erik
    Hi all, I'm trying to incorporate some Gravatar functionality using its XML-RPC API in an iPhone app I'm writing. I grabbed the Cocoa XML-RPC Framework by Eric Czarny (http://github.com/eczarny/xmlrpc) and it works well when I tested it with some of the Wordpress methods. However, when I try to use the Gravatar API, I always receive a response of "Error code: -9 Authentication error". I think I'm constructing the request correctly, but I've been wracking my brain and can't seem to figure it out. Maybe someone has some experience with this API or can see what I'm doing wrong. Here's the call: <?xml version="1.0"> <methodCall> <methodName>grav.addresses</methodName> <params> <param><value><string>PASSWORD_HERE</string></value></param> </params> </methodCall> Again, the Cocoa XML-RPC Framework worked like a dream with Wordpress, but it's choking on the Gravatar API for some reason. Thanks for your help.

    Read the article

  • Writing XML in different character encodings with Java

    - by Roman Myers
    I am attempting to write an XML library file that can be read again into my program. The file writer code is as follows: XMLBuilder builder = new XMLBuilder(); Document doc = builder.build(bookList); DOMImplementation impl = doc.getImplementation(); DOMImplementationLS implLS = (DOMImplementationLS) impl.getFeature("LS", "3.0"); LSSerializer ser = implLS.createLSSerializer(); String out = ser.writeToString(doc); //System.out.println(out); try{ FileWriter fstream = new FileWriter(location); BufferedWriter outwrite = new BufferedWriter(fstream); outwrite.write(out); outwrite.close(); }catch (Exception e){ } The above code does write an xml document. However, in the XML header, it is an attribute that the file is encoded in UTF-16. when i read in the file, i get the error: "content not allowed in prolog" this error does not occur when the encoding attribute is manually changed to UTF-8. I am trying to get the above code to write an XML document encoded in UTF-8, or successfully parse a UTF-16 file. the code for parsing in is DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder loader = factory.newDocumentBuilder(); Document document = loader.parse(filename); the last line returns the error.

    Read the article

  • possible xml elements in Android resources xmls ?

    - by Vijay C
    I recently came across a forum post in thelink text android developers group. (link below) It has one post which contains following xml. It is xml file which can be used in drawable folder. <selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- Non focused states --> <item android:state_focused="false" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/tab_unselected" /> <item android:state_focused="false" android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/tab_selected" /> <!-- Focused states --> <item android:state_focused="true" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/tab_focus" /> <item android:state_focused="true" android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/tab_focus"/> <!-- Pressed --> <item android:state_pressed="true" android:drawable="@drawable/tab_press" /> </selector> Now my question is, where is the documentation which tells me that i can use the following xml tags <selector> , <item>, <color>, <integer-array>, <string-array> and many others tag to create xml resources...? I hope, i have explained what i want to know ?

    Read the article

  • system.Net Tracing - Not able to view Request Body in single line

    - by amz
    Hi All, I am using system.Net tracing to log what is being sent over the wire. I am able to see the Http Request Body content but are in seprate lines. I want to see like below Not like this System.Net Verbose: 0 : [118756] Data from ConnectStream#59274039::Read System.Net Verbose: 0 : [118756] 00000000 : 3C 73 3A 45 6E 76 65 6C-6F 70 65 20 78 6D 6C 6E : System.Net Verbose: 0 : [118756] 00000040 : 3C 73 3A 42 6F 64 79 3E-3C 53 75 62 6D 69 74 41 : < System.Net Verbose: 0 : [118756] 00000080 : 53 75 62 6D 69 74 41 70-70 6C 69 63 61 74 69 6F : SubmitApplicatio System.Net Verbose: 0 : [118756] 00000090 : 6E 52 65 73 75 6C 74 3E-74 72 75 65 3C 2F 53 75 : nResulttrue System.Net Verbose: 0 : [118756] Exiting ConnectStream#59274039::Read() - 232#232

    Read the article

  • Reading and writing XML over an SslStream

    - by Mark
    I want to read and write XML data over an SslStream. The data (written and read) consists of objects serialized by an XmlSerializer. I have tried the following; (left some details out for clarity!) TcpClient tcpClient = new TcpClient(server, port); SslStream sslStream = new SslStream(tcpClient.GetStream(), true, new RemoteCertificateValidationCallback(ValidateServerCertificate), null); sslStream.AuthenticateAsClient(server); XmlReader xmlReader = XmlReader.Create(sslStream,readerSettings); XmlWriter xmlWriter = XmlWriter.Create(sslStream,writerSettings); myClass c = new myClass (); XmlSerializer serializer = new XmlSerializer(typeof(myClass)); serializer.Serialize(xmlWriter, c); myClass c2 = (myClass )serializer.Deserialize(xmlReader); First of all, it appears that writing to the stream succeeds. But the XmlSerializer throws an error because of invalid XML. It appears that the first character read from the stream is '00' or a null-character. (I have googled this problem, and see a million people with the same 'problem', but no viable solution.) I can work around this 'issue' by using a StreamReader, read everything into a string and then use that string as input for another stream that the serializer can use. (Very dirty, but it works.) Second problem is, that when I try to use the same SslStream to write a second request, I do not get a response from the Reader. (The server DOES send a valid XML response though!) So the serializer.Serialize(xmlWriter, c3) works, but reading from the stream yields no results. I have tried several different classes that implement Stream. (StreamReader, XmlTextReader, etc.) Anyone has an idea how reading and writing XML data to and from an SslStream is supposed to work? Thanks in advance!

    Read the article

  • XML child node attribute value

    - by c0mrade
    I'm trying to read xml file, ex : <entry> <title>FEED TITLE</title> <id>5467sdad98787ad3149878sasda</id> <tempi type="application/xml"> <conento xmlns="http://mydomainname.com/xsd/radiofeed.xsd" madeIn="USA" /> </tempi> </entry> Here is the code I have so far : public void parseXML(String xml) { try { InputStream inputStream = new ByteArrayInputStream(xml.getBytes()); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(inputStream); doc.getDocumentElement().normalize(); System.out.println("Root element " + doc.getDocumentElement().getNodeName()); NodeList nodeLst = doc.getElementsByTagName("entry"); System.out.println("Information of all entries"); for (int s = 0; s < nodeLst.getLength(); s++) { Node fstNode = nodeLst.item(s); if (fstNode.getNodeType() == Node.ELEMENT_NODE) { Element fstElmnt = (Element) fstNode; NodeList title = fstElmnt.getElementsByTagName("title").item(0).getChildNodes(); System.out.println("Title : " + ((Node) title.item(0)).getNodeValue()); NodeList id = fstElmnt.getElementsByTagName("id").item(0).getChildNodes(); System.out.println("Id: " + ((Node) update.item(0)).getNodeValue()); NodeList contento= fstElmnt.getElementsByTagName("tempi").item(0).getChildNodes(); System.out.println("Contento : " + ((Node) content.item(0)).getFirstChild().getAttributes()); // with this line above I'm having problems, I get null pointer exception } } } catch (Exception e) { e.printStackTrace(); } } How can I read/get, contento tag attributes? I'm using org.w3c.dom lib.

    Read the article

  • Using Flexigrid with an xml formatted source how do you specify how the xml is formatted?

    - by stormist
    I have my columns set as follows: colModel : [ {display: 'column1', name : 'column1', width : 200, sortable : true, align: 'center'}, {display: 'column2', name : 'column2', width : 100, sortable : true, align: 'left'}, {display: 'column3', name : 'column3', width : 100, sortable : true, align: 'left'}, {display: 'column4', name : 'column4', width : 300, sortable : true, align: 'left'}, ], I set my data source to a url that returns xml. The xml is like this: <?xml version="1.0"?> <items_list> <item> <column1>BlahBlah</column1> <column2>BlahBlah</column2> <column3>BlahBlah</column3> <column4>BlahBlah</column4> </item> <item> <column1>BlahBlah</column1> <column2>BlahBlah</column2> <column3>BlahBlah</column3> <column4>BlahBlah</column4> </item> </items_list> How can I bind the grid to the xml datasource, it doesn't appear to recognize it as it is?

    Read the article

  • populate FusionCharts with XML data AJAX

    - by Mick
    Hi I have a js file that uses ajax to get a XML doc from a php script . The XML file forms the data to draw a Fusion Chart. I know I am getting the XML data ok but FusionCharts will not draw it . I would really appreciate any help , thanks (FusionCharts.js is included earlier in my script) if(XMLHttpRequestObject) { XMLHttpRequestObject.open("GET", "chart.php?job="+job, true); XMLHttpRequestObject.onreadystatechange = function() { if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) { var xdoc = XMLHttpRequestObject.responseXML; var chart1 = new FusionCharts("Pie3D.swf", "chart1Id", "400", "300", "0", "1"); chart1.setDataXML(xdoc); chart1.render("chart1div"); chart.php produces this XML data <chart caption='ADI Chart Test ' > <set label='Driver' value='12.25' /> <set label='Other Staff' value='223.21' /> <set label='Equipment' value='0.00' /> <set label='Additional Items' value='0.00' /> <set label='Vehicle Fuel' value='0.00' /> <set label='Accomodation' value='0.00' /> <set label='Generator Fuel' value='0.00' /> </chart>

    Read the article

  • Having issue Deserializing array from an XML string

    - by LeeHull
    I'm having issues trying to deserializing my xml string that was from a dataset.. Here is the XML layout.. <DataSet> <User> <UserName>Test</UserName> <Email>[email protected]</Email> <Details> <ID>1</ID> <Name>TestDetails</Name> <Value>1</Value> </Details <Details> <ID>2</ID> <Name>Testing</Name> <Value>3</Value> </Details </User> </DataSet> Now I am able to deserialize the "UserName" and "Email" when doing public class User { public string UserName {get;set;} public string Email {get;set;} public Details[] Details {get;set;} } public class Details { public int ID {get;set;} public string Name {get;set;} public string Value {get;set;} } This deserializes fine when I just get the user node, the Details isnt null but has no items in it.. i know I am suppose to have between all the details but I rather not modify the XML, anyways to get this to deserialize properly without recreating the XML after I get it?

    Read the article

  • How to read XML using XPath in Java

    - by kaibuki
    Hi guys, I want to read XML data using XPath in Java, so for the information I have gathered I am not able to parse XML according to my requirement. here is what I want to do: Get XML file from online via its URL, then use XPath to parse it, I want to create two methods in it. One is in which I enter a specific node attribute id, and I get all the child nodes as result, and second is suppose I just want to get a specific child node value only <?xml version="1.0"?><howto> <topic name="Java"> <url>http://www.rgagnonjavahowto.htm</url> <car>taxi</car> </topic> <topic ame="PowerBuilder"> <url>http://www.rgagnon/pbhowto.htm</url> <url>http://www.rgagnon/pbhowtonew.htm</url> </topic> <topic name="Javascript"> <url>http://www.rgagnon/jshowto.htm</url> </topic> <topic name="VBScript"> <url>http://www.rgagnon/vbshowto.htm</url> </topic></howto> In above example I want to read all the elements if I search via @name and also one function in which I just want the url from @name 'Javascript' only return one node element. I hope I cleared my question :) Thanks. Kai

    Read the article

  • WS Libs: com.sun.xml vs javax.xml

    - by Zilvinas
    There are identical classes of java WebServices API & IMPL in those packages groups, only package names are different. http://mvnrepository.com/artifact/javax.xml http://mvnrepository.com/artifact/com.sun.xml Which ones should I use in my code? I would prefer NON-com.sun.* as per java conventions, but still my dependencies ( e.g. Spring ) are using implementations from com.sun.* OR I can't find an implementation package in javax.xml Does anyone have any experience on this?

    Read the article

  • Create xml file to be used in wordpress post import

    - by adedoy
    Alright here is the thing, I have this site that was once wordpress but have been converted into 70+ static pages, the admin is deleted and the whole site is static(which means every page is in index.html), I want to create a script that makes an xml so that I will just have to import it in the new wordpress install. So far, I am able to create an XML but it only imports one post. The data source is the URL of a page and I use jquery $get to filter only to gather the post of a given archive. //html <input type="text" class="full_path"> <input type="button" value="Get Data" class="getdata"> //script $('.getdata').click(function(){ $.get($('.full_path').val(), function(data) { post = $(data).find('div [style*="width:530px;"]'); $('.result').html(post.html()); }); });//get Data Through AJAX I send the cleaned data into a php below that creates the XML: $file = 'newpost.xml'; $post_data = $_REQUEST['post_data']; // Open the file to get existing content $current = file_get_contents($file); // Append a new post to the file $catStr = ''; if(isset($post_data['categories']) && count($post_data['categories']) > 0){ foreach($post_data['categories'] as $category) { $catStr .= '<category domain="category" nicename="'.$category.'"><![CDATA['.$category.']]></category>'; } } $tagStr = ''; if(isset($post_data['tags']) && count($post_data['tags']) > 0){ foreach($post_data['tags'] as $tag) { $tagStr = '<category domain="post_tag" nicename="'.$tag.'"><![CDATA['.$tag.']]></category>'; } } $post_name = str_replace(' ','-',$post_data["title"]); $post_name = str_replace(array('"','/',':','.',',','[',']','“','”'),'',strtolower($post_name)); $post_date = '2011-4-0'.rand(1, 29).''.rand(1, 12).':'.rand(1, 59).':'.rand(1, 59); $pubTime = rand(1, 12).':'.rand(1, 59).':'.rand(1, 59).' +0000'; $post = ' <item> <title>'.$post_data["title"].'</title> <link>'.$post_data["link"].'</link> <pubDate>'.$post_data["date"].' '.$pubTime.'</pubDate> <dc:creator>admin</dc:creator> <guid isPermaLink="false">http://localhost/saunders/?p=1</guid> <description></description> <content:encoded><![CDATA['.$post_data["content"].']]></content:encoded> <excerpt:encoded><![CDATA[]]></excerpt:encoded> <wp:post_id>1</wp:post_id> <wp:post_date>'.$post_date.'</wp:post_date> <wp:post_date_gmt>'.$post_date.'</wp:post_date_gmt> <wp:comment_status>open</wp:comment_status> <wp:ping_status>open</wp:ping_status> <wp:post_name>'.$post_name.'</wp:post_name> <wp:status>publish</wp:status> <wp:post_parent>0</wp:post_parent> <wp:menu_order>0</wp:menu_order> <wp:post_type>post</wp:post_type> <wp:post_password></wp:post_password> <wp:is_sticky>0</wp:is_sticky> '.$catStr.' '.$tagStr.' <wp:postmeta> <wp:meta_key>_edit_last</wp:meta_key> <wp:meta_value><![CDATA[1]]></wp:meta_value> </wp:postmeta> </item> '; // Write the contents back to the file with the appended post file_put_contents($file, $current.$post); After being appended I add the code below to complete the xml rss tag </channel> </rss> If I look and compare the xml file of one that is exported from a wordpress site, I see little difference. Please HELP!! here is a sample of a generated xml: <?xml version="1.0" encoding="UTF-8" ?> <rss version="2.0" xmlns:excerpt="http://wordpress.org/export/1.2/excerpt/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:wp="http://wordpress.org/export/1.2/" > <channel> <title>lols why</title> <link>http://localhost/lols</link> <description>Just another WordPress site</description> <pubDate>Wed, 03 Oct 2012 04:24:04 +0000</pubDate> <language>en-US</language> <wp:wxr_version>1.2</wp:wxr_version> <wp:base_site_url>http://localhost/lols</wp:base_site_url> <wp:base_blog_url>http://localhost/lols</wp:base_blog_url> <wp:author><wp:author_id>1</wp:author_id><wp:author_login>adedoy</wp:author_login><wp:author_email>[email protected]</wp:author_email><wp:author_display_name><![CDATA[adedoy]]></wp:author_display_name><wp:author_first_name><![CDATA[]]></wp:author_first_name><wp:author_last_name><![CDATA[]]></wp:author_last_name></wp:author> <generator>http://wordpress.org/?v=3.4.1</generator> <item> <title>Sample lift?</title> <link>../../breast-lift/delaware-breast-surgery-do-i-need-a-breast-lift/</link> <pubDate>Wed, 03 Oct 2012 9:29:16 +0000</pubDate> <dc:creator>admin</dc:creator> <guid isPermaLink="false">http://localhost/lols/?p=1</guid> <description></description> <content:encoded><![CDATA[<p>sample</p>]]></content:encoded> <excerpt:encoded><![CDATA[]]></excerpt:encoded> <wp:post_id>1</wp:post_id> <wp:post_date>2011-4-0132:45:4</wp:post_date> <wp:post_date_gmt>2011-4-0132:45:4</wp:post_date_gmt> <wp:comment_status>open</wp:comment_status> <wp:ping_status>open</wp:ping_status> <wp:post_name>sample-lift?</wp:post_name> <wp:status>publish</wp:status> <wp:post_parent>0</wp:post_parent> <wp:menu_order>0</wp:menu_order> <wp:post_type>post</wp:post_type> <wp:post_password></wp:post_password> <wp:is_sticky>0</wp:is_sticky> <category domain="category" nicename="Sample Lift"><![CDATA[Sample Lift]]></category><category domain="category" nicename="Sample Procedures"><![CDATA[Yeah Procedures]]></category> <category domain="post_tag" nicename="delaware"><![CDATA[delaware]]></category> <wp:postmeta> <wp:meta_key>_edit_last</wp:meta_key> <wp:meta_value><![CDATA[1]]></wp:meta_value> </wp:postmeta> </item> <item> <title>lalalalalala</title> <link>../../administrative-tips-for-surgery/delaware-cosmetic-surgery-a-better-experience/</link> <pubDate>Wed, 03 Oct 2012 3:20:43 +0000</pubDate> <dc:creator>admin</dc:creator> <guid isPermaLink="false">http://localhost/lols/?p=1</guid> <description></description> <content:encoded><![CDATA[ lalalalalala ]]></content:encoded> <excerpt:encoded><![CDATA[]]></excerpt:encoded> <wp:post_id>1</wp:post_id> <wp:post_date>2011-4-0124:39:30</wp:post_date> <wp:post_date_gmt>2011-4-0124:39:30</wp:post_date_gmt> <wp:comment_status>open</wp:comment_status> <wp:ping_status>open</wp:ping_status> <wp:post_name>lalalalalala</wp:post_name> <wp:status>publish</wp:status> <wp:post_parent>0</wp:post_parent> <wp:menu_order>0</wp:menu_order> <wp:post_type>post</wp:post_type> <wp:post_password></wp:post_password> <wp:is_sticky>0</wp:is_sticky> <category domain="category" nicename="lalalalalala"><![CDATA[lalalalalala]]></category> <category domain="post_tag" nicename="oink"><![CDATA[oink]]></category> <wp:postmeta> <wp:meta_key>_edit_last</wp:meta_key> <wp:meta_value><![CDATA[1]]></wp:meta_value> </wp:postmeta> </item> </channel> </rss> Please tell me what am I missing....

    Read the article

  • How to write CData in xml

    - by Rajesh Rolen- DotNet Developer
    i have an xml like : <?xml version="1.0" encoding="UTF-8"?> <entry> <entry_id></entry_id> <entry_status></entry_status> </entry> i am writing data in it like: XmlNode xnode = xdoc.SelectSingleNode("entry/entry_status"); xnode.InnerText = "<![CDATA[ " + Convert.ToString(sqlReader["story_status"]) + " ]]>" ; but its change "<" to "&lt" of CDATA. Please tell me how to fill values in above xml as a CData format. i know that we can create CDATA like : XmlNode itemDescription = doc.CreateElement("description"); XmlCDataSection cdata = doc.CreateCDataSection("<P>hello world</P>"); itemDescription.AppendChild(cdata); item.AppendChild(itemDescription); but my process is to read node of xml and change its value not to append in it. Thanks

    Read the article

  • XML Serializing a class with a Dictionary<string, List<string>> object

    - by Matt
    Is it possible to implement IXmlSerializable and in my XML file capture an object of type Dictionary ? I have the following public class coolio : IXmlSerializable { private int a; private bool b; private string c; private Dictionary<string, List<string>> coco; public coolio(int _a, bool _b, string _c, Dictionary<string, List<string>> _coco) { a=_a; b=_b; c=_c; coco=_coco; } public System.Xml.Schema.XmlSchema GetSchema() { return null; } public void WriteXml(XmlWriter writer) { const string myType = "coolio"; writer.WriteStartElement(myType); writer.WriteAttributeString("a", a.ToString()); writer.WriteAttributeString("b", b.ToString()); writer.WriteAttributeString("c", c); // How do I add a subelement for Dictionary<string, List<string>> coco? writer.WriteEndElement(); } public void ReadXml(XmlReader reader) { if (reader.MoveToContent() != XmlNodeType.Element || reader.LocalName != "coolio") return; a= int.Parse(reader["a"]); b = bool.Parse(reader["b"]); c= reader["c"]; // How do I read subelement into Dictionary<string, List<string>> coco? } } But I am stumped as to how I could add the Dictionary (XML seriliazed to my XML file)

    Read the article

  • xml attribure in dataset

    - by raging_boner
    I want to bind Repeater control to Dataset which is filled with XML data, but i don't know how to show attributes inside repeater. Xml File: <root> <items> <item id="9" name="111111111111" description="111111245" views="1" galleryID="0" /> </items> </root> Repeater code: <asp:Repeater ID="rptrGalleries" runat="server"> <ItemTemplate> <a href='Page?id=<%#DataBinder.Eval(Container.DataItem, "id") %>'><%#DataBinder.Eval(Container.DataItem, "name") %></a> </ItemTemplate> </asp:Repeater> Codebehind: XDocument doc = XDocument.Load(Server.MapPath("~/xml/gallery.xml")); IEnumerable<XElement> items = from item in doc.Descendants("item") orderby Convert.ToDateTime(item.Attribute("lastChanges").Value) descending where int.Parse(item.Attribute("galleryID").Value) == 0 && bool.Parse(item.Attribute("visible").Value) != false select item; DataSet ds = new DataSet(); ds.ReadXml(new StringReader(doc.ToString())); rptrGalleries.DataSource = ds; rptrGalleries.DataBind(); When I compile site I receive this error: System.Web.HttpException: DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'id'.

    Read the article

  • Output array of XML to plain XML

    - by danit
    I have a script which collects 4 URL's (XML) using CURL and returns an array with 4 items each ocntaining the results of the URL's. Here is the array: array(3) { [0]=> string(41772) "<?xml version="1.0" encoding="UTF-8"?> <statuses type="array"> <status> <created_at>Tue Mar 30 20:58:53 +0000 2010</created_at> <id>11328253513</id> <text>...</text> <source...</source> <truncated>false</truncated> <in_reply_to_status_id></in_reply_to_status_id> <in_reply_to_user_id></in_reply_to_user_id> <favorited>true</favorited> <in_reply_to_screen_name></in_reply_to_screen_name> <user> <id>1...</id> <name>....</name> </status> </statuses> " [1]=> string(20630) "<?xml version="1.0" encoding="UTF-8"?> <statuses type="array"> <status> <created_at>Sun Feb 28 14:12:30 +0000 2010</created_at> <id>...</id> <text>...</text> <source>&lt;a etc... How can I easily output the XML from the array? I also need to combine the 3 XML structures into one where begins and ends in between each array.

    Read the article

  • XmlDocument.Load() throws XmlSchemaValidationException

    - by Praetorian
    Hi, I'm trying to validate an XML document against a schema (which is embedded in my program as a resource). I got everything to work, so I tried to test for errors by adding a second sibling node in the XML at a location where the schema specifies maxOccurs="1". The problem is that my ValidationEventHandler is never getting called, also XmlDocument.Load() is throwing an XmlSchemaValidationException exception when I'd expected XmlDocument.Validate() to do that. This is the code I have: private void ValidateUserData( string xmlPath ) { var resInfo = Application.GetResourceStream( new Uri( @"MySchema.xsd", UriKind.Relative ) ); var schema = XmlSchema.Read( resInfo.Stream, SchemaValidationCallBack ); XmlSchemaSet schemaSet = new XmlSchemaSet(); schemaSet.Add( schema ); schemaSet.ValidationEventHandler += SchemaValidationCallBack; XmlReaderSettings settings = new XmlReaderSettings(); settings.Schemas = schemaSet; settings.ValidationType = ValidationType.Schema; XmlDocument doc = new XmlDocument(); using( XmlReader reader = XmlReader.Create( xmlPath, settings ) ) { doc.Load( reader ); // <-- This line throws an exception if XML is ill-formed reader.Close(); } doc.Validate( SchemaValidationCallBack );// <-- This is never reached } private void SchemaValidationCallBack( object sender, ValidationEventArgs e ) { Console.WriteLine( "SchemaValidationCallBack: " + e.Message ); } How do I get the callback to be called so I can handle validation errors? Thanks for your help!

    Read the article

  • PHP XML Parsing

    - by ashchawla
    Hi I am making get request in PHP but the parser is having issues. I am looking for a way to retreive the value of URL in the following example. The response xml looks like this. <?xml version="1.0" encoding="iso-8859-1" standalone="no"?> <testtemplate JobName="test1"> <Sources> <Source xmlns="http://www.microsoft.com/test/schema/api"> <System> <SystemIdentifier>HTTPS</SystemIdentifier> <URL>http://example.com</URL> </System> </Source> </Sources> <testtemplate> and my PHP code looks like this: $xml = DOMDocument::LoadXML($response); $mypath = new DOMXPath($xml); $mypath->registerNamespace("a", "http://www.microsoft.com/test/schema/api"); $url = $mypath->evaluate("/testtemplate/Sources/Source/System/URL"); $message = $url->item(0)->value; print($message); Any help would be appreciated. Thanks Ashish

    Read the article

  • Add xml-stylesheet and get standalone = yes.

    - by tumba25
    The code at the bottom is what I have. I removed the creation of all tags. At the top in the xml file I get.<?xml version="1.0" encoding="UTF-8" standalone="no"?> Note that standalone is no, even thou I have it set to yes. The first question: How do I get standalone = yes? I would like to add <?xml-stylesheet type="text/xsl" href="my.stylesheet.xsl"?> at line two in the xml file. Second question: How do I do that? Some useful links? Anything? DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = dbfac.newDocumentBuilder(); Document doc = docBuilder.newDocument(); <cut> TransformerFactory transfac = TransformerFactory.newInstance(); transfac.setAttribute("indent-number", new Integer(2)); Transformer trans = transfac.newTransformer(); trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); trans.setOutputProperty(OutputKeys.STANDALONE, "yes"); trans.setOutputProperty(OutputKeys.INDENT, "yes"); trans.setOutputProperty(OutputKeys.CDATA_SECTION_ELEMENTS, "name"); FileOutputStream fout = new FileOutputStream(filepath); BufferedOutputStream bout= new BufferedOutputStream(fout); trans.transform(new DOMSource(doc), new StreamResult(new OutputStreamWriter(bout, "utf-8")));

    Read the article

  • Exporting data to an accounting system for billing and invoicing - is there any generic standard pra

    - by Ali
    Hi guys, I've built a web application which basically logs work that has been done upon projects plus maintain resources used etc. What I need now is to set it up so that projects can be billed. Billed such that - each task that has been undertaken in a project is regarded as a billable service. Instead of building my own invoicing system and accounts management system I was wondering if there was any standard data format i.e in xml DTD or so to which I could set up the information so it could be imported by a third party accounting system for billing - or if not then what is the best way to accomplish this. I need to integrate invoicing capabilities somehow - better if its third party as I don't wish to have to go through building an entire accounting system.

    Read the article

  • Producing a static HTML site from XML content

    - by Skilldrick
    I have a long document in XML from which I need to produce static HTML pages (for distribution via CD). I know (to varying degrees) JavaScript, PHP and Python. The current options I've considered are listed here: I'm not ruling out JavaScript, so one option would be to use ajax to dynamically load the XML content into HTML pages. Learn some basic XSLT and produce HTML to the correct spec this way. Produce the site with PHP (for example) and then generate a static site. Write a script (in Python for example) to convert the XML into HTML. This is similar to the XSLT option but without having to learn XSLT. Useful information: The XML will likely change at some point, so I'd like to be able to easily regenerate the site. I'll have to produce some kind of menu for jumping around the document (so I'll need to produce some kind of index of the content). I'd like to know if anyone has any better ideas that I haven't thought of. If not, I'd like you to tell me which of my options seems the most sensible. I think I know what I'm going to do, but I'd like a second opinion. Thanks.

    Read the article

< Previous Page | 44 45 46 47 48 49 50 51 52 53 54 55  | Next Page >