Search Results

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

Page 123/739 | < Previous Page | 119 120 121 122 123 124 125 126 127 128 129 130  | Next Page >

  • How to remove a node based on contents of a subnode and then convert to CSV with headers intact

    - by Morris Cox
    I'm downloading a 10MB zipped XML file with wget, unzipping it to 40MB, trying to weed out test and expired entries (if the text of a certain node is "This is a test opportunity. Please DO NOT apply!" or if is in the past), and then convert to CSV. However, I get this error: PHP Notice: Array to string conversion in /home/morris/projects/grantsgov/xml2csv.php on line 46 I get Array errors because some entries in the XML file have more than one occurrence of a node (different text contents). The test entries are still present. Contents of grantsgov.sh: #!/bin/bash wget --clobber "http://www.grants.gov/search/downloadXML.do;jsessionid=1n7GNpNF2tKZnRGLyQqf7Tl32hFJ1zndhfQpLrJJD11TTNzWMwDy!368676377?fname=GrantsDBExtract$(date +'%Y%m%d').zip" -O GrantsDBExtract$(date +"%Y%m%d").zip unzip GrantsDBExtract$(date +"%Y%m%d").zip php xml2csv.php zip GrantsDBExtracted$(date +"%Y%m%d").zip GrantsDBExtracted$(date +"%Y%m%d").csv Contents of xml2csv.php: <? $current_date = date("Ymd"); //$getfile=fopen("http://www.grants.gov/search/downloadXML.do;jsessionid=GqJNNmdLyJyMlsQqTzS2KdzgT5NMdhPp0QhG946JTmHzRltNTpMQ!368676377?fname=GrantsDBExtract$current_date.zip", "r"); $zip = zip_open("GrantsDBExtract$current_date.zip"); if(is_resource($zip)) { while ($zip_entry = zip_read($zip)) { $fp = fopen("./".zip_entry_name($zip_entry), "w"); if (zip_entry_open($zip, $zip_entry, "r")) { $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)); fwrite($fp,"$buf"); zip_entry_close($zip_entry); fclose($fp); } } zip_close($zip); } // For future potential use $xml = new DOMDocument('1.0', 'ascii'); $xpath = new DOMXpath($xml); $xslFile = "feddata.xsl"; $filexml="GrantsDBExtract$current_date.xml"; if (file_exists($filexml)) { $xml = simplexml_load_file($filexml); echo "Loaded $filexml\n"; $xslt = new XSLTProcessor(); $xsl = new DOMDocument(); //$XSL->load('feddata.xsl', LIBXML_NOCDATA); $xsl->load($xslFile, LIBXML_NOCDATA); $xslt->importStylesheet($xsl); $xslt->transformToXML($xml); $f = fopen("GrantsDBExtracted$current_date.csv", 'w'); // create the CSV header row on the first time here $first = FALSE; $fields = array(); foreach($record as $key => $value) { $fields[] = $key; } fwrite($f,implode(";",$fields)."\n"); foreach ($xml->FundingOppSynopsis as $fos) { fputcsv($f, get_object_vars($fos),',','"'); } } fclose($f); } else { exit('Failed to open file.'); } ?> Contents of feddata.xsl: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml"/> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> <xsl:template match="FundingOppSynopsis[AgencyMailingAddress = 'This is a test opportunity. Please DO NOT apply!']"> </xsl:template> </xsl:stylesheet><xsl:strip-space elements="*"/> Part of the XML file: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE Grants SYSTEM "http://www.grants.gov/search/dtd/XMLExtract.dtd"> <Grants> <FundingOppSynopsis> <PostDate>08312007</PostDate> <UserID>None</UserID> <Password>None</Password> <FundingInstrumentType>CA</FundingInstrumentType> <FundingActivityCategory>DPR</FundingActivityCategory> <OtherCategoryExplanation>This is a test opportunity. Please DO NOT apply!</OtherCategoryExplanation> <NumberOfAwards>5</NumberOfAwards> <EstimatedFunding>4</EstimatedFunding> <AwardCeiling>2</AwardCeiling> <AwardFloor>1</AwardFloor> <AgencyMailingAddress>This is a test opportunity. Please DO NOT apply!</AgencyMailingAddress> <FundingOppTitle>This is a test opportunity. Please DO NOT apply!</FundingOppTitle> <FundingOppNumber>IVV-08312007-RG-OPP5</FundingOppNumber> <ApplicationsDueDate>09102007</ApplicationsDueDate> <ApplicationsDueDateExplanation>This is a test opportunity. Please DO NOT apply!</ApplicationsDueDateExplanation> <ArchiveDate>10102007</ArchiveDate> <Location>None</Location> <Office>None</Office> <Agency>None</Agency> <FundingOppDescription>This is a test opportunity. Please DO NOT apply!</FundingOppDescription> <CFDANumber>000000</CFDANumber> <EligibilityCategory>21</EligibilityCategory> <AdditionalEligibilityInfo>This is a test opportunity. Please DO NOT apply!</AdditionalEligibilityInfo> <CostSharing>N</CostSharing> <ObtainFundingOppText FundingOppURL="">Not Available</ObtainFundingOppText> <AgencyContact AgencyEmailDescriptor="This is a test opportunity. Please DO NOT apply!" AgencyEmailAddress="This is a test opportunity. Please DO NOT apply!">This is a test opportunity. Please DO NOT apply!</AgencyContact> </FundingOppSynopsis> How can I fix the error and remove expired entries (based on ArchiveDate)? I suspect the second to last line in feddata.xsl needs to be fixed.

    Read the article

  • Serializing object with no namespaces using DataContractSerializer

    - by Yurik
    How do I remove XML namespaces from an object's XML representation serialized using DataContractSerializer? That object needs to be serialized to a very simple output XML. Latest & greatest - using .Net 4 beta 2 The object will never need to be deserialized. XML should not have any xmlns:... namespace refs Any subtypes of Exception and ISubObject need to be supported. It will be very difficult to change the original object. Object: [Serializable] class MyObj { string str; Exception ex; ISubObject subobj; } Need to serialize into: <xml> <str>...</str> <ex i:nil="true" /> <subobj i:type="Abc"> <AbcProp1>...</AbcProp1> <AbcProp2>...</AbcProp2> </subobj> </xml> I used this code: private static string ObjectToXmlString(object obj) { if (obj == null) throw new ArgumentNullException("obj"); var serializer = new DataContractSerializer( obj.GetType(), null, Int32.MaxValue, false, false, null, new AllowAllContractResolver()); var sb = new StringBuilder(); using (var xw = XmlWriter.Create(sb, new XmlWriterSettings { OmitXmlDeclaration = true, NamespaceHandling = NamespaceHandling.OmitDuplicates, Indent = true })) { serializer.WriteObject(xw, obj); xw.Flush(); return sb.ToString(); } } From this article I adopted a DataContractResolver so that no subtypes have to be declared: public class AllowAllContractResolver : DataContractResolver { public override bool TryResolveType(Type dataContractType, Type declaredType, DataContractResolver knownTypeResolver, out XmlDictionaryString typeName, out XmlDictionaryString typeNamespace) { if (!knownTypeResolver.TryResolveType(dataContractType, declaredType, null, out typeName, out typeNamespace)) { var dictionary = new XmlDictionary(); typeName = dictionary.Add(dataContractType.FullName); typeNamespace = dictionary.Add(dataContractType.Assembly.FullName); } return true; } public override Type ResolveName(string typeName, string typeNamespace, Type declaredType, DataContractResolver knownTypeResolver) { return knownTypeResolver.ResolveName(typeName, typeNamespace, declaredType, null) ?? Type.GetType(typeName + ", " + typeNamespace); } }

    Read the article

  • python unhashable type - posting xml data

    - by eterry28
    First, I'm not a python programmer. I'm an old C dog that's learned new Java and PHP tricks, but python looks like a pretty cool language. I'm getting an error that I can't quite follow. The error follows the code below. import httplib, urllib url = "pdb-services-beta.nipr.com" xml = '<?xml version="1.0"?><!DOCTYPE SCB_Request SYSTEM "http://www.nipr.com/html/SCB_XML_Request.dtd"><SCB_Request Request_Type="Create_Report"><SCB_Login_Data CustomerID="someuser" Passwd="somepass" /><SCB_Create_Report_Request Title=""><Producer_List><NIPR_Num_List_XML><NIPR_Num NIPR_Num="8980608" /><NIPR_Num NIPR_Num="7597855" /><NIPR_Num NIPR_Num="10166016" /></NIPR_Num_List_XML></Producer_List></SCB_Create_Report_Request></SCB_Request>' params = {} params['xmldata'] = xml headers = {} headers['Content-type'] = 'text/xml' headers['Accept'] = '*/*' headers['Content-Length'] = "%d" % len(xml) connection = httplib.HTTPSConnection(url) connection.set_debuglevel(1) connection.request("POST", "/pdb-xml-reports/scb_xmlclient.cgi", params, headers) response = connection.getresponse() print response.status, response.reason data = response.read() print data connection.close Here's the error: Traceback (most recent call last): File "C:\Python27\tutorial.py", line 14, in connection.request("POST", "/pdb-xml-reports/scb_xmlclient.cgi", params, headers) File "C:\Python27\lib\httplib.py", line 958, in request self._send_request(method, url, body, headers) File "C:\Python27\lib\httplib.py", line 992, in _send_request self.endheaders(body) File "C:\Python27\lib\httplib.py", line 954, in endheaders self._send_output(message_body) File "C:\Python27\lib\httplib.py", line 818, in _send_output self.send(message_body) File "C:\Python27\lib\httplib.py", line 790, in send self.sock.sendall(data) File "C:\Python27\lib\ssl.py", line 229, in sendall v = self.send(data[count:]) TypeError: unhashable type My log file says that the xmldata parameter is empty. Any ideas?

    Read the article

  • How do I change the URL for the wordpress author archive page?

    - by Ben Burleson
    Instead of www.example.com/author/xyz, I want to use www.example.com/artist/xyz. I was hoping it was as easy as copying author.php to artist.php in my theme directory, but no such luck. Where does wordpress handle the special processing for the author archive pages? .htaccess rewriting is another option, but I wasn't able to get anything to work with the existing wordpress rewrite rules. Thanks,

    Read the article

  • How to marshall non-string objects with JAXB and Spring

    - by lesula
    I was trying to follow this tutorial in order to create my own restful web-service using Spring framework. The client do a GET request to, let's say http://api.myapp/app/students and the server returns an xml version of the object classroom: @XmlRootElement(name = "class") public class Classroom { private String classId = null; private ArrayList<Student> students = null; public Classroom() { } public String getClassId() { return classId; } public void setClassId(String classId) { this.classId = classId; } @XmlElement(name="student") public ArrayList<Student> getStudents() { return students; } public void setStudents(ArrayList<Student> students) { this.students = students; } } The object Student is another bean containing only Strings. In my app-servlet.xml i copied this lines: <bean id="studentsView" class="org.springframework.web.servlet.view.xml.MarshallingView"> <constructor-arg ref="jaxbMarshaller" /> </bean> <!-- JAXB2 marshaller. Automagically turns beans into xml --> <bean id="jaxbMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"> <property name="classesToBeBound"> <list> <value>com.spring.datasource.Classroom</value> <value>com.spring.datasource.Student</value> </list> </property> </bean> Now my question is: what if i wanted to insert some non-string objects as class variables? Let's say i want a tag containing the String version of an InetAddress, such as <inetAddress>192.168.1.1</inetAddress> How can i force JAXB to call the method inetAddress.toString() in such a way that it appears as a String in the xml? In the returned xml non-string objects are ignored!

    Read the article

  • Data Contract Serialization Not Working For All Elements

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

    Read the article

  • Strategies for serializing an object for auditing/logging purpose in .NET?

    - by Jiho Han
    Let's say I have an application that processes messages. Messages are just objects in this case that implements IMessage interface which is just a marker. In this app, if a message fails to process, then I want to log it, first of all for auditing and troubleshooting purposes. Secondly I might want to use it for re-processing. Ideally, I want the message to be serialized into a format that is human-readable. The first candidate is XML although there are others like JSON. If I were to serialize the messages as XML, I want to know whether the message object is XML-serializable. One way is to reflect on the type and to see if it has a parameter-less constructor and the other is to require IXmlSerializable interface. I'm not too happy with either of these approaches. There is a third option which is to try to serialize it and catch exceptions. This doesn't really help - I want to, in some way, stipulate that IMessage (or a derived type) should be xml-serializable. The reflection route has obvious disadvantages such as security, performance, etc. IXmlSerializable route locks down my messages to one format, when in the future, I might want to change the serialization format to be JSON. The other thing is even the simplest objects now must implement ReadXml and WriteXml methods. Is there a route that involves the least amount of work that lets me serialize an arbitrary object (as long as it implements the marker interface) into XML but not lock future messages into XML?

    Read the article

  • Translate XSD element names to English

    - by Coov
    I have an XML Schema Definition file .XSD who's elements are in Spanish. I have an XML data file that is also in Spanish that matches the schema definition. I created a dataset from the xsd using xsd.exe and I'm loading the XML into the dataset. I want to translate the element names to English. I can think of two options off the top of my head. Either scrape the XSD & XML files and translate the elements prior to generating the dataset with esd.exe, or iterate the dataset after I have loaded it with the xml, and translate my objects. I do have a written document that provides the English names for every element name in Spanish. The problem is there are hundreds of elements and I was trying to avoid coding that manually. Getting precise translations is not that important, it just needs to be readable by an English speaking person. Here is an example of what an element may look like "Apellidos": <xs:element name="Apellidos" type="xs:string"/> that I will translate to "SirName": <xs:element name="SirName" type="xs:string"/> I'm looking for ideas and or opinions on a quick way to do this. It's a one time deal so I'm not working about it scaling or being functional for things other than this single xml file. I'll be taking this dataset and writing out a flat file for English speaking users to read.

    Read the article

  • Flash/Flex sending XML to Rails App

    - by bdicasa
    I'm trying to send some XML to a rails app in Flex. I'm using the URLRequest and URLLoader objects. However, I'm having trouble determining how to send the XML and _method parameter to the rails app using these flash objects. Below is how I'm currently trying to achieve this. var request:URLRequest = new URLRequest(); request.method = URLRequestMethod.POST; request.data = new Object(); request.data.xml = Blog.xml.toXMLString(); request.contentType = "text/xml"; var loader:URLLoader = new URLLoader(); loader.addEventListener(Event.COMPLETE, saveCompleteHandler); var saveUrl:String = ""; saveUrl = BASE_URL; if (Blog.isNewBlog) { // Set the rails REST method. request.data._method = "POST"; saveUrl += "blogs.xml"; } else { // Set the rails REST method. request.data._method = "PUT"; saveUrl += "blogs/" + Blog.id.toString() + ".xml"; } request.url = saveUrl; //trace(request.data.toString()); loader.load(request); However the only data that is getting sent to the server is [Object object]. If some one could let me know where I'm going wrong I'd greatly appreciate it. Thanks.

    Read the article

  • I find a problem with sending receiving parameter

    - by kawtousse
    how to get the xml translation to html dropdownlist with ajax. I send the parameter with GET method but the JSP FILE THAT GENERATES THE XML DONT RECEIVE IT. var url="responsexml.jsp"; url=url+"?projectCode="+prj.options[prj.selectedIndex].value; xmlhttp.onreadystatechange=stateChanged; xmlhttp.open("GET",url,true); xmlhttp.send(null); and then in responsexml.jsp I do like that: <% String projectcode= (String)request.getParameter("projectCode"); System.out.println("++++projectCode:=" +projectcode); Session s = null; Transaction tx; try { s = HibernateUtil.currentSession(); tx = s.beginTransaction(); Query query = s.createQuery("SELECT from Wa wa where wa.ProjectCode='"+projectcode+"'"); response.setContentType("text/xml"); PrintWriter output = response.getWriter(); output.write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>"); //response.setHeader("Cache-Control", "no-cache"); //constriure le xml if(projectcode!=null) { for(Iterator it=query.iterate();it.hasNext();) { if(it.hasNext()) { Wa object=(Wa)it.next(); //out.print( "<item id=\"" +object.getIdWA() + "\" name=\"" + object.getWAName() + "\" />"); output.write("<wa>"); output.write( "<item id=\"" + object.getIdWA() + "\" name=\"" + object.getWAName() + "\" />"); output.write("</wa>"); } } } } catch (HibernateException e) { e.printStackTrace(); } %> </body> </html> With this code I dont have my xml file. I got this error: The server did not understand the request, or the request was invalid. Erreur de traitement de la ressource http://www.w3.o... PLEASE HELP.

    Read the article

  • getting expat to use .dtd for entity replacement in python

    - by nicolas78
    I'm trying to read in an xml file which looks like this <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE dblp SYSTEM "dblp.dtd"> <dblp> <incollection> <author>Jos&eacute; A. Blakeley</author> </incollection> </dblp> The point that creates the problem looks is the Jos&eacute; A. Blakeley part: The parser calls its character handler twice, once with "Jos", once with " A. Blakeley". Now I understand this may be the correct behaviour if it doesn't know the eacute entity. However, this is defined in the dblp.dtd, which I have. I don't seem to be able to convince expat to use this file, though. All I can say is p = xml.parsers.expat.ParserCreate() # tried with and without following line p.SetParamEntityParsing(xml.parsers.expat.XML_PARAM_ENTITY_PARSING_ALWAYS) p.UseForeignDTD(True) f = open(dblp_file, "r") p.ParseFile(f) but expat still doesn't recognize my entity. Why is there no way to tell expat which DTD to use? I've tried putting the file into the same directory as the XML putting the file into the program's working directory replacing the reference in the xml file by an absolute path What am I missing? Thx.

    Read the article

  • XSLT: Transforming into non-xml content?

    - by Ian Boyd
    Is it possible to use XSLT to transform XML into something other than XML? e.g. i want the final non-xml content: <HTML> <BODY> <IMG src="file1.png"><BR> <IMG src="file2.png"><BR> ... <IMG src="filen.png"><BR> </BODY> </HTML> You'll notice this document is HTML, because in HTML IMG and BR tags are forbidden from having a closing tag. This constrasts with xhtml, the reformulation of HTML using xml, where all elements are required from having a closing tag (because in xml every tag must be closed). Is it possible, using XSLT, to generate non-xml output? Another example of non-xml output might be: INSERT INTO Documents (Filename) VALUES ('file1.png') INSERT INTO Documents (Filename) VALUES ('file2.png') ... INSERT INTO Documents (Filename) VALUES ('file3.png') The reason i ask is that as soon as my XSLT contains an <IMG>, the stylesheet contains an error; no closing </IMG>.

    Read the article

  • Get subdomain of XML page from XSL

    - by fudgey
    I am working with a guild hosting site that provides an XML/XSL transformation widget where all I need to do is enter the URL for the XML and XSL and it does the rest. I have written an XSL transform to display a World of Warcraft armory page: Here is an example XML page (view source to see it) of the group I'm trying to help now. So, the user is entering their own XML page url (which has an eu subdomain in this case, but it is not within the XML itself). So when I make links to the character url, I need to add the entire url <a target="_blank" href="http://eu.wowarmory.com/character-sheet.xml?{@url}"> <xsl:value-of select="@name"/> </a> But I can't just set the domain to eu since there are multiple regions. Here are the possibilities: us = www, europe = eu, korea = kr, china = cn and taiwan = tw. Here is a snippet of the XML which shows the url parameters: <character achPoints="4275" classId="3" genderId="0" level="80" name="Virtex" raceId="4" rank="2" url="r=Drek%27Thar&amp;cn=Virtex"/> I guess I could just have the user add a small bit of HTML with their region in another part of their page, something like <div id="region">eu</div>, but I'm trying to make this work without any extra coding on their part. Edit: Ok, my question explicitly stated: How do I get the URL subdomain using XSL?

    Read the article

  • What's the best way to only output a tag if it exists in XSL?

    - by Morinar
    I'm working on an interface with a 3rd party app that basically needs to take XML that was spat out by the app and convert it into XML our system can deal with. It's basically just applying a stylesheet to the original XML to make it looks like "our" XML. I've noticed that in other stylesheets we have, there are constructs like this: <xsl:for-each select="State"> <StateAbbreviation> <xsl:value-of select="."/> </StateAbbreviation> </xsl:for-each> Basically, the "in" XML has a State tag that I need to output as our recognized StateAbbreviation tag. However, I want to ONLY output the StateAbbreviation tag if the "in" XML contains the State tag. The block above accomplishes this just fine, but is not very intuitive (at least it wasn't to me), as every time I see a for-each I assume there is more than one, whereas in these cases there is 0 or 1. My question: is that a standard-ish construct? If not, is there a more preferred way to do it? I could obviously check the string length (which is also being done in other stylesheets), but would like to do it the same, "best" way everywhere (assuming of course that a "best" way exists. Advice? Suggestions?

    Read the article

  • Validate a XDocument against schema without the ValidationEventHandler (for use in a HTTP handler)

    - by Vaibhav Garg
    Hi everyone, (I am new to Schema validation) Regarding the following method, System.Xml.Schema.Extensions.Validate( ByVal source As System.Xml.Linq.XDocument, ByVal schemas As System.Xml.Schema.XmlSchemaSet, ByVal validationEventHandler As System.Xml.Schema.ValidationEventHandler, ByVal addSchemaInfo As Boolean) I am using it as follows inside a IHttpHandler - Try Dim xsd As XmlReader = XmlReader.Create(context.Server.MapPath("~/App_Data/MySchema.xsd")) Dim schemas As New XmlSchemaSet() : schemas.Add("myNameSpace", xsd) : xsd.Close() myXDoxumentOdj.Validate(schemas, Function(s As Object, e As ValidationEventArgs) SchemaError(s, e, context), True) Catch ex1 As Threading.ThreadAbortException 'manage schema error' Return Catch ex As Exception 'manage other errors' End Try The handler- Function SchemaError(ByVal s As Object, ByVal e As ValidationEventArgs, ByVal c As HttpContext) As Object If c Is Nothing Then c = HttpContext.Current If c IsNot Nothing Then HttpContext.Current.Response.Write(e.Message) HttpContext.Current.Response.End() End If Return New Object() End Function This is working fine for me at present but looks very weak. I do get errors when I feed it bad XML. But i want to implement it in a more elegant way. This looks like it would break for large XML etc. Is there some way to validate without the handler so that I get the document validated in one go and then deal with errors? To me it looks Async such that the call to Validate() would pass and some non deterministic time later the handler would get called with the result/errors. Is that right? Thanks and sorry for any goofy mistakes :).

    Read the article

  • JAXB, how to marshal without a namespace

    - by Alvin
    I have a fairly large repetitive XML to create using JAXB. Storing the whole object in the memory then do the marshaling takes too much memory. Essentially, my XML looks like this: <Store> <item /> <item /> <item /> ..... </Store> Currently my solution to the problem is to "hard code" the root tag to an output stream, and marshal each of the repetitive element one by one: aOutputStream.write("<?xml version="1.0"?>") aOutputStream.write("<Store>") foreach items as item aMarshaller.marshall(item, aOutputStream) end aOutputStream.write("</Store>") aOutputStream.close() Somehow the JAXB generate the XML like this <Store xmlns="http://stackoverflow.com"> <item xmlns="http://stackoverflow.com"/> <item xmlns="http://stackoverflow.com"/> <item xmlns="http://stackoverflow.com"/> ..... </Store> Although this is a valid XML, but it just look ugly, so I'm wonder is there any way to tell the marshaller not to put namespace for the item elements? Or is there better way to use JAXB to serialize to XML chunk by chunk?

    Read the article

  • Servlet doPost() Method setup?

    - by Mark R
    I am interested in creating a web app that uses JSP, Servlets and XML. At the moment I have the following: JSP - Form input. Servlet - Retrieving Form data and sending that data to a java object. Java object (1) - Converts data into XML file....instantiates java object (2). Java object (2) - Sends that file to a database. On the returning side the database will send back another XML file that I will then process using XSLT to display back to the user. Can I place that XSLT code in the orignial Servlets doPost() method? So my doPost()` method would: Retrieve user inputted data from the form on my JSP page. Instantiate a java object to convert that data to XML, in-turn that object will instantiates another object to send the XML file to a database. Converts the resulting XML file sent from the database and displays it for the user. Can one servlet doPost() method handle all of this? If not, how would I set up my application and classes to handle this work flow? Thank you in advance

    Read the article

  • How do I correctly reference georss: point in my xsd?

    - by Chris Hinch
    I am putting together an XSD schema to describe an existing GeoRSS feed, but I am stumbling trying to use the external georss.xsd to validate an element of type georss:point. I've reduced the problem to the smallest components thusly: XML: <?xml version="1.0" encoding="utf-8"?> <this> <apoint>45.256 -71.92</apoint> </this> XSD: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:georss="http://www.georss.org/georss"> <xs:import namespace="http://www.georss.org/georss" schemaLocation="http://georss.org/xml/1.1/georss.xsd"/> <xs:element name="this"> <xs:complexType> <xs:sequence> <xs:element name="apoint" type="georss:point"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> If I make apoint type "xs: string" instead of "georss: point", the XML validates happily against the XSD, but as soon as I reference an imported type (georss: point), my XML validator (Notepad++ | XML Tools) "cannot parse the schema". What am I doing wrong?

    Read the article

  • Why do I get Error#2036 in flash AS3 and how to solve this?

    - by sydas
    I'm currently building an application in flash in relation to RSS/XML feeds for a project. I'm stuck at the moment because I keep getting this error: Error opening URL 'http://distilleryimage6.instagram.com/.jpg' Error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never Completed. I know my string picURL is not functioning properly, but am I missing something that makes it not functional? This is my code: package { import flash.display.*; import flash.events.*; import flash.net.*; public class instagramFeed extends MovieClip { //link to #rit xml loader public var ritFileRequest = new URLRequest("http://instagram.com/tags/rit/feed/recent.rss"); public var ritXmlLoader = new URLLoader(); //link to #rochester xml loader // same as above public variables public function instagramFeed() { // constructor code trace("About to load..."); //Loads #rit hashtag xml data. ritXmlLoader.load(ritFileRequest); ritXmlLoader.addEventListener(Event.COMPLETE, displayRITInfo); } //focuses on data with #rit hashtag public function displayRITInfo(e:Event):void{ var ritInstagramData:XML = new XML(ritXmlLoader.data); var ritInfoList:XMLList = ritInstagramData.elements().item; trace(ritInfoList); //load the image var ritPic:String = ritInfoList.*::condition.@code; var picURL:String = "http://distilleryimage6.instagram.com/" + ritPic + ".jpg"; trace(picURL); //show the image on the stage! var ritImageRequest:URLRequest = new URLRequest(picURL); var ritImageLoader:Loader = new Loader(); ritImageLoader.load(ritImageRequest); addChild(ritImageLoader); ritImageLoader.x=200; ritImageLoader.y=100; ritImageLoader.scaleX = 3; ritImageLoader.scaleY = 3; } } }

    Read the article

  • Alternative to Altova's MissionKit

    - by nomad311
    Anyone know of any good alternatives (other than those listed below which really are only good at specific XML development tasks)? The Why (if you're interested): I've been doing XML development on and off for years now, but someone brought XMLSpy to my attention recently, and it is awesome - the price isn't. Lately I've been using a combination of: Notepad++ (modifying XML) EditX (validating/debugging XML) Eclipse (designing schemas) and MS Visual Studio (validating schemas) ...based on which makes the task(s) easiest. But, I've just found out that we will be using XSL transformations to generate XML in the future. I've never used mission kit before, but I'm just short of positive XMLSpy replaces all the above mentioned tool for XML development. And if their XSL tools are anywhere near the caliber of XMLSpy ...simply put I need it. I don't believe that I can convince the budgeting types to buy licenses for MissionKit at $1000 each (won't stop me from trying). In the mean while some research on alternatives won't hurt, but a few Google queries has only revealed that not many people pay for Altova's (overpriced?) software as there are mostly links to P2P sites for downloading a more free-like version of MissionKit.

    Read the article

  • visibility false, XML, as3

    - by pixelGreaser
    Hey, I'm using external XML to set flash vars. Alpha works, but not Visibility. How do I get my swf to respond to visibility? Thanks. XML <?xml version="1.0" encoding="utf-8"?> <SESSION> <BGv TITLE="visible true">false</BGv> <BGa TITLE="alpha 50 percent">.5</BGa> </SESSION> SWF //LISTEN AND LOAD XML var myXML:*; var myLoad:URLLoader = new URLLoader(); myLoad.load(new URLRequest("visible.xml")); myLoad.addEventListener(Event.COMPLETE, parseXML); //PARSE XML function parseXML(e:Event):void { myXML = new XML(e.target.data); //MY TEST var bgA:*; var bgV:*; trace(myXML.BGa.text()); trace(myXML.BGv.text()); bgA =(myXML.BGa.text()); bgV =(myXML.BGv.text()); //MY OBJECT bg.alpha = bgA;//This works great bg.visible = bgV;//This has no effect } OUTPUT .5 false

    Read the article

  • How to factorize common tags with nokogiri builder ?

    - by plafoucriere
    Hi, I'd like to create several builders, with common tags, in order to have xml docs like : <xml version="1.0"?> <a_kind_of_root> <!-- This part is common --> <event_date>20100514</event_date> <event_id>123</event_id> <event_type>Conference</event_type> <!-- This part is specific to the builder --> <my_tag>some text</my_tag> </a_kind_of_root> </xml> <xml version="1.0"?> <another_kind_of_root> <!-- This part is common --> <event_date>20100514</event_date> <event_id>123</event_id> <event_type>Conference</event_type> <!-- This part is specific to the builder --> <my_other_tag>some integer</my_other_tag> </another_kind_of_root> </xml> I don't know how to put the common part inside a Nokogiri::XML::Builder Thanks

    Read the article

  • Visual Studio App.config XML Transformation

    - by João Angelo
    Visual Studio 2010 introduced a much-anticipated feature, Web configuration transformations. This feature allows to configure a web application project to transform the web.config file during deployment based on the current build configuration (Debug, Release, etc). If you haven’t already tried it there is a nice step-by-step introduction post to XML transformations on the Visual Web Developer Team Blog and for a quick reference on the supported syntax you have this MSDN entry. Unfortunately there are some bad news, this new feature is specific to web application projects since it resides in the Web Publishing Pipeline (WPP) and therefore is not officially supported in other project types like such as a Windows applications. The keyword here is officially because Vishal Joshi has a nice blog post on how to extend it’s support to app.config transformations. However, the proposed workaround requires that the build action for the app.config file be changed to Content instead of the default None. Also from the comments to the said post it also seems that the workaround will not work for a ClickOnce deployment. Working around this I tried to remove the build action change requirement and at the same time add ClickOnce support. This effort resulted in a single MSBuild project file (AppConfig.Transformation.targets) available for download from GitHub. It integrates itself in the build process so in order to add app.config transformation support to an existing Windows Application Project you just need to import this targets file after all the other import directives that already exist in the *.csproj file. Before – Without App.config transformation support ... <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> </Project> After – With App.config transformation support ... <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="C:\MyExtensions\AppConfig.Transformation.targets" /> <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> </Project> As a final disclaimer, the testing time was limited so any problem that you find let me know. The MSBuild project invokes the mage tool so the Framework SDK must be installed. Update: I finally had some spare time and was able to check the problem reported by Geoff Smith and believe the problem is solved. The Publish command inside Visual Studio triggers a build workflow different than through MSBuild command line and this was causing problems. I posted a new version in GitHub that should now support ClickOnce deployment with app.config tranformation from within Visual Studio and MSBuild command line. Also here is a link for the sample application used to test the new version using the Publish command with the install location set to be from a CD-ROM or DVD-ROM and selected that the application will not check for updates. Thanks to Geoff for spotting the problem.

    Read the article

  • Junk files appeared in my OSX root folder?

    - by user68732
    I see a bunch of junk files in the root folder of my hard drive running Snow Leopard. Here is a screen shot of the files: If I inspect these files, they appear to contain XML with DeviceCertificate, DevicePublicKey, and SystemBUID information, among other XML elements. I do iOS development on this machine. Can anyone explain from where these files came, and if they are an indication of anything serious, such as malware or spyware?

    Read the article

  • "The specified type was not recognized" exception when trying to invoke a webservice call

    - by fretje
    I'm trying to call a third party webservice using WSE 3.0 as a client in Visual Studio 2005. The call works fine and I can see that I get a good response (I have tracing enabled), but apparently the xml parser chokes over it. I always get an InvalidOperationException: There is en error in the XML document. with an InnerException: The specified type was not recognized: name='Map', namespace='http://xml.apache.org/xml-soap', at <bevoegdheid xmlns=''>. This is the relevant part of the response: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="https://acceptatie.cartalk.nl/Soap/Apk" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <SOAP-ENV:opvragenKeurmeesterGegevensResponse> <opvragenKeurmeesterGegevensReturn xsi:type="ns2:Backend_Apk_Result_OpvragenKeurmeesterGegevens"> <naam xsi:type="xsd:string">A name</naam> ... <bevoegdheid SOAP-ENC:arrayType="ns1:Map[2]" xsi:type="SOAP-ENC:Array"> <item xsi:type="ns1:Map"> <item> <key xsi:type="xsd:string">soortBevoegdheid</key> <value xsi:type="xsd:string">AL</value> </item> ... </item> <item> ... </item> </bevoegdheid> <meldingSoort xsi:nil="true" /> <meldingNummer xsi:nil="true" /> <melding xsi:nil="true" /> </opvragenKeurmeesterGegevensReturn> </SOAP-ENV:opvragenKeurmeesterGegevensResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope> And this is how that "bevoegdheid" is defined in the wsdl: <xsd:element name="bevoegdheid" type="soap-enc:Array" /> There is no mention of a "Map" type anywhere in the wsdl. I have been googling around for this, but the only kind of answer I've found is something along the lines of The service uses rpc/encoded format which is harder to get interoperability with. If you can change the server to document/literal it is better. But as this is a third party service (which is already used by other clients), this is no option for us. Any other suggestions? How can I get the xml parser to recognize that "Map" type?

    Read the article

< Previous Page | 119 120 121 122 123 124 125 126 127 128 129 130  | Next Page >