Search Results

Search found 15873 results on 635 pages for 'xml deserialization'.

Page 8/635 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Element Based XML Parsing

    - by demos
    I have an XML document which reads like this: <xml> <web:Web> <web:Total>4000</web:Total> <web:Offset>0</web:Offset> </web:Web> </xml> my question is how do I access them using a library like BeautifulSoup in python? xmlDom.web["Web"].Total ? does not work?

    Read the article

  • Element Based XML Parising

    - by demos
    I have an XML document which reads like this: <xml> <web:Web> <web:Total>4000</web:Total> <web:Offset>0</web:Offset> </web:Web> </xml> my question is how do I access them using a library like BeautifulSoup in python? xmlDom.web["Web"].Total ? does not work?

    Read the article

  • Getting multiple data items in an element with linq to xml

    - by Maestro1024
    Getting multiple data items in an element with linq to xml I have an xml file like this <TopLevel> <Inside> Jibba </Inside> <Inside> Jabba </Inside> </TopLevel> I was given said xml and and want to get all the elements. Here is the code I have. var q = from c in loaded.Descendants("TopLevel") select (XElement)c.Element("Inside"); I tried c.Elements but that did not work. What do I need to do to get all of the internal elements? This code just gets the first "Inside" tag.

    Read the article

  • How to modify by loading and saving the same xml file

    - by cynthia hong
    I have a problem with modifying xml file when i first load and then save it with same file path and name. Below is my code. The error is "Access to the path C:\MyApp\Web.config is denied. If i change the path of the xdoc.Save to be different from xdoc.Load, then it will be ok. What is your recommandation to solve this problem? If possible, i need to modify the existing xml file(meaning xml file for loading and saving is the same path). XmlDocument xdoc = new XmlDocument(); xdoc.Load(@"C:\\MyApp\\Web.config"); XmlNode xn = xdoc.SelectSingleNode("//configuration/MyProvider"); XmlElement el = (XmlElement)xn; el.SetAttribute("defaultProvider", "MyCustomValue"); xdoc.Save(@"C:\\MyApp\\Web.config"); Thanks in advance.

    Read the article

  • Linq to xml not able to add new elements

    - by Fore
    We save our xml in a "text" field in the database. So first I check if it exist any xml, if not I create a new xdocument, fill it with the necessary xml. else i just add the new element. Code looks like this: XDocument doc = null; if (item.xmlString == null || item.xmlString == "") { doc = new XDocument(new XDeclaration("1.0", "utf-8", "yes"), new XElement("DataTalk", new XAttribute(XNamespace.Xmlns + "xsi", "http://www.w3.org/2001/XMLSchema-instance"), new XAttribute(XNamespace.Xmlns + "xsd", "http://www.w3.org/2001/XMLSchema"), new XElement("Posts", new XElement("TalkPost")))); } else { doc = XDocument.Parse(item.xmlString); } This is working alright to create a structure, but then the problem appears, when I want to add new TalkPost. I get an error saying incorrectly structured document. The following code when adding new elements: doc.Add(new XElement("TalkPost", new XElement("PostType", newDialog.PostType), new XElement("User", newDialog.User), new XElement("Customer", newDialog.Customer), new XElement("PostedDate", newDialog.PostDate), new XElement("Message", newDialog.Message)));

    Read the article

  • Standard way of allowing general XML data

    - by Greg Jackson
    I'm writing a data gathering and reporting application that takes XML files as input, which will then be read, processed, and stored in a strongly-typed database. For example, an XML file for a "Job" might look like this: <Data type="Job"> <ID>12345</ID> <JobName>MyJob</JobName> <StartDate>04/07/2012 10:45:00 AM</StartDate> <Files> <File name="a.jpeg" path="images\" /> <File name="b.mp3" path="music\mp3\" /> </Files> </Data> I'd like to use a schema to have a standard format for these input files (depending on what type of data is being used, for example "Job", "User", "View"), but I'd also like to not fail validation if there is extra data provided. For example, perhaps a Job has additional properties such as "IsAutomated", "Requester", "EndDate", and so on. I don't particularly care about these extra properties. If they are included in the XML, I'll simply ignore them when I'm processing the XML file, and I'd like validation to do the same, without having to include in the schema every single possible property that a customer might provide me with. Is there a standard way of providing such a schema, or of allowing such a general XML file that can still be validated without resorting to something as naïve (and potentially difficult to deal with) as the below? <Data type="Job"> <Data name="ID">12345</Data> . . . <Data name="Files"> <Data name="File"> <Data name="Filename">a.jpeg</Data> <Data name="path">images</Data> . . . </Data> </Data>

    Read the article

  • Serializing a list of Key/Value pairs to XML

    - by Slauma
    I have a list of key/value pairs I'd like to store in and retrieve from a XML file. So this task is similar as described here. I am trying to follow the advice in the marked answer (using a KeyValuePair and a XmlSerializer) but I don't get it working. What I have so far is a "Settings" class ... public class Settings { public int simpleValue; public List<KeyValuePair<string, int>> list; } ... an instance of this class ... Settings aSettings = new Settings(); aSettings.simpleValue = 2; aSettings.list = new List<KeyValuePair<string, int>>(); aSettings.list.Add(new KeyValuePair<string, int>("m1", 1)); aSettings.list.Add(new KeyValuePair<string, int>("m2", 2)); ... and the following code to write that instance to a XML file: XmlSerializer serializer = new XmlSerializer(typeof(Settings)); TextWriter writer = new StreamWriter("c:\\testfile.xml"); serializer.Serialize(writer, aSettings); writer.Close(); The resulting file is: <?xml version="1.0" encoding="utf-8"?> <Settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <simpleValue>2</simpleValue> <list> <KeyValuePairOfStringInt32 /> <KeyValuePairOfStringInt32 /> </list> </Settings> So neither key nor value of the pairs in my list are stored though the number of elements is correct. Obviously I am doing something basically wrong. My questions are: How can I store the key/value pairs of the list in the file? How can I change the default generated name "KeyValuePairOfStringInt32" of the elements in the list to some other name like "listElement" I'd like to have?

    Read the article

  • PHP Object as XML Document

    - by Sam McAfee
    What is the best way to take a given PHP object and serialize it as XML? I am looking at simple_xml and I have used it to parse XML into objects, but it isn't clear to me how it works the other way around.

    Read the article

  • Complex sorting of XML subnodes in .Net3.5 onwards

    - by MicMit
    XML structure expressed in Xpath kind of Records/Record/Actions/Action/ActionDate the other node on the same level Records/Record/Actions/Action/CTCDate Is there easy or not easy way to sort it on "order by ActionDate,CTCDate" ( in SQL notation ), but per Actions for each selected Record when we iterate somehow ( not per XML file ). File around 50M

    Read the article

  • Best way to get database result as XML?

    - by John
    I am querying a database and getting the result set as an arraylist. I would like to return this list as XML, but not sure how to do it. Does anyone have an example of returning a result set as XML and is using an Arraylist the best way to do this?

    Read the article

  • How to parse deeply nested using LINQ to XML

    - by Picflight
    How do I parse the following XML using LINQ? I need to insert into a database table OrderNumber, ShipAddress, ShipCity, ShipState for each Order & OrderCancelled. Then in a separate table I need to insert OrderId from the Returns/Amount section. <!-- language: lang-xml --> <?xml version="1.0" encoding="utf-8"?> <OrdersReport Date="2012-08-01"> <Client> <ClientId>1</ClientId> <Orders> <Order> <OrderNumber>1</OrderNumber> <ShipAddress>123 Main St.</ShipAddress> <ShipCity>MyCity</ShipCity> <ShipState>AZ</ShipState> </Order> <Order> <OrderNumber>2</OrderNumber> <ShipAddress>111 Main St.</ShipAddress> <ShipCity>OtherCity</ShipCity> <ShipState>AL</ShipState> </Order> <OrderCancelled> <OrderNumber>3</OrderNumber> <ShipAddress>111 Main St.</ShipAddress> <ShipCity>OtherCity</ShipCity> <ShipState>AL</ShipState> </OrderCancelled> </Orders> <Returns> <Amount> <OrderId>2</OrderId> <OrderId>3</OrderId> </Amount> </Returns> </Client> <Client> <ClientId>2</ClientId> <!-- Same Tree structure as Client 1 --> </Client> </OrdersReport> Not sure why the XML is not showing red and blue colors and not indenting properly. :-(

    Read the article

  • Methodology behind fetching large XML data sets in pieces

    - by Jerry Dodge
    I am working on an HTTP Server in Delphi which simply sends back a custom XML dataset. I am not following any type of standard formatting, such as SOAP. I have the system working seamlessly, except one small flaw: When I have a very large dataset to send back to the client, it might take up to 2 minutes for all the data to be transferred. The HTTP Server I'm building is essentially an XML Data based API around a database, implementing the common business rule - therefore, the requests are specific to the data behind the system. When, for example, I fetch a large set of product data, I would like to break this down and send it back piece by piece. However, a single HTTP request calls for a single response. I can't necessarily keep feeding the client with multiple different XML packets unless the client explicitly requests it. I don't have any session management, but rather an API Key. I know if I had sessions, I could keep-alive a dataset temporarily for a client, and they could request bits and pieces of it. However, without session management, I would have to execute the SQL query multiple times (for each chunk of data), and in the mean-time, if that data changes, the "pages" might get messed up, therefore causing items to show on the wrong pages, after navigating to a different page. So how is this commonly handled? What's the methodology behind breaking down a large XML dataset into chunks to save the load?

    Read the article

  • How to structure a XML-based order form using ASP.NET

    - by Brendan
    First question here; please help me if I'm doing something wrong. I'm a graphic designer who's trying to teach himself ASP.NET/C#. My server-side background is PHP/WordPress and some ASP Classic, and when I do code I've hand-coded just about everything since I started learning HTML. So, as I've started to learn .NET, my code has been very manual and procedural. I'm now trying to create a really basic order form that pulls from an XML file to populate the form; there's an image, a title, a price, and selectable quantities. If I was making this form as a static HTML file, I'd have each field named manually and so on postback I could query each field to get the values. But I'm trying to do this dynamically so that I can add/remove items from the form and not have to change the code. In terms of displaying the XML, I rolled my own by loading XmlDocument and using XmlNodeList and a bunch of foreach loops to get things displayed. Then, I learned about <asp:XmlDataSource> and <asp:Repeater>, which made displaying the XML simpler by a large margin. However, I've had a really hard time getting the data that's been submitted on postback (it was implied on SO that there are better ways to get data than nested RepeaterItems). So, what I've learned so far is that you can do things a bunch of different ways in .NET. that's why I thought it'd be good to ask for answers regarding the best way to use ASP.NET to display a XML document and dynamically capture the data that's submitted. Any help is appreciated! I'm using Notepad++ to code .NET 2.0.

    Read the article

  • An XML file or Database?

    - by webnoob
    I am re-writing a section of my site and am trying to decide how much of a rewrite this will be. At the moment I have a web service feed that generates an xml once per day. I then use this xml file on my website to generate the general structure. I am trying to decide if this information should be located in the database or stay in the xml file. The file can range from 4mb - 12mb. The files depth can go on and on so I have to recurse to find the data I want. I use the .NET serializer classes and store the serialized file in a global variable to avoid re-serializing it each time the page is loaded. My reasons for thinking a database would be better are: I would know exactly where I am in the file by using an internal ID so I wouldn't have to recurse the file to get information. I wouldn't have to load / serialize the XML and could just use my already open database connections. Searching for the data in the file would be quicker(?) as I would just perform an SQL query rather than re-cursing the file. Has anyone got any ideas which is better and which option uses more resources on the server or be quicker? EDIT: The file is read every time the web page is loaded (although only serialized once). It isn't written to by standard users (only by an admin task that runs in the middle of the night). This is my initial investigation before mocking up.

    Read the article

  • Stairway to XML: Level 8 - Deleting Data from an XML Instance

    in order to use the modify() method to delete data from typed and untyped XML instances, you must pass an XML DML expression as an argument to the method. That expression must include the delete keyword, along with an XQuery expression that defines the XML component to be deleted. Robert makes it seem simple, as usual. The best way to version control T-SQLSSMS plug-in SQL Source Control connects SVN, TFS, Git, Hg and all others to SQL Server. Learn more.

    Read the article

  • Design for XML mapping scenarios between two different systems [on hold]

    - by deepak_prn
    Mapping XML fields between two systems is a mundane routine in integration scenarios. I am trying to make the design documents look better and provide clear understanding to the developers especially when we do not use XSLT or any other IDE such as jDeveloper or eclipse plugins. I want it to be a high level design but at the same time talk in developer's language. So that there is no requirements that slip under the crack. For example, one of the scenarios goes: the store cashier sells an item, the transaction data is sent to Data management system. Now, I am writing a functional design for the scenario which deals with mapping XML fields between our system and the data management system. Question : I was wondering if some one had to deal with mapping XML fields between two systems? (without XSLT being involved) and if you used a table to represent the fields mapping (example is below) or any other visualization tool which does not break the bank ? I am trying to find out if there is a better way to represent XML mapping in your design documents. The widely accepted and used method seems to be using a simple table such as in the picture to illustrate the mapping. I am wondering if there are alternate ways/ tools to represent such as in Altova:

    Read the article

  • Stairway to XML: Level 7 - Updating Data in an XML Instance

    You need to provide the necessary keywords and define the XQuery and value expressions in your XML DML expression in order to use the modify() method to update element and attribute values in either typed or untyped XML instances in an XML column. Robert Sheldon explains how. "It really helped us isolate where we were experiencing a bottleneck"- John Q Martin, SQL Server DBA. Get started with SQL Monitor today to solve tricky performance problems - download a free trial

    Read the article

  • Convience of mySQL over xml

    - by Bonechilla
    Currently I use XML to store specific information to correctly load a few things such as a list of specfied characters, scenes and music, Once more I use JAXB in combination with standard compression/decompression(ZIP) functionality to store a list of extrenous data. This data is called to add functionality to the character, somewhat like Skills in an RPG. Each skill is seperated into its own XML file with a grandlist which contains the names of each file with their extensions omitted and zipped in folder that gets encrypted. At first using xml was working fine however as the skill list grow i worry about its stability. I was wondering if I should begin storing the data in mySQL. Originally I planned to simply convert everything to JSON over xml but i think possibly mySQL would be a better move. Can anyone inform me of the key difference and pros and cons of each I guess i'm looking for the best way to store the data more conviently and would be easier to operate on. The data is mostly primatives and strings and the only arraylist of values i have i can just concat into a single field and parse later

    Read the article

  • Stairway to XML: Level 5 - The XML exist() and nodes() Methods

    The XML exist() method is used, often in a WHERE clause, to check the existence of an element within an XML document or fragment. The nodes() method lets you shred an XML instance and return the information as relational data. 12 essential tools for database professionalsThe SQL Developer Bundle contains 12 tools designed with the SQL Server developer and DBA in mind. Try it now.

    Read the article

  • Redirect output logs of javax.xml.ws and com.sun.xml.ws

    - by chrisnfoneur
    I am working on a SOAP based web service, with Sun's Metro. I am facing an annoying bug, each time I send a malformed SOAP object to my web service, sun's api spam the System.out with logs like this: javax.xml.ws.WebServiceException: com.sun.istack.XMLStreamException2: org.xml.sax.SAXParseException: cvc-complex-type.4: Attribute 'type' must appear on element 'object'. at com.sun.xml.ws.util.pipe.AbstractSchemaValidationTube.doProcess(AbstractSchemaValidationTube.java:206) at com.sun.xml.ws.util.pipe.AbstractSchemaValidationTube.processRequest(AbstractSchemaValidationTube.java:175) at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:595) at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:554) at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539) at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:436) at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243) at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:444) at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244) at com.sun.xml.ws.transport.http.server.WSHttpHandler.handleExchange(WSHttpHandler.java:106) at com.sun.xml.ws.transport.http.server.WSHttpHandler.handle(WSHttpHandler.java:91) at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:65) at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:54) at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:68) at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:555) at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:65) at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:527) at sun.net.httpserver.ServerImpl$DefaultExecutor.execute(ServerImpl.java:119) at sun.net.httpserver.ServerImpl$Dispatcher.handle(ServerImpl.java:349) at sun.net.httpserver.ServerImpl$Dispatcher.run(ServerImpl.java:321) at java.lang.Thread.run(Thread.java:619) Caused by: com.sun.istack.XMLStreamException2: org.xml.sax.SAXParseException: cvc-complex-type.4: Attribute 'type' must appear on element 'object'. at com.sun.xml.ws.util.xml.StAXSource$1.parse(StAXSource.java:185) at com.sun.xml.ws.util.xml.StAXSource$1.parse(StAXSource.java:170) at org.apache.xerces.jaxp.validation.ValidatorHandlerImpl.validate(Unknown Source) at org.apache.xerces.jaxp.validation.ValidatorImpl.validate(Unknown Source) at javax.xml.validation.Validator.validate(Validator.java:127) at com.sun.xml.ws.util.pipe.AbstractSchemaValidationTube.doProcess(AbstractSchemaValidationTube.java:204) ... 20 more I would like to switch off this log or redirect it to my error/warn/debug.log files used by log4j. I tried to add a rule in my log4j.xml file : <category name="javax.xml.ws"> <priority value="error" /> </category> It didn't worked. So I tried the following trick: java.util.logging.Logger.getLogger("javax.xml.ws.WebServiceException").setLevel( java.util.logging.Level.OFF); it didn't worked neither. Any ideas ? It is not a big issue but it makes my catalina.log getting bigger & bigger and it's not the appropriate place for this kind of log. Chris

    Read the article

  • How to include multiple XML files in a single XML file for deserialization by XmlSerializer in .NET

    - by harrydev
    Hi, is it possible to use the XmlSerializer in .NET to load an XML file which includes other XML files? And how? This, in order to share XML state easily in two "parent" XML files, e.g. AB and BC in below. Example: using System; using System.IO; using System.Xml.Serialization; namespace XmlSerializerMultipleFilesTest { [Serializable] public class A { public int Value { get; set; } } [Serializable] public class B { public double Value { get; set; } } [Serializable] public class C { public string Value { get; set; } } [Serializable] public class AB { public A A { get; set; } public B B { get; set; } } [Serializable] public class BC { public B B { get; set; } public C C { get; set; } } class Program { public static void Serialize<T>(T data, string filePath) { using (var writer = new StreamWriter(filePath)) { var xmlSerializer = new XmlSerializer(typeof(T)); xmlSerializer.Serialize(writer, data); } } public static T Deserialize<T>(string filePath) { using (var reader = new StreamReader(filePath)) { var xmlSerializer = new XmlSerializer(typeof(T)); return (T)xmlSerializer.Deserialize(reader); } } static void Main(string[] args) { const string fileNameA = @"A.xml"; const string fileNameB = @"B.xml"; const string fileNameC = @"C.xml"; const string fileNameAB = @"AB.xml"; const string fileNameBC = @"BC.xml"; var a = new A(){ Value = 42 }; var b = new B(){ Value = Math.PI }; var c = new C(){ Value = "Something rotten" }; Serialize(a, fileNameA); Serialize(b, fileNameB); Serialize(c, fileNameC); // How can AB and BC be deserialized from single // files which include two of the A, B or C files. // Using ideally something like: var ab = Deserialize<AB>(fileNameAB); var bc = Deserialize<BC>(fileNameBC); // That is, so that A, B, C xml file // contents are shared across these two } } } Thus, the A, B, C files contain the following: A.xml: <?xml version="1.0" encoding="utf-8"?> <A xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Value>42</Value> </A> B.xml: <?xml version="1.0" encoding="utf-8"?> <B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Value>3.1415926535897931</Value> </B> C.xml: <?xml version="1.0" encoding="utf-8"?> <C xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Value>Something rotten</Value> </C> And then the "parent" XML files would contain a XML include file of some sort (I have not been able to find anything like this), such as: AB.xml: <?xml version="1.0" encoding="utf-8"?> <AB xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <A include="A.xml"/> <B include="B.xml"/> </AB> BC.xml: <?xml version="1.0" encoding="utf-8"?> <BC xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <B include="B.xml"/> <C include="C.xml"/> </BC> Of course, I guess this can be solved by implementing IXmlSerializer for AB and BC, but I was hoping there was an easier solution or a generic solution with which classes themselves only need the [Serializable] attribute and nothing else. That is, the split into multiple files is XML only and handled by XmlSerializer itself or a custom generic serializer on top of this. I know this should be somewhat possible with app.config (as in http://stackoverflow.com/questions/480538/use-xml-includes-or-config-references-in-app-config-to-include-other-config-files), but I would prefer a solution based on XmlSerializer. Thanks.

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >