Search Results

Search found 16958 results on 679 pages for 'xml generator'.

Page 19/679 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • IE 7 opens .zip files as XML documents

    - by EdmundG
    When I try clicking on a zip file link on a web page, IE 7 tries to open it as an XML document and displays: The XML page cannot be displayed Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again. I get around this by right-clicking and using Save Target As... Double clicking on a .zip in the file system opens my zip program without problems. How do I fix this problem?

    Read the article

  • How to Create an XML File from an Excel File

    - by nicorellius
    I have an Excel spreadsheet file that has 5 or so columns and hundreds of lines. I need to convert this (export these data) to an XML file. I'm interested in three of the columns and they correspond to these XML tags, where info1 can be followed by info2, info3, etc... <?xml version="1.0" encoding="UTF-8" ?> <list> <info1> <id>111</id> <value>222</value> <des>333</des> </info1> </list> If possible, I would like to avoid building this XML manually. It wouldn't be too much trouble to rearrange the Excel file such that the three columns I'm interested in were in their own file. But then I would need to export those data into an XML file of the above format. Any ideas?

    Read the article

  • DB2 runstats not working for xml columns

    - by Keshav Prasad
    Hello, I am running runstats command to update the runtime statistics of a particular table called "CUSTOMER" in DB2. The customer has two columns- CID (integer) and INFO (xml column). After running the command, if I look into the SYSCOLDIST table, the information for column CID is populated correctly. But there is nothing filled for the INFO xml column. The same happens with a different table that has xml columns. Please help.. Thanks, -Keshav

    Read the article

  • how to recover my xml default icon?

    - by moonway
    My XML files are showing the unknown programs icon, you can see in this picture: i cant revise its icon why? i look it up in the registry i find no error look at the following Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT.xml] @="xmlfile" "Content Type"="text/xml" "PerceivedType"="text" [HKEY_CLASSES_ROOT.xml\PersistentHandler] @="{7E9D8D44-6926-426F-AA2B-217A819A5CCE}" Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\xmlfile] @="@C:\Windows\System32\msxml3r.dll,-1" "EditFlags"=hex:00,00,00,00 "FriendlyTypeName"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,\ 00,6f,00,6f,00,74,00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,\ 32,00,5c,00,6d,00,73,00,78,00,6d,00,6c,00,33,00,72,00,2e,00,64,00,6c,00,6c,\ 00,2c,00,2d,00,31,00,00,00 [HKEY_CLASSES_ROOT\xmlfile\BrowseInPlace] [HKEY_CLASSES_ROOT\xmlfile\CLSID] @="{48123BC4-99D9-11D1-A6B3-00C04FD91555}" [HKEY_CLASSES_ROOT\xmlfile\DefaultIcon] @="C:\Windows\System32\msxml3.dll,0" [HKEY_CLASSES_ROOT\xmlfile\shell] @="open" [HKEY_CLASSES_ROOT\xmlfile\shell\edit] [HKEY_CLASSES_ROOT\xmlfile\shell\edit\command] @="\"C:\Program Files\Common Files\Microsoft Shared\OFFICE11\MSOXMLED.EXE\" /verb edit \"%1\"" [HKEY_CLASSES_ROOT\xmlfile\shell\Open] [HKEY_CLASSES_ROOT\xmlfile\shell\Open\Command] @="\"C:\Program Files\Common Files\Microsoft Shared\OFFICE11\MSOXMLED.EXE\" /verb open \"%1\"" [HKEY_CLASSES_ROOT\xmlfile\shell\Open\ddeexec] @="" [HKEY_CLASSES_ROOT\xmlfile\ShellEx] [HKEY_CLASSES_ROOT\xmlfile\ShellEx\IconHandler] @="{AB968F1E-E20B-403A-9EB8-72EB0EB6797E}" can you find something wrong or you can paste your reg hehe i need default reg about xml which is with default associated exe all right!

    Read the article

  • Get XML from Server for Use on Windows Phone

    - by psheriff
    When working with mobile devices you always need to take into account bandwidth usage and power consumption. If you are constantly connecting to a server to retrieve data for an input screen, then you might think about moving some of that data down to the phone and cache the data on the phone. An example would be a static list of US State Codes that you are asking the user to select from. Since this is data that does not change very often, this is one set of data that would be great to cache on the phone. Since the Windows Phone does not have an embedded database, you can just use an XML string stored in Isolated Storage. Of course, then you need to figure out how to get data down to the phone. You can either ship it with the application, or connect and retrieve the data from your server one time and thereafter cache it and retrieve it from the cache. In this blog post you will see how to create a WCF service to retrieve data from a Product table in a database and send that data as XML to the phone and store it in Isolated Storage. You will then read that data from Isolated Storage using LINQ to XML and display it in a ListBox. Step 1: Create a Windows Phone Application The first step is to create a Windows Phone application called WP_GetXmlFromDataSet (or whatever you want to call it). On the MainPage.xaml add the following XAML within the “ContentPanel” grid: <StackPanel>  <Button Name="btnGetXml"          Content="Get XML"          Click="btnGetXml_Click" />  <Button Name="btnRead"          Content="Read XML"          IsEnabled="False"          Click="btnRead_Click" />  <ListBox Name="lstData"            Height="430"            ItemsSource="{Binding}"            DisplayMemberPath="ProductName" /></StackPanel> Now it is time to create the WCF Service Application that you will call to get the XML from a table in a SQL Server database. Step 2: Create a WCF Service Application Add a new project to your solution called WP_GetXmlFromDataSet.Services. Delete the IService1.* and Service1.* files and the App_Data folder, as you don’t generally need these items. Add a new WCF Service class called ProductService. In the IProductService class modify the void DoWork() method with the following code: [OperationContract]string GetProductXml(); Open the code behind in the ProductService.svc and create the GetProductXml() method. This method (shown below) will connect up to a database and retrieve data from a Product table. public string GetProductXml(){  string ret = string.Empty;  string sql = string.Empty;  SqlDataAdapter da;  DataSet ds = new DataSet();   sql = "SELECT ProductId, ProductName,";  sql += " IntroductionDate, Price";  sql += " FROM Product";   da = new SqlDataAdapter(sql,    ConfigurationManager.ConnectionStrings["Sandbox"].ConnectionString);   da.Fill(ds);   // Create Attribute based XML  foreach (DataColumn col in ds.Tables[0].Columns)  {    col.ColumnMapping = MappingType.Attribute;  }   ds.DataSetName = "Products";  ds.Tables[0].TableName = "Product";  ret = ds.GetXml();   return ret;} After retrieving the data from the Product table using a DataSet, you will want to set each column’s ColumnMapping property to Attribute. Using attribute based XML will make the data transferred across the wire a little smaller. You then set the DataSetName property to the top-level element name you want to assign to the XML. You then set the TableName property on the DataTable to the name you want each element to be in your XML. The last thing you need to do is to call the GetXml() method on the DataSet object which will return an XML string of the data in your DataSet object. This is the value that you will return from the service call. The XML that is returned from the above call looks like the following: <Products>  <Product ProductId="1"           ProductName="PDSA .NET Productivity Framework"           IntroductionDate="9/3/2010"           Price="5000" />  <Product ProductId="3"           ProductName="Haystack Code Generator for .NET"           IntroductionDate="7/1/2010"           Price="599.00" />  ...  ...  ... </Products> The GetProductXml() method uses a connection string from the Web.Config file, so add a <connectionStrings> element to the Web.Config file in your WCF Service application. Modify the settings shown below as needed for your server and database name. <connectionStrings>  <add name="Sandbox"        connectionString="Server=Localhost;Database=Sandbox;                         Integrated Security=Yes"/></connectionStrings> The Product Table You will need a Product table that you can read data from. I used the following structure for my product table. Add any data you want to this table after you create it in your database. CREATE TABLE Product(  ProductId int PRIMARY KEY IDENTITY(1,1) NOT NULL,  ProductName varchar(50) NOT NULL,  IntroductionDate datetime NULL,  Price money NULL) Step 3: Connect to WCF Service from Windows Phone Application Back in your Windows Phone application you will now need to add a Service Reference to the WCF Service application you just created. Right-mouse click on the Windows Phone Project and choose Add Service Reference… from the context menu. Click on the Discover button. In the Namespace text box enter “ProductServiceRefrence”, then click the OK button. If you entered everything correctly, Visual Studio will generate some code that allows you to connect to your Product service. On the MainPage.xaml designer window double click on the Get XML button to generate the Click event procedure for this button. In the Click event procedure make a call to a GetXmlFromServer() method. This method will also need a “Completed” event procedure to be written since all communication with a WCF Service from Windows Phone must be asynchronous.  Write these two methods as follows: private const string KEY_NAME = "ProductData"; private void GetXmlFromServer(){  ProductServiceClient client = new ProductServiceClient();   client.GetProductXmlCompleted += new     EventHandler<GetProductXmlCompletedEventArgs>      (client_GetProductXmlCompleted);   client.GetProductXmlAsync();  client.CloseAsync();} void client_GetProductXmlCompleted(object sender,                                   GetProductXmlCompletedEventArgs e){  // Store XML data in Isolated Storage  IsolatedStorageSettings.ApplicationSettings[KEY_NAME] = e.Result;   btnRead.IsEnabled = true;} As you can see, this is a fairly standard call to a WCF Service. In the Completed event you get the Result from the event argument, which is the XML, and store it into Isolated Storage using the IsolatedStorageSettings.ApplicationSettings class. Notice the constant that I added to specify the name of the key. You will use this constant later to read the data from Isolated Storage. Step 4: Create a Product Class Even though you stored XML data into Isolated Storage when you read that data out you will want to convert each element in the XML file into an actual Product object. This means that you need to create a Product class in your Windows Phone application. Add a Product class to your project that looks like the code below: public class Product{  public string ProductName{ get; set; }  public int ProductId{ get; set; }  public DateTime IntroductionDate{ get; set; }  public decimal Price{ get; set; }} Step 5: Read Settings from Isolated Storage Now that you have the XML data stored in Isolated Storage, it is time to use it. Go back to the MainPage.xaml design view and double click on the Read XML button to generate the Click event procedure. From the Click event procedure call a method named ReadProductXml().Create this method as shown below: private void ReadProductXml(){  XElement xElem = null;   if (IsolatedStorageSettings.ApplicationSettings.Contains(KEY_NAME))  {    xElem = XElement.Parse(     IsolatedStorageSettings.ApplicationSettings[KEY_NAME].ToString());     // Create a list of Product objects    var products =         from prod in xElem.Descendants("Product")        orderby prod.Attribute("ProductName").Value        select new Product        {          ProductId = Convert.ToInt32(prod.Attribute("ProductId").Value),          ProductName = prod.Attribute("ProductName").Value,          IntroductionDate =             Convert.ToDateTime(prod.Attribute("IntroductionDate").Value),          Price = Convert.ToDecimal(prod.Attribute("Price").Value)        };     lstData.DataContext = products;  }} The ReadProductXml() method checks to make sure that the key name that you saved your XML as exists in Isolated Storage prior to trying to open it. If the key name exists, then you retrieve the value as a string. Use the XElement’s Parse method to convert the XML string to a XElement object. LINQ to XML is used to iterate over each element in the XElement object and create a new Product object from each attribute in your XML file. The LINQ to XML code also orders the XML data by the ProductName. After the LINQ to XML code runs you end up with an IEnumerable collection of Product objects in the variable named “products”. You assign this collection of product data to the DataContext of the ListBox you created in XAML. The DisplayMemberPath property of the ListBox is set to “ProductName” so it will now display the product name for each row in your products collection. Summary In this article you learned how to retrieve an XML string from a table in a database, return that string across a WCF Service and store it into Isolated Storage on your Windows Phone. You then used LINQ to XML to create a collection of Product objects from the data stored and display that data in a Windows Phone list box. This same technique can be used in Silverlight or WPF applications too. NOTE: You can download the complete sample code at my website. http://www.pdsa.com/downloads. Choose Tips & Tricks, then "Get XML From Server for Use on Windows Phone" from the drop-down. Good Luck with your Coding,Paul Sheriff ** SPECIAL OFFER FOR MY BLOG READERS **Visit http://www.pdsa.com/Event/Blog for a free video on Silverlight entitled Silverlight XAML for the Complete Novice - Part 1.  

    Read the article

  • Performance problems loading XML with SSIS, an alternative way!

    - by AtulThakor
    I recently needed to load several thousand XML files into a SQL database, I created an SSIS package which was created as followed: Using a foreach container to loop through a directory and load each file path into a variable, the “Import XML” dataflow would then load each XML file into a SQL table.       Running this, it took approximately 1 second to load each file which seemed a massive amount of time to parse the XML and load the data, speaking to my colleague Martin Croft, he suggested the use of T-SQL Bulk Insert and OpenRowset, so we adjusted the package as followed:     The same foreach container was used but instead the following SQL command was executed (this is an expression):     "INSERT INTO MyTable(FileDate) SELECT   CAST(bulkcolumn AS XML)     FROM OPENROWSET(         BULK         '" + @[User::CurrentFile]  + "',         SINGLE_BLOB ) AS x"     Using this method we managed to load approximately 20 records per second, much faster…for data loading! For what we wanted to achieve this was perfect but I’ll leave you with the following points when making your own decision on which solution you decide to choose!      Openrowset Method Much faster to get the data into SQL You’ll need to parse or create a view over the XML data to allow the data to be more usable(another post on this!) Not able to apply validation/transformation against the data when loading it The SQL Server service account will need permission to the file No schema validation when loading files SSIS Slower (in our case) Schema validation Allows you to apply transformations/joins to the data Permissions should be less of a problem Data can be loaded into the final form through the package When using a schema validation errors can fail the package (I’ll do another post on this)

    Read the article

  • XML: Multiple roots + text content outside the root. Does anyone do it?

    - by Jeffrey Sweeney
    I have another one of those "is it done in XML" questions (my last one about xml comments hasn't been answered if anyone has a good explanation) I was just wondering if anyone, anywhere would: Use multiple root elements in an XML document Put text content outside of a root element W3C discourages these practices, Javascript's DOMParser doesn't even allow these cases, and I can't think of one sane reason to do either of these things. However, I know how bizarre some implementations of XML have been, so I wouldn't be surprised. Does anyone have any real world examples where this would be done? I will also accept an answer that specifies if other mainstream parsers allow doing either of these.

    Read the article

  • Is it convenient to use a XML/JSON generated based system? [closed]

    - by Marcelo de Assis
    One of my clients insists that we missed a requisite for the project(a little social network, using PHP + MySql), is that all queries are made from XML / JSON static files (using AJAX) and not directly from the database. Edit: The main reason, stated by client, is a way to economize bandwith. Even the file loading, has to be using AJAX, to avoid server side processing. We will still use a database to store and insert data. These XML / JSON files will be (re) generated whenever any data is changed by CMS or users. As the project was developed without this "technique", we'll have a lot of work ahead, so I would like to avoid that. I'm asking if it's convenient to use a XML generated based system, because I think a database is already "optimized" and secure to deal with a lot of data traffic. Other issue I'm afraid of, is a chance of conflict when a user is trying to read a XML/JSON which is being just generated.

    Read the article

  • Unit test: How best to provide an XML input?

    - by TheSilverBullet
    I need to write a unit test which validates the serialization of two attributes of an XML(size ~ 30 KB) file. What is the best way to provide an input for this test? Here are the options I have considered: Add the file to the project and use a file reader Pass the contents of the XML as a string Create the XML through a program and pass it Which is my best option and why? If there is another way which you think is better, I would love to hear it.

    Read the article

  • How can I pass an external instance to the constructor of an object that's being created using the default XNA XML content loader?

    - by Michael
    I'm trying to understand how to use the XNA XML content importer to instantiate non-trivial objects that are more than a collection of basic properties (e.g., a class that inherits from DrawableGameObject or GameObject and requires other things to be passed into its constructor). Is it possible to pass existing external instances (e.g., an instance of the current Game) to the constructor of an object that's being created using the default XNA XML content loader? For example, imagine that I have the following class, inheriting from DrawableGameComponent: public class Character : DrawableGameComponent { public string Name { get; set; } public Character(Game game) : base(game) { } public override void Update(GameTime gameTime) { } public override void Draw(GameTime gameTime) { } } If I had a simple class that did not need other parameters in its constructor (i.e., the Game instance), then I could simply use this XML: <XnaContent> <Asset Type="MyNamespace.Character"> <Name>John Doe</Name> </Asset> </XnaContent> ...and then create an instance of Character using this code: var character = Content.Load<Character>("MyXmlAssetName"); But that won't work because I need to pass the need to pass the Game into the constructor. What's the best way to handle this situation? Is there a way to pass in things like the current Game using the default XNA XML content loader? Do I need to write my own XML loader? (If so, how?) Is there a better object-oriented design that I should be using for my classes? Note: Although I used Game in this example, I'm really just asking how to pass any type of existing instance to my constructors. (For example, I'm using the Farseer Physics Engine, and some of my classes also need a reference to the Farseer World object too.) Thanks in advance.

    Read the article

  • Why do XML namespace URIs use the http scheme?

    - by svick
    A XML namespace should be a URI, but it can use any URI scheme, including those that are not URLs. Then why do all widely used XML namespaces use the http scheme (e.g. http://www.w3.org/XML/1998/namespace), considering that trying to use the URI as an URL by retrieving that document using the HTTP protocol is not guaranteed to do anything useful (and often doesn't)? I understand the usefulness of DNS domains in namespace names to help guarantee uniqueness. But that doesn't require the http scheme, there could be a separate scheme for that (something like namespace:w3.org/XML/1998/namespace). This would avoid the confusion between URIs and URLs, while maintaining domain-based uniqueness.

    Read the article

  • How do I use Content.Load() with raw XML files?

    - by xnanewb
    I'm using the Content.Load() mechanism to load core game definitions from XML files. It works fine, though some definitions should be editable/moddable by the players. Since the content pipeline compiles everything into xnb files, that doesn't work for now. I've seen that the inbuild XNA Song content processor does create 2 files. 1 xnb file which contains meta data for the song and 1 wma file which contains the actual data. I've tried to rebuild that mechanism (so that the second file is the actual xml file), but for some reason I can't use the namespace which contains the IntermediateSerializer class to load the xml (obviously the namespace is only available in a content project?). How can I deploy raw, editable xml files and load them with Content.Load()?

    Read the article

  • Using LINQ to XML, how can I join two sets of data based on ordinal position?

    - by Donald Hughes
    Using LINQ to XML, how can I join two sets of data based on ordinal position? <document> <set1> <value>A</value> <value>B</value> <value>C</value> </set1> <set2> <value>1</value> <value>2</value> <value>3</value> </set2> </document> Based on the above fragment, I would like to join the two sets together such that "A" and "1" are in the same record, "B" and "2" are in the same record, and "C" and "3" are in the same record.

    Read the article

  • Cannot validate xml doc againest a xsd schema (Cannot find the declaration of element 'replyMessage

    - by Daziplqa
    Hi Guyz, I am using the following code to validate an an XML file against a XSD schema package com.forat.xsd; import java.io.IOException; import java.net.URL; import javax.xml.XMLConstants; import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; public class XSDValidate { public void validate(String xmlFile, String xsd_url) { try { SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = factory.newSchema(new URL(xsd_url)); Validator validator = schema.newValidator(); ValidationHandler handler = new ValidationHandler(); validator.setErrorHandler(handler); validator.validate(getSource(xmlFile)); if (handler.errorsFound == true) { System.err.println("Validation Error : "+ handler.exception.getMessage()); }else { System.out.println("DONE"); } } catch (SAXException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } private Source getSource(String resource) { return new StreamSource(XSDValidate.class.getClassLoader().getResourceAsStream(resource)); } private class ValidationHandler implements ErrorHandler { private boolean errorsFound = false; private SAXParseException exception; public void error(SAXParseException exception) throws SAXException { this.errorsFound = true; this.exception = exception; } public void fatalError(SAXParseException exception) throws SAXException { this.errorsFound = true; this.exception = exception; } public void warning(SAXParseException exception) throws SAXException { } } /* * Test */ public static void main(String[] args) { new XSDValidate().validate("com/forat/xsd/reply.xml", "https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor/CyberSourceTransaction_1.53.xsd"); // return error } } As appears, It is a standard code that try to validate the following XML file: <?xml version="1.0" encoding="UTF-8"?> <replyMessage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <merchantReferenceCode>XXXXXXXXXXXXX</merchantReferenceCode> <requestID>XXXXXXXXXXXXX</requestID> <decision>XXXXXXXXXXXXX</decision> <reasonCode>XXXXXXXXXXXXX</reasonCode> <requestToken>XXXXXXXXXXXXX </requestToken> <purchaseTotals> <currency>XXXXXXXXXXXXX</currency> </purchaseTotals> <ccAuthReply> <reasonCode>XXXXXXXXXXXXX</reasonCode> <amount>XXXXXXXXXXXXX</amount> <authorizationCode>XXXXXXXXXXXXX</authorizationCode> <avsCode>XXXXXXXXXXXXX</avsCode> <avsCodeRaw>XXXXXXXXXXXXX</avsCodeRaw> <authorizedDateTime>XXXXXXXXXXXXX</authorizedDateTime> <processorResponse>0XXXXXXXXXXXXX</processorResponse> <authRecord>XXXXXXXXXXXXX </authRecord> </ccAuthReply> </replyMessage> Against the following XSD : https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor/CyberSourceTransaction_1.53.xsd The error is : Validation Error : cvc-elt.1: Cannot find the declaration of element 'replyMessage'. Could you please help me!

    Read the article

  • How do I return pure XML from asmx web service?

    - by User
    I want an asmx webservice with a method GetPeople() that returns the following XML (NOT a SOAP response): <People> <Person> <FirstName>Sara</FirstName> <LastName>Smith</LastName> </Person> <Person> <FirstName>Bill</FirstName> <LastName>Wilson</LastName> </Person> <People/> How can I do this?

    Read the article

  • .NET and XML: How can I read nested namespaces (<abc:xyz:name attr="value"/>)?

    - by Entrase
    Suppose there is an element in XML data: <abc:xyz:name attr="value"/> I'm trying to read it with XmlReader. The problem is that I get XmlException that says The ‘:’ character, hexadecimal value 0x3A, cannot be included in a name I have already declared "abc" namespace. I have also tried adding "abc:xyz" and "xyz" namespaces. But this doesn't help at all. I could replace some text before parsing but there may be some more elegant solution. So what should I do? Here is my code: XmlReaderSettings settings = new XmlReaderSettings() NameTable nt = new NameTable(); XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt); nsmgr.AddNamespace("abc", ""); nsmgr.AddNamespace("xyz", ""); XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None); // So this reader can't read <abc:xyz:name attr="value"/> XmlReader reader = XmlReader.Create(path, settings, context);“

    Read the article

  • Deleting xml file using radio value

    - by ???? ???
    i using php to delete file, but i got table loop like this: <table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table"> <tr class="bg_tableheader"> <th class="table-header-check"><a id="toggle-all" ></a> </th> <th class="table-header-check"><a href="#"><font color="white">Username</font></a> </th> <th class="table-header-check"><a href="#"><font color="white">First Name</font></a></th> <th class="table-header-check"><a href="#"><font color="white">Last Name</font></a></th> <th class="table-header-check"><a href="#"><font color="white">Email</font></a></th> <th class="table-header-check"><a href="#"><font color="white">Group</font></a></th> <th class="table-header-check"><a href="#"><font color="white">Birthday</font></a></th> <th class="table-header-check"><a href="#"><font color="white">Gender</font></a></th> <th class="table-header-check"><a href="#"><font color="white">Age</font></a></th> <th class="table-header-check"><a href="#"><font color="white">Country</font></a></th> </tr> <?php $files = glob('users/*.xml'); foreach($files as $file){ $xml = new SimpleXMLElement($file, 0, true); echo ' <tr> <td></td> <form action="" method="post"> <td class="alternate-row1"><input type="radio" name="file_name" value="'. basename($file, '.xml') .'" />'. basename($file, '.xml') .'</td> <td>'. $xml->name .'&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</td> <td class="alternate-row1">'. $xml->lastname .'</td> <td>'. $xml->email .'</td> <td class="alternate-row1">'. $xml->level .'</td> <td>'. $xml->birthday .'</td> <td class="alternate-row1">'. $xml->gender .'</td> <td>'. $xml->age .'</td> <td class="alternate-row1">'. $xml->country .'</td> </tr>'; } ?> </table> </div> <?php if(isset($_POST['file_name'])){ unlink('users/'.$_POST['file_name']); } ?> <input type="submit" value="Delete" /> </form> so as you can see i got radio value set has basename (xml file name) but from some reason it not working, any idea why is that? Thanks in advance.

    Read the article

  • Retrieve XML from URL

    - by Pl4za
    I am having some problems retrieving a xml from url with the following code: private static String getAlbumArt(String artistName, String albumName){ try{ XMLParser xml_parser = new XMLParser(); String xml = xml_parser.getXmlFromUrl(getAlbumURL(artistName, albumName)); Document doc = xml_parser.getDomElement(xml); NodeList N = doc.getElementsByTagName("album"); Node node = N.item(0); NodeList N2 = node.getChildNodes(); System.out.println("1------"); for (int i = 0; i < N2.getLength(); i++) { Node detailNode = N2.item(i); if (detailNode.getNodeType() == Node.ELEMENT_NODE) { System.out.println("2------"); if (detailNode.getNodeName().equalsIgnoreCase("image")) { String sizeVal = ((Element) detailNode).getAttribute("size"); String url = detailNode.getTextContent(); if (sizeVal.equalsIgnoreCase("large")) { return url; } } } } } catch (Exception e){ } return null; } The xml function which i call in the above code: public String getXmlFromUrl(String url) { String xml = null; try { DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); xml = EntityUtils.toString(httpEntity); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return xml; } getAlbumURL: public static String getAlbumURL(String artist, String album){ return URL_METHOD + METHOD_GETALBUM + AMPERSAND + API_KEY + AMPERSAND + PARAM_ARTIST + artist + AMPERSAND + PARAM_ALBUM + album; } XMLparser: public class XMLParser { // constructor public XMLParser() { } //Get XML from URL public String getXmlFromUrl(String url) { String xml = null; try { DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); xml = EntityUtils.toString(httpEntity); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return xml; } //Get dom element public Document getDomElement(String xml){ Document doc = null; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); try { DocumentBuilder db = dbf.newDocumentBuilder(); InputSource is = new InputSource(); is.setCharacterStream(new StringReader(xml)); doc = db.parse(is); } catch (ParserConfigurationException e) { Log.e("Error: ", e.getMessage()); return null; } catch (SAXException e) { Log.e("Error: ", e.getMessage()); return null; } catch (IOException e) { Log.e("Error: ", e.getMessage()); return null; } return doc; } //Get nod element public final String getElementValue(Node elem ) { Node child; if( elem != null){ if (elem.hasChildNodes()){ for( child = elem.getFirstChild(); child != null; child = child.getNextSibling() ){ if( child.getNodeType() == Node.TEXT_NODE ){ return child.getNodeValue(); } } } } return ""; } //Get element value public String getValue(Element item, String str) { NodeList nlList = item.getElementsByTagName(str).item(0).getChildNodes(); Node nValue = (Node) nlList.item(0); return nValue.getNodeValue(); } } Any ideas ? I seriously don't know what is wrong.. I used this before and it worked.

    Read the article

  • Web.xml: Are url-pattern tags relative to each other?

    - by sixtyfootersdude
    <servlet-mapping> <servlet-name>myName</servlet-name> <url-pattern>/aName</url-pattern> </servlet-mapping> <security-constraint> <web-resource-collection> ... <url-pattern> /* </url-pattern> </web-resource-collection> ... </security-constraint> This is an excerpt from web.xml (using it to configure a jboss/tomcat webservice). Just wondering if the url-pattern in web-resource-collection is relative to the url-pattern in servlet-mapping.

    Read the article

  • XML Schema - how do you conditionally require address elements? (street, city, state, etc)

    - by Sly
    If an address can be composed of child elements: Street, City, State, PostalCode...how do you allow this XML: <Address> <Street>Somestreet</Street> <PostalCode>zip</PostalCode> </Address> and allow this: <Address> <Street>Somestreet</Street> <City>San Jose</City> <State>CA</State> </Address> but not this: <Address> <Street>Somestreet</Street> <City>San Jose</City> </Address> What schema will do such things!?

    Read the article

  • How could I do something like this in a XML schema?

    - by chobo2
    Hi I want to mass create some users and I want to set the users timezone automatically. However I am using timezones generated by this Dictionary<string, TimeZoneInfo> storeZoneName = TimeZoneInfo.GetSystemTimeZones().ToDictionary(z => z.DisplayName); So I need the names to be exactly like the ones this list returns. So can I put like a constraint on that xml node that the name has to exactly match one of the names. So I am guessing I will need to write this list somewhere in the file and that's what I am not sure if you can do something like that in a schema.

    Read the article

  • Web.xml: Are url-pattern tags relitive to each other?

    - by sixtyfootersdude
    <servlet-mapping> <servlet-name>myName</servlet-name> <url-pattern>/aName</url-pattern> </servlet-mapping> <security-constraint> <web-resource-collection> ... <url-pattern> /* </url-pattern> </web-resource-collection> ... </security-constraint> This is an excerpt from web.xml (using it to configure a jboss/tomcat webservice). Just wondering if the url-pattern in web-resource-collection is relative to the url-pattern in servlet-mapping.

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >