Search Results

Search found 16532 results on 662 pages for 'xml serialization'.

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

  • Detecting Xml namespace fast

    - by Anna Tjsoken
    Hello there, This may be a very trivial problem I'm trying to solve, but I'm sure there's a better way of doing it. So please go easy on me. I have a bunch of XSD files that are internal to our application, we have about 20-30 Xml files that implement datasets based off those XSDs. Some Xml files are small (<100Kb), others are about 3-4Mb with a few being over 10Mb. I need to find a way of working out what namespace these Xml files are in order to provide (something like) intellisense based off the XSD. The implementation of this is not an issue - another developer has written the code for this. But I'm not sure the best (and fastest!) way of detecting the namespace is without the use of XmlDocument (which does a full parse). I'm using C# 3.5 and the documents come through as a Stream (some are remote files). All the files are *.xml (I can detect if it was extension based) but unfortunately the Xml namespace is the only way. Right now I've tried XmlDocument but I've found it to be innefficient and slow as the larger documents are awaiting to be parsed (even the 100Kb docs). public string GetNamespaceForDocument(Stream document); Something like the above is my method signature - overloads include string for "content". Would a RegEx (compiled) pattern be good? How does Visual Studio manage this so efficiently? Another college has told me to find a fast Xml parser in C/C++, parse the content and have a stub that gives back the namespace as its slower in .NET, is this a good idea?

    Read the article

  • Using XML in a Flex Website to Improve SEO

    - by Laxmidi
    Hi, I've got a Flex 3 site called www.brainpinata.com that's a trivia game. Basically, everything in the site is pulled from a database-- the questions, choices, and answers. So, unfortunately, Google doesn't index my content. So, I'm trying to think of ways to improve the situation: A) If I took my database data and put it in an XML file which was in the website's root directory, would this work? Would it violate any Google policy? (The info would be the same as in the db-- so nothing shady.) Would I have to "wire" the XML into my site or would it be enough to just have the XML sitting in the root directory? B) Another idea is to use the noscript tag and load the XML content there. As I understand it Google indexes content that people who have Javascript turned off would see. I know Flex/Actionscript 3, and unfortunately, I don't know how to load XML content with HTML. Does anyone know of an example where a Flex site uses XML for the noscript content? Thank you. -Laxmidi

    Read the article

  • Loop through XML::Simple structure

    - by David
    So I have some xml file like this: <?xml version="1.0" encoding="ISO-8859-1"?> <root result="0" > <settings user="anonymous" > <s n="blabla1" > <v>true</v> </s> <s n="blabla2" > <v>false</v> </s> <s n="blabla3" > <v>true</v> </s> </settings> </root> I want to go through all the settings using the XML Simple. Here's what I have when I print the output with Data::Dumper: $VAR1 = { 'settings' => { 'user' => 'anonymous', 's' => [ { 'n' => 'blabla1', 'v' => 'true' }, { 'n' => 'blabla2', 'v' => 'false' }, { 'n' => 'blabla3', 'v' => 'true' } ] }, 'result' => '0' }; And here's my code $xml = new XML::Simple; $data = $xml->XMLin($file); foreach $s (keys %{ $data->{'settings'}->{'s'} }) { print "TEST: $s $data->{'settings'}->{'s'}->[$s]->{'n'} $data->{'settings'}->{'s'}->[$s]->{'v'}<br>\n"; } And it returns these 2 lines, without looping: TEST: n blabla1 true TEST: v blabla1 true I also tried to do something like this: foreach $s (keys %{ $data->{'settings'}->{'s'} }) { Without any success: Type of arg 1 to keys must be hash (not array dereference) How can I procede? What am I doing wrong? Thanks a lot!

    Read the article

  • Conditional attribute in XML - most concise solution?

    - by Lech Rzedzicki
    I am tasked with setting up conditional profiling - a method of tagging chunks of XML with an attribute, which will then be used as a conditional value to extract subset of that XML. Have a look at another definition/example: DITA profiling The XML is documents that are equivalent to printed books - i.e. documents that are often looked at by a human, even if indirectly. Therefore I am looking at a few requirements here: 1. keeping the value list brief - so it doesn't affect the readability of the document 2. be able to process with standard XML tools - a space-separated list inside an attribute is still probably fine, but I'd rather not use too much regexp for this 3. be obvious for various users, including 3rd parties, which content goes where 4. Be easy to maintain going forward Therefore one easy solution is: The problem with this: 1. As the list grows the value of the attribute can be a bit verbose 2. One needs to explicitly state every value even if it's a scenario of this vs everything else Therefore I am also looking at other approaches such as: 1. Using + and - modifiers, Apache htaccess style to override the default cascading of profiling - by default all content goes everywhere and if we want to exclude a bit we just say "-kindle". It does require parsing the whole tree, is not supported by editing tools and one needs to regexp the attribute value a bit deeper... 2. Using an intermediate file to define groups of values such as "other" or "non-print", example of this in DITA. It allows concise XML as well as different grouping and values for each document but it does create a certain level of abstraction which may make it a little less obvious for a 3rd party? Altogether, if you received such XML and were tasked to process it, which option you'd rather receive? If you have any experiences like that, even in an unrelated areas such a builds, don't hesitate to comment!

    Read the article

  • 'Binary XML' for game data?

    - by bluescrn
    I'm working on a level editing tool that saves its data as XML. This is ideal during development, as it's painless to make small changes to the data format, and it works nicely with tree-like data. The downside, though, is that the XML files are rather bloated, mostly due to duplication of tag and attribute names. Also due to numeric data taking significantly more space than using native datatypes. A small level could easily end up as 1Mb+. I want to get these sizes down significantly, especially if the system is to be used for a game on the iPhone or other devices with relatively limited memory. The optimal solution, for memory and performance, would be to convert the XML to a binary level format. But I don't want to do this. I want to keep the format fairly flexible. XML makes it very easy to add new attributes to objects, and give them a default value if an old version of the data is loaded. So I want to keep with the hierarchy of nodes, with attributes as name-value pairs. But I need to store this in a more compact format - to remove the massive duplication of tag/attribute names. Maybe also to give attributes native types, so, for example floating-point data is stored as 4 bytes per float, not as a text string. Google/Wikipedia reveal that 'binary XML' is hardly a new problem - it's been solved a number of times already. Has anyone here got experience with any of the existing systems/standards? - are any ideal for games use - with a free, lightweight and cross-platform parser/loader library (C/C++) available? Or should I reinvent this wheel myself? Or am I better off forgetting the ideal, and just compressing my raw .xml data (it should pack well with zip-like compression), and just taking the memory/performance hit on-load?

    Read the article

  • How do I speed up XML parsing operation?

    - by absentx
    I currently have a php script set up to do some xml parsing. Sometimes the script is set as an on page include and other times it is accessed via an ajax call. The problem is the load time for this particular page is very long. I started to think that the php I had written to find what I need in the XML was written poorly and my script is very resource intense. After much research and testing the problem is indeed not my scripting (well perhaps you could consider it a problem with my scripting), but it looks like it takes a long time to load the particular xml sources. My code is like such: $source_recent = 'my xml feed'; $source_additional = 'the other feed I need'; $xmlstr_recent = file_get_contents($source_recent); $feed_recent = new SimpleXMLElement($xmlstr_recent); $xmlstr_additional = file_get_contents($source_additional); $feed_additional = new SimpleXMLElement($xmlstr_additional); In all my testing, the above code is what takes the time, not the additional processing I do below. Is there anyway around this or am I at the mercy of the load time of the xml URL's? One crazy thought I had to get around it is to load the xml contents into a db every so often, then just query the db for what I need. Thoughts? Ideas?

    Read the article

  • XML documentation to context sensitive help

    - by Yonas
    These days a number of commercial and open source tools have been developed for this purpose. However(unfortunately), non of them meet my requirement for specific problem I am dealing with. Currently, I am working on a project that exposes a different classes and functions to user as scripting interface. the user can use the objects from custom scripting interface and call methods to solve some specific problem. The problem I am facing is users of my classes need some sort of documentation in order to write their script efficiently. To address this problem am planing to use the compiler generated XML file to provide context sensitive help, which allows users to mouse over on any of the controls and corresponding methods from the GUI and read the reference documentation of the class/method. Now ... here are my questions: Can I get the sample source code? Can any one give me someone point me to some sort of best approach to address the problem?

    Read the article

  • Deserialized xml - check if has child nodes without knowing specific type

    - by AndyC
    I have deserialized an xml file into a C# object and have an "object" containing a specific node I have selected from this file. I need to check if this node has child nodes. I do not know the specific type of the object at any given time. At the moment I am just re-serializing the object into a string, and loading it into an XmlDocument before checking the HasChildNodes property, however when I have thousands of nodes to check this is extremely resource intensive and slow. Can anyone think of a better way I can check if the object I have contains child nodes? Many thanks :)

    Read the article

  • Merging two XML files into one XML file using Java

    - by dmurali
    I am stuck with how to proceed with combining two different XML files(which has the same structure). When I was doing some research on it, people say that XML parsers like DOM or StAX will have to be used. But cant I do it with the regular IOStream? I am currently trying to do with the help of IOStream but this is not solving my purpose, its being more complex. For example, What I have tried is; public class GUI { public static void main(String[] args) throws Exception { // Creates file to write to Writer output = null; output = new BufferedWriter(new FileWriter("C:\\merged.xml")); String newline = System.getProperty("line.separator"); output.write(""); // Read in xml file 1 FileInputStream in = new FileInputStream("C:\\1.xml"); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; while ((strLine = br.readLine()) != null) { if (strLine.contains("<MemoryDump>")){ strLine = strLine.replace("<MemoryDump>", "xmlns:xsi"); } if (strLine.contains("</MemoryDump>")){ strLine = strLine.replace("</MemoryDump>", "xmlns:xsd"); } output.write(newline); output.write(strLine); System.out.println(strLine); } // Read in xml file 2 FileInputStream in = new FileInputStream("C:\\2.xml"); BufferedReader br1 = new BufferedReader(new InputStreamReader(in)); String strLine1; while ((strLine1 = br1.readLine()) != null) { if (strLine1.contains("<MemoryDump>")){ strLine1 = strLine1.replace("<MemoryDump>", ""); } if (strLine1.contains("</MemoryDump>")){ strLine1 = strLine1.replace("</MemoryDump>", ""); } output.write(newline); output.write(strLine1); I request you to kindly let me know how do I proceed with merging two XML files by adding additional content as well. It would be great if you could provide me some example links as well..! Thank You in Advance..! System.out.println(strLine1); } }

    Read the article

  • Raw XML Push from input stream captures only the first line of XML

    - by pqsk
    I'm trying to read XML that is being pushed to my java app. I originally had this in my glassfish server working. The working code in glassfish is as follows: public class XMLPush implements Serializable { public void processXML() { StringBuilder sb = new StringBuilder(); BufferedReader br = null; try { br = ((HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest()).getReader (); String s = null; while((s = br.readLine ()) != null) { sb.append ( s ); } //other code to process xml ........... ............................. }catch(Exception ex) { XMLCreator.exceptionOutput ( "processXML","Exception",ex); } .... ..... }//processXML }//class It works perfect, but my client is unable to have glassfish on their server. I tried grabbing the raw xml from php, but I couldn't get it to work. I decided to open up a socket and listen for the xml push manually. Here is my code for receiving the push: public class ListenerService extends Thread { private BufferedReader reader = null; private String line; public ListenerService ( Socket connection )thows Exception { this.reader = new BufferedReader ( new InputStreamReader ( connection.getInputStream () ) ); this.line = null; }//ListenerService @Override public void run () { try { while ( (this.line = this.reader.readLine ()) != null) { System.out.println ( this.line ); ........ }//while } System.out.println ( ex.toString () ); } } catch ( Exception ex ) { ... }//catch }//run I haven't done much socket programing, but from what I read for the past week is that passing the xml into a string is bad. What am I doing wrong and why is it that in glassfish server it works, and when I just open a socket myself it doesn't? this is all that I receive from the push: PUT /?XML_EXPORT_REASON=ResponseLoop&TIMESTAMP=1292559547 HTTP/1.1 Host: ************************ Accept: */* Content-Length: 470346 Expect: 100-continue <?xml version="1.0" encoding="UTF-8" ?> Where did the xml go? Is it because I am placing it in a string? I just need to grab the xml and save it into a file and then process it. Everything else works, but this.Any help would be greatly appreciated.

    Read the article

  • C# Serialization lock out

    - by Greycrow
    When I try to Serialize a class to an xml file I get the exception: The process cannot access the file 'C:\settings.xml' because it is being used by another process. Settings currentSettings = new Settings(); public void LoadSettings() { //Load Settings from XML file try { Stream stream = File.Open("settings.xml", FileMode.Open); XmlSerializer s = new XmlSerializer(typeof(Settings)); currentSettings = (Settings)s.Deserialize(stream); stream.Close(); } catch //Can't read XML - use default settings { currentSettings.Name = GameSelect.Items[0].ToString(); currentSettings.City = MapSelect.Items[0].ToString(); currentSettings.Country = RaceSelect.Items[0].ToString(); } } public void SaveSettings() { //Save Settings to XML file try { Stream stream = File.Open("settings.xml", FileMode.Create); XmlSerializer x = new XmlSerializer(typeof(Settings)); x.Serialize(stream, currentSettings); stream.Close(); } catch { MessageBox.Show("Unable to open XML File - File in use by other process"); } It appears that when I Deserialize it locks the file for writing back, even if I closed the stream. Thanks in advance.

    Read the article

  • ???????/?????????XML?? ~Oracle????XML~

    - by Yusuke.Yamamoto
    ????? ??:2010/08/25 ??:??????/?? Oracle Database ?XML???????????????????????????????????????????? Oracle Database ?XML???????Oracle Database ? XPath ???Oracle Database ? XQuery ???Oracle Database ????????????XML???????Oracle Database ?XML??????????????????"2?"?????? ????????? ????????????????? http://otndnld.oracle.co.jp/ondemand/otn-seminar/movie/XML2_08251330.wmv http://www.oracle.com/technetwork/jp/content/open-0825-xmlfesta2-251028-ja.pdf

    Read the article

  • Build XML document using Linq To XML

    - by JasonDR
    Given the following code: string xml = ""; //alternativley: string xml = "<people />"; XDocument xDoc = null; if (!string.IsNullOrEmpty(xml)) { xDoc = XDocument.Parse(xml); xDoc.Element("people").Add( new XElement("person", "p 1") ); } else { xDoc = new XDocument(); xDoc.Add(new XElement("people", new XElement("person", "p 1") )); } As you can see, if the xml variable is blank, I need to create the rood node manually, and append the person the root node, whereas if it is not, I simple add to the people element My question is, is there any way to generically create the document, where it will add all referenced node automatically if they do not already exists?

    Read the article

  • android sdk main.out.xml parsing error?

    - by mobibob
    I just started a new Android project, "WeekendStudy" to continue learning Android development and I got stumped compiling the default 'hello weekendstudy' compile / run. I think that I missed a step in configuration and setup, but I am at a loss to find out where. I have an AVD configured, set and launched. When I press 'run', the SDK is building a file main.out.xml and then fails as this: [2010-03-06 09:46:47 - WeekendStudy]Error in an XML file: aborting build. [2010-03-06 09:46:48 - WeekendStudy]res/layout/main.xml:0: error: Resource entry main is already defined. [2010-03-06 09:46:48 - WeekendStudy]res/layout/main.out.xml:0: Originally defined here. [2010-03-06 09:46:48 - WeekendStudy]/Users/mobibob/Projects/workspace-weekend/WeekendStudy/res/layout/main.out.xml:1: error: Error parsing XML: no element found [2010-03-06 09:48:16 - WeekendStudy]Error in an XML file: aborting build. [2010-03-06 09:48:16 - WeekendStudy]res/layout/main.xml:0: error: Resource entry main is already defined. [2010-03-06 09:48:16 - WeekendStudy]res/layout/main.out.xml:0: Originally defined here. [2010-03-06 09:48:16 - WeekendStudy]/Users/mobibob/Projects/workspace-weekend/WeekendStudy/res/layout/main.out.xml:1: error: Error parsing XML: no element found [2010-03-06 09:55:29 - WeekendStudy]res/layout/main.xml:0: error: Resource entry main is already defined. [2010-03-06 09:55:29 - WeekendStudy]res/layout/main.out.xml:0: Originally defined here. [2010-03-06 09:55:29 - WeekendStudy]/Users/mobibob/Projects/workspace-weekend/WeekendStudy/res/layout/main.out.xml:1: error: Error parsing XML: no element found [2010-03-06 09:55:49 - WeekendStudy]Error in an XML file: aborting build. [2010-03-06 09:55:49 - WeekendStudy]res/layout/main.xml:0: error: Resource entry main is already defined. [2010-03-06 09:55:49 - WeekendStudy]res/layout/main.out.xml:0: Originally defined here. [2010-03-06 09:55:49 - WeekendStudy]/Users/mobibob/Projects/workspace-weekend/WeekendStudy/res/layout/main.out.xml:1: error: Error parsing XML: no element found

    Read the article

  • Parsing XML in a non-XML column

    - by slugster
    Hi, i am reasonably proficient with SQLServer, but i'm not a DBA so i'm not sure how to approach this. I have an XML chunk stored in an ntext column. Due to it being a legacy database and the requirements of the project i cannot change the table (yet). This is an example of the data i need to manipulate: <XmlSerializableHashtable xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Entries> <Entry> <key xsi:type="xsd:string">CurrentYear</key><value xsi:type="xsd:string">2010</value> </Entry> <Entry> <key xsi:type="xsd:string">CurrentMonth</key><value xsi:type="xsd:string">4</value> </Entry> </Entries> </XmlSerializableHashtable> each row will have a chunk like this, but obviously with different keys/values in the XML. Is there any clever way i can parse this XML in to a name/value pairs style view? Or should i be using SQLServer's XML querying abilities even though it isn't an XML column? If so, how would i query a specific value out of that column? (Note: adding a computed XML column on the end of the table is a possibility, if that helps). Thanks for any assistance!

    Read the article

  • XML Deserialization in VB/VBA

    - by oharab
    I have a set of VBA classes in an MS Access database. I have an xml string with data I want to create new classes with. Other than setting each property individually, is there an easy way to deserialize the XML into my object? I've seen the code using the TypeLib library Public Sub ISerializable_Deserialize(xml As IXMLDOMNode) Dim tTLI As TLIApplication Dim tInvoke As InvokeKinds Dim tName As String Dim tMem As MemberInfo tInvoke = VbLet For Each tMem In TLI.ClassInfoFromObject(Me).Members tName = LCase(tMem.Name) CallByName Me, tMem.Name, VbLet, xml.Attributes.getNamedItem(tName).Text Next tMem End Sub but this doesn't seem to work with the standard class modules. I get a 429 error: ActiveX Component Cannot Be Created Can anyone else help me out? I'd rather not have to set each propery by hand if I can help it, some of these classes are huge!

    Read the article

  • can a valid xml body have escaped characters for the '<' and '>' around the element names

    - by prmatta
    My web service is receiving xml from a third party that looks like this: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Body> &lt;Foo&gt;bar&lt;/Foo&gt; </SOAP-ENV:Body> </SOAP-ENV:Envelope> My jaxws web service rejects this with a parsing error. Also if I try to validate this xml using soapui it says Body with element-only content type cannot have text element. My question is, is that xml valid? Or is the client supposed to send me something without escaping the < and . Any references to xml standards or rules are appreciated.

    Read the article

  • Binding XML in Sliverlight without Nominal Classes

    - by AnthonyWJones
    Lets say I have a simple chunck of XML:- <root> <item forename="Fred" surname="Flintstone" /> <item forename="Barney" surname="Rubble" /> </root> Having fetched this XML in Silverlight I would like to bind it with xaml of this ilke:- <ListBox x:Name="ItemList" Style="{StaticResource Items}"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBox Text="{Binding Forename}" /> <TextBox Text="{Binding Surname}" /> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> Now I can bind simply enough with LINQ to XML and a nominal class:- public class Person { public string Forename {get; set;} public string Surname {get; set;} } So here is the question, can it be done without this class? IOW coupling between the Sliverlight code and the input XML is limited to the XAML only, other source code is agnostic to the set of attributes on the item element. Edit: The use of XSD is suggested but ultimately it amounts the same thing. XSD-Generated class. Edit: An anonymous class doesn't work, Silverlight can't bind them. Edit: This needs to be two way, the user needs to be able to edit the values and these value end up in the XML. (Changed original TextBlock to TextBox in sample above).

    Read the article

  • Mutating XML in Clojure

    - by mac
    Clojures clojure.xml/parse, clojure.zip/xml-zip and clojure.contrib.zip-filter.xml/xml- are excellent tools for pulling values out of xml, but what if I want to change the xml (the result of clojure.zip/xml-zip) based on what I learn from xml- "queries" and write the result back out as xml? I would have expected that (clojure.contrib.prxml/prxml (clojure.xml/parse xml-content)) spit back xml, but that is not the case.

    Read the article

  • RESTful Web Services: Different XML Representation for the same resource

    - by AlexImmelman
    Hi, I'm developing a REST Web Service using a XML format response and I have some problems (Really, one problem). One of my resources has some final fields so once they're created, they can't be modified. According to that, I need different representations for this resource depending on what I'm doing: Creating or modifiying it. What should I do, give to the user different XML-Schemas for the same resource or write just one XML-Schema and read some fields or not depending on the method I'm being requested?? Thanks

    Read the article

  • LINQ to XML via C#

    - by user70192
    Hello, I'm new to LINQ. I understand it's purpose. But I can't quite figure it out. I have an XML set that looks like the following: <Results> <Result> <ID>1</ID> <Name>John Smith</Name> <EmailAddress>[email protected]</EmailAddress> </Result> <Result> <ID>2</ID> <Name>Bill Young</Name> <EmailAddress>[email protected]</EmailAddress> </Result> </Results> I have loaded this XML into an XDocument as such: string xmlText = GetXML(); XDocument xml = XDocument.Parse(xmlText); Now, I'm trying to get the results into POCO format. In an effort to do this, I'm currently using: var objects = from results in xml.Descendants("Results") select new Results // I'm stuck How do I get a collection of Result elements via LINQ? I'm particularly confused about navigating the XML structure at this point in my code. Thank you!

    Read the article

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