Search Results

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

Page 41/739 | < Previous Page | 37 38 39 40 41 42 43 44 45 46 47 48  | Next Page >

  • Problem with XML parser

    - by zp26
    Hi, I have a problem with parsing XML. I have created a program which write a file xml in the project directory. The file XML are correct. (i checked). When i try to read this XML the program crash and return 1 status. I have controlled my 2 path and they are equals. Can you help me please? Thanks so much. #import "PositionIdentifierViewController.h" #import "WriterXML.h" @implementation PositionIdentifierViewController - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string { NSString *stringa = [NSString stringWithFormat:@"%@",string]; textArea.text = [textArea.text stringByAppendingString:@"\n"]; textArea.text = [textArea.text stringByAppendingString:stringa]; } -(IBAction)startParsing { NSURL *xmlURL = [NSURL fileURLWithPath:path]; NSXMLParser *parser = [[NSXMLParser alloc] initWithContentsOfURL:xmlURL]; [parser setDelegate:self]; BOOL success = [parser parse]; if(success == YES){ // } [parser release]; } // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; NSArray *tempPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectoryPath = [tempPaths objectAtIndex:0]; path = [documentsDirectoryPath stringByAppendingPathComponent:@"filePosizioni.xml"]; WriterXML *newWriter; newWriter = [[WriterXML alloc]init]; [newWriter saveXML:(NSString*)@"ciao":(float)10:(float)40:(float)70]; [newWriter saveXML:(NSString*)@"pippo":(float)20:(float)50:(float)80]; [newWriter saveXML:(NSString*)@"pluto":(float)30:(float)60:(float)90]; NSLog(path); } - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } - (void)viewDidUnload { // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } - (void)dealloc { [super dealloc]; } @end #import "WriterXML.h" @implementation WriterXML -(void)saveXML:(NSString*)name:(float)x:(float)y:(float)z{ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectoryPath = [paths objectAtIndex:0]; NSString *filePath = [documentsDirectoryPath stringByAppendingPathComponent:@"filePosizioni.xml"]; NSFileHandle *myHandle; NSFileManager *fileManager = [NSFileManager defaultManager]; NSString *titoloXML = [NSString stringWithFormat:@"<?xml version=1.0 encoding=UTF-8 ?>"]; NSString *inizioTag = [NSString stringWithFormat:@"\n\n\n<position>"]; NSString *tagName = [NSString stringWithFormat:@"\n <name>%@</name>", name]; NSString *tagX = [NSString stringWithFormat:@"\n <x>%f</x>", x]; NSString *tagY = [NSString stringWithFormat:@"\n <y>%f</y>", y]; NSString *tagZ = [NSString stringWithFormat:@"\n <z>%f</z>", z]; NSString *fineTag= [NSString stringWithFormat:@"\n</position>"]; NSData* dataTitoloXML = [titoloXML dataUsingEncoding: NSASCIIStringEncoding]; NSData* dataInizioTag = [inizioTag dataUsingEncoding: NSASCIIStringEncoding]; NSData* dataName = [tagName dataUsingEncoding: NSASCIIStringEncoding]; NSData* dataX = [tagX dataUsingEncoding: NSASCIIStringEncoding]; NSData* dataY = [tagY dataUsingEncoding: NSASCIIStringEncoding]; NSData* dataZ = [tagZ dataUsingEncoding: NSASCIIStringEncoding]; NSData* dataFineTag = [fineTag dataUsingEncoding: NSASCIIStringEncoding]; if(![fileManager fileExistsAtPath:filePath]) [fileManager createFileAtPath:filePath contents:dataTitoloXML attributes:nil]; myHandle = [NSFileHandle fileHandleForUpdatingAtPath:filePath]; [myHandle seekToEndOfFile]; [myHandle writeData:dataInizioTag]; NSLog(@"writeok"); [myHandle seekToEndOfFile]; [myHandle writeData:dataName]; NSLog(@"writeok"); [myHandle seekToEndOfFile]; [myHandle writeData:dataX]; NSLog(@"writeok"); [myHandle seekToEndOfFile]; [myHandle writeData:dataY]; NSLog(@"writeok"); [myHandle seekToEndOfFile]; [myHandle writeData:dataZ]; NSLog(@"writeok"); [myHandle seekToEndOfFile]; [myHandle writeData:dataFineTag]; NSLog(@"writeok"); [myHandle seekToEndOfFile]; NSLog(@"zp26 %@",filePath); } @end

    Read the article

  • Merging elements inside a xml.etree.ElementTree

    - by theAlse
    I have a huge test data like the one provided below (and yes I have no control over this data). Each line is actually 6 parts and I need to generate an XML based on this data. Nav;Basic;Dest;Smoke;No;Yes; Nav;Dest;Recent;Regg;No;Yes; Nav;Dest;Favourites;Regg;No;Yes; ... Nav;Dest using on board;By POI;Smoke;No;Yes; Nav;Dest using on board;Other;Regg;No;Yes; The first 3 elements on each line denotes "test suites"-XML element and the last 3 element should create a "test case"-XML element. I have successfully converted it into a XML using the following code: # testsuite (root) testsuite = ET.Element('testsuite') testsuite.set("name", "Tests") def _create_testcase_tag(elem): global testsuite level1, level2, level3, elem4, elem5, elem6 = elem # -- testsuite (level1) testsuite_level1 = ET.SubElement(testsuite, "testsuite") testsuite_level1.set("name", level1) # -- testsuite (level2) testsuite_level2 = ET.SubElement(testsuite_level1, "testsuite") testsuite_level2.set("name", level2) # -- testsuite (level3) testsuite_level2 = ET.SubElement(testsuite_level2, "testsuite") testsuite_level2.set("name", level3) # -- testcase testcase = ET.SubElement(testsuite_level2, "testcase") testcase.set("name", "TBD") summary = ET.SubElement(testcase, "summary") summary.text = "Test Type= %s, Automated= %s, Available=%s" %(elem4, elem5, elem6) with open(input_file) as in_file: for line_number, a_line in enumerate(in_file): try: parameters = a_line.split(';') if len(parameters) >= 6: level1 = parameters[0].strip() level2 = parameters[1].strip() level3 = parameters[2].strip() elem4 = parameters[3].strip() elem5 = parameters[4].strip() elem6 = parameters[5].strip() lines_as_list.append((level1, level2, level3, elem4, elem5, elem6)) except ValueError: pass lines_as_list.sort() for elem in lines_as_list: _create_testcase_tag(elem) output_xml = ET.ElementTree(testsuite) ET.ElementTree.write(output_xml, output_file, xml_declaration=True, encoding="UTF-8") The above code generates an XML like this: <testsuite name="Tests"> <testsuite name="Nav"> <testsuite name="Basic navigation"> <testsuite name="Set destination"> <testcase name="TBD"> <summary>Test Type= Smoke test Automated= No, Available=Yes</summary> </testcase> </testsuite> </testsuite> </testsuite> <testsuite name="Nav"> <testsuite name="Set destination"> <testsuite name="Recent"> <testcase name="TBD"> <summary> Test Type= Reggression test Automated= No, Available=Yes </summary> </testcase> </testsuite> </testsuite> </testsuite> </testsuite> ... This is all correct, but as you can see I have created a whole tree for each line and that is not what I need. I need to combine e.g. all testsuite with the same name into one testsuite and also perform that recursively. So the XML looks like this instead: <testsuite name="Tests"> <testsuite name="Nav"> <testsuite name="Basic navigation"> <testsuite name="Set destination"> <testcase name="TBD"> <summary>Test Type= Smoke test Automated= No, Available=Yes</summary> </testcase> </testsuite> <testsuite name="Recent"> <testcase name="TBD"> <summary> Test Type= Reggression test Automated= No, Available=Yes </summary> </testcase> </testsuite> </testsuite> </testsuite> </testsuite> I hope you can understand what I mean, but level1, level2 and level3 should be unique with testcases inside. How should I do this? Please do not suggest the use of any external libraries! I can not install new libraries in customer site. xml.etree.ElementTree is all I have. Thanks

    Read the article

  • Error 404 after change filter in web.xml

    - by Falci
    I'm trying to add Spring Security to the project. After adding a block of code in web.xml, all url's give 404. What is wrong? It's a Maven project, Spring MVC, hibernate, postgres. (I do not know what information is relevant to describe the scenario) <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <!-- The definition of the Root Spring Container shared by all Servlets and Filters --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/spring/root-context.xml</param-value> </context-param> <!-- Creates the Spring Container shared by all Servlets and Filters --> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <!-- Processes application requests --> <servlet> <servlet-name>appServlet</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>appServlet</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <filter> <filter-name>encodingFilter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> <init-param> <param-name>forceEncoding</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>encodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- After insert this block, all URL's return 404 error --> <filter> <filter-name>springSecurityFilterChain</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> </filter> <filter-mapping> <filter-name>springSecurityFilterChain</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app> UPDATE: Grave: Exception starting filter springSecurityFilterChain org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'springSecurityFilterChain' is defined at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:529) at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1094) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:276) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1079) at org.springframework.web.filter.DelegatingFilterProxy.initDelegate(DelegatingFilterProxy.java:217) at org.springframework.web.filter.DelegatingFilterProxy.initFilterBean(DelegatingFilterProxy.java:145) at org.springframework.web.filter.GenericFilterBean.init(GenericFilterBean.java:179) at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:103) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4638) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5294) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1366) at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1454) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:295) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1379) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1537) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1547) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1526) at java.lang.Thread.run(Thread.java:722)

    Read the article

  • How to merge two different child nodes in the same XML file

    - by user814698
    I have an XML file and I would like to merge two different CONTACT child nodes. I have checked these websites it shows how to merge two different xml files into a single file. http://www2.informatik.hu-berlin.de/~obecker/XSLT/#merge Merge XML documents In my case this is my first contact in the xml file: <CONTACT> <PDE-Identity>N65539</PDE-Identity> <FirstName>Arun_niit</FirstName> <LastName>Arun_niit</LastName> <Facebook-ID/> <EMAILS> <EMail> <Type>yahoo</Type> <Value>[email protected]</Value> </EMail> </EMAILS> </CONTACT> This is the second contact in the file: <PDE-Identity>N65567</PDE-Identity> <FirstName>Arun_niit</FirstName> <LastName>Ramanathan</LastName> <Facebook-ID/> <EMAILS> <EMail> <Type>gmail</Type> <Value>[email protected]</Value> </EMail> <EMail> <Type>yahoo</Type> <Value>[email protected]</Value> </EMail> </EMAILS> </CONTACT> <CONTACT> I know both of the contacts are belongs to the same person. How can i merge these two contacts in the same xml file. Original XML File: <?xml version="1.0" encoding="UTF-8"?> <CONTACTS> <CONTACT> <PDE-Identity>N65539</PDE-Identity> <FirstName>Arun_niit</FirstName> <LastName>Arun_niit</LastName> <Facebook-ID/> <EMAILS> <EMail> <Type>yahoo</Type> <Value>[email protected]</Value> </EMail> </EMAILS> </CONTACT> <CONTACT> <PDE-Identity>N65567</PDE-Identity> <FirstName>Arun_niit</FirstName> <LastName>Ramanathan</LastName> <Facebook-ID/> <EMAILS> <EMail> <Type>gmail</Type> <Value>[email protected]</Value> </EMail> <EMail> <Type>yahoo</Type> <Value>[email protected]</Value> </EMail> </EMAILS> </CONTACT> <CONTACT> <PDE-Identity>N65567</PDE-Identity> <FirstName>Rangarajkarthik</FirstName> <LastName>karthik Rangaraj</LastName> <Facebook-ID/> <EMAILS> <EMail> <Type>gmail</Type> <Value>[email protected]</Value> </EMail> <EMail> <Type>yahoo</Type> <Value>[email protected]</Value> </EMail> </EMAILS> </CONTACT> <CONTACTS>

    Read the article

  • The ':' character, hexadecimal value 0x3A, cannot be included in a name

    - by coure06
    I have an xml file that contains its element like <ab:test>Str</ab:test> When i am trying to access it using the code XElement tempElement = doc.Descendants(XName.Get("ab:test")).FirstOrDefault(); Its giving me error System.Web.Services.Protocols.SoapException: Server was unable to process request. --- System.Xml.XmlException: The ':' character, hexadecimal value 0x3A, cannot be included in a name. How shld i access it?

    Read the article

  • speed: XmlTextReader vs LinqtoXml

    - by Michel
    Hi, i'm about to read some xml (who isn't :-)) This time however it's a lot of data: about 30.000 records with 5 properties, all in one file. Till now i've always read that the XmlTextReader is the fastest way to read xml data, but now there also is the (nice sytax of) linqtoXml. Does anybody know any performance issues, or that there aren't any, with LinqToXml? Michel

    Read the article

  • Converting XDocument to XmlDocument and vice versa.

    - by Workshop Alex
    It's a very simple problem that I have. I use XDocument to generate an XML file. I then want to return it as a XmlDocument class. And I have an XmlDocument variable which I need to convert back to XDocument to append more nodes. So, what is the most efficient method to convert XML between XDocument and XmlDocument? (Without using any temporary storage in a file.)

    Read the article

  • Is there a way to make a serialized member to serialize as an attribute?

    - by Shimmy
    Is there a way to make a serialized member to serialize as an attribute: <Serializable> Public Class Person Public Property Name As String End Class I want than when this class is xml-serialized, it should produce: <Person Name="John Doe" /> And what I mean is that instead of the Name property should be serialized as an element, it should be serialized as an xml attribute.

    Read the article

  • Mule xml to soap problem

    - by kevfuzz
    Hi, I'm not sure if there many Mule users on here but I'm hoping someone might be able to help me! I'm having a problem calling a webservice from Mule using Axis. I've created a fairly simple example where I have xml in a file being read by Mule, it's then transformed into a Document and sent to the webservice. The relevant code in the mule config looks like this: <inbound> <file:inbound-endpoint path="./files/initial" transformer-refs="FileToString xmlToDom" connector-ref="fileConnector" /> </inbound> <outbound> <pass-through-router> <axis:outbound-endpoint address="http://localhost:8081/holidayService?method=echoXXXX" synchronous="true" style="DOCUMENT" use="LITERAL" /> </pass-through-router> </outbound> However the call for the webservice fails as the above config is generating a SOAP message with an tag just after the tag and closes it just before the tag. The generated SOAP message looks like this: POST /holidayService?method=echoXXXX HTTP/1.1 Content-Type: text/xml X-MULE_ENDPOINT: http://localhost:8081/holidayService?method=echoXXXX SOAPAction: http://localhost:8081/holidayService?method=echoXXXX directory: D:\bea\weblogic92\samples\domains\wl_server\files\processed filename: HolidayRequest.xml method: echoXXXX originalFilename: HolidayRequest.xml style: document use: literal User-Agent: Jakarta Commons-HttpClient/3.1 Host: 127.0.0.1:8081 Content-Length: 1183 <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Header> <mule:header soapenv:actor="http://www.muleumo.org/providers/soap/1.0" soapenv:mustUnderstand="0" xmlns:mule="http://www.muleumo.org/providers/soap/1.0"> <mule:MULE_CORRELATION_ID>D:\bea\weblogic92\samples\domains\wl_server\files\processed\HolidayRequest.xml</mule:MULE_CORRELATION_ID> <mule:MULE_CORRELATION_GROUP_SIZE>-1</mule:MULE_CORRELATION_GROUP_SIZE> <mule:MULE_CORRELATION_SEQUENCE>-1</mule:MULE_CORRELATION_SEQUENCE> </mule:header> </soapenv:Header> <soapenv:Body> <value0 xsi:type="ns1:DocumentImpl" xmlns="" xmlns:ns1="http://dom.internal.xerces.apache.org.sun.com"> <sch:HolidayRequest xmlns:sch="http://mycompany.com/hr/schemas"> <sch:Holiday> <sch:StartDate>2009-08-13</sch:StartDate> <sch:EndDate>1988-12-12</sch:EndDate> </sch:Holiday> <sch:Employee> <sch:Number>3434</sch:Number> <sch:FirstName>John</sch:FirstName> <sch:LastName>Smith</sch:LastName> </sch:Employee> </sch:HolidayRequest> </value0> </soapenv:Body> </soapenv:Envelope> The webservice works fine in SOAPUI without the tag and from what I've read on the Mule website I don't know why it's being inserted. Any help would be much appreciated, Kevin.

    Read the article

  • XNA: Load and read a XML file?

    - by Rosarch
    I'm having difficulty doing this seemingly simple task. I want to load XML files with the same ease of loading art assets: content = new ContentManager(Services); content.RootDirectory = "Content"; background = content.Load<Texture2D>("images\\ice"); I'm not sure how to do this. This tutorial seems helpful, but how do I get a StorageDevice instance? I do have something working now, but it feels pretty hacky: public IDictionary<string, string> Get(string typeName) { IDictionary<String, String> result = new Dictionary<String, String>(); xmlReader.Read(); // get past the XML declaration string element = null; string text = null; while (xmlReader.Read()) { switch (xmlReader.NodeType) { case XmlNodeType.Element: element = xmlReader.Name; break; case XmlNodeType.Text: text = xmlReader.Value; break; } if (text != null && element != null) { result[element] = text; text = null; element = null; } } return result; } I apply this to the following XML file: <?xml version="1.0" encoding="utf-8" ?> <zombies> <zombie> <health>100</health> <positionX>23</positionX> <positionY>12</positionY> <speed>2</speed> </zombie> </zombies> And it is able to pass this unit test: internal virtual IPersistentState CreateIPersistentState(string fullpath) { IPersistentState target = new ReadWriteXML(File.Open(fullpath, FileMode.Open)); return target; } /// <summary> ///A test for Get with one zombie. ///</summary> //[TestMethod()] public void SimpleGetTest() { string fullPath = "C:\\pathTo\\Data\\SavedZombies.xml"; IPersistentState target = CreateIPersistentState(fullPath); string typeName = "zombie"; IDictionary<string, string> expected = new Dictionary<string, string>(); expected["health"] = "100"; expected["positionX"] = "23"; expected["positionY"] = "12"; expected["speed"] = "2"; IDictionary<string, string> actual = target.Get(typeName); foreach (KeyValuePair<string, string> entry in expected) { Assert.AreEqual(entry.Value, expected[entry.Key]); } } Downsides to the current approach: file loading is done poorly, and matching keys to values seems like it's way more effort than necessary. Also, I suspect this approach would fall apart with more than one entry in the XML.

    Read the article

  • SimpleXMLElement (PHP) throwing error on XML root attributes

    - by Greg
    I am working on a project that will take XML data submitted through a textarea input in a form then extract the data and throw it into a database. I am getting errors about the attribute in the root field of my XML (it is the same schema each time, but with different values). If i remove these attributes it works fine, but I don't want to have to remove these attributes each I time I go to send the data to the script. here is a sample of my data and code I am using (the part that is giving me errors): <raid generatedFrom="HeadCount" version="1.7.4"> --snip-- </raid> If I post the data as such, i get errors such as: Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: Entity: line 1: parser error : AttValue: " or ' expected in /home/content/g/V/i/gViscardi/html/guilds/sanctum/headcount.php on line 13 Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: <raid generatedFrom=\"HeadCount\" version=\"1.7.4\"> in /home/content/g/V/i/gViscardi/html/guilds/sanctum/headcount.php on line 13 Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: ^ in /home/content/g/V/i/gViscardi/html/guilds/sanctum/headcount.php on line 13 Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: Entity: line 1: parser error : attributes construct error in /home/content/g/V/i/gViscardi/html/guilds/sanctum/headcount.php on line 13 Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: <raid generatedFrom=\"HeadCount\" version=\"1.7.4\"> in /home/content/g/V/i/gViscardi/html/guilds/sanctum/headcount.php on line 13 Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: ^ in /home/content/g/V/i/gViscardi/html/guilds/sanctum/headcount.php on line 13 Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: Entity: line 1: parser error : Couldn't find end of Start Tag raid line 1 in /home/content/g/V/i/gViscardi/html/guilds/sanctum/headcount.php on line 13 Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: <raid generatedFrom=\"HeadCount\" version=\"1.7.4\"> in /home/content/g/V/i/gViscardi/html/guilds/sanctum/headcount.php on line 13 Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: ^ in /home/content/g/V/i/gViscardi/html/guilds/sanctum/headcount.php on line 13 Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: Entity: line 1: parser error : Extra content at the end of the document in /home/content/g/V/i/gViscardi/html/guilds/sanctum/headcount.php on line 13 Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: <raid generatedFrom=\"HeadCount\" version=\"1.7.4\"> in /home/content/g/V/i/gViscardi/html/guilds/sanctum/headcount.php on line 13 Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: ^ in /home/content/g/V/i/gViscardi/html/guilds/sanctum/headcount.php on line 13 Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /home/content/g/V/i/gViscardi/html/guilds/sanctum/headcount.php:13 Stack trace: #0 /home/content/g/V/i/gViscardi/html/guilds/sanctum/headcount.php(13): SimpleXMLElement->__construct('<raid generated...') #1 {main} thrown in /home/content/g/V/i/gViscardi/html/guilds/sanctum/headcount.php on line 13 If I remove the attributes from the root node then it works fine with no errors. Here is the code I am using to take and display it; <html> <head> </head> <body> <?php if(isset($_POST['h_input'])) { //echo //$xml_d = file_get_contents('php://input'); $xml_d = $_POST['h_input']; //print_r($xml_d); $xml = new SimpleXMLElement($xml_d); echo $xml->zone . "<br />"; foreach ($xml->players->player as $player) { echo $player->name . "<br />"; } } else { ?> <form action="headcount.php" method="post" name="headcount"> <textarea rows="10" cols="30" name="h_input"> </textarea> <input type="submit" /> </form> </body> </html> Any suggestions would be most helpful, thank you.

    Read the article

  • Create attribute in XML

    - by user560411
    Hello. I have the following php code that adds data into XML and works correctly. However, in my second step I will create a form that deletes some of the elements. The problem is that I want to add an ID number and then the PHP file will search for it and delete entire node. My question is how can i add an ID into CD for this to work ? For example ( <cd id="xxxx"> ) Also, any ideas or examples of a code that deletes CD having the ID would be appreciate. insert.php ( my index file with the form ) <h1>Playlist</h1> <form action="insert2.php" method="post"> <fieldset> <label for="TITLE">TITLE:</label><input type="text" id="title" name="title" /><br /> <label for="title">BAND:</label> <input type="text" id="band" name="band"/><br /> <label for="path">YEAR:</label> <input type="text" id="year" name="year" /> <br /> <input type="submit" /> </fieldset> </form> <h2>Current entries:</h2> <p>TITLE - BAND - YEAR</p> <?php $doc = new DOMDocument(); $doc->load( 'insert.xml' ); $CATEGORIES = $doc->getElementsByTagName( "CD" ); foreach( $CATEGORIES as $CD ) { $TITLES = $CD->getElementsByTagName( "TITLE" ); $TITLE = $TITLES->item(0)->nodeValue; $BANDS= $CD->getElementsByTagName( "BAND" ); $BAND= $BANDS->item(0)->nodeValue; $YEARS = $CD->getElementsByTagName( "YEAR" ); $YEAR = $YEARS->item(0)->nodeValue; echo "<b>$TITLE - $BAND - $YEAR\n</b><br>"; } ?> inser2.php ( the main code ) <?php $CD = array( 'TITLE' => $_POST['title'], 'BAND' => $_POST['band'], 'YEAR' => $_POST['year'], ); $doc = new DOMDocument(); $doc->load( 'insert.xml' ); $doc->formatOutput = true; $r = $doc->getElementsByTagName("CATEGORIES")->item(0); $b = $doc->createElement("CD"); $TITLE = $doc->createElement("TITLE"); $TITLE->appendChild( $doc->createTextNode( $CD["TITLE"] ) ); $b->appendChild( $TITLE ); $BAND = $doc->createElement("BAND"); $BAND->appendChild( $doc->createTextNode( $CD["BAND"] ) ); $b->appendChild( $BAND ); $YEAR = $doc->createElement("YEAR"); $YEAR->appendChild( $doc->createTextNode( $CD["YEAR"] ) ); $b->appendChild( $YEAR ); $r->appendChild( $b ); $doc->save("insert.xml"); ?> the XML file <?xml version="1.0" encoding="utf-8"?> <MY_CD> <CATEGORIES> <CD> <TITLE>NEVER MIND THE BOLLOCKS</TITLE> <BAND>SEX PISTOLS</BAND> <YEAR>1977</YEAR> </CD> <CD> <TITLE>NEVERMIND</TITLE> <BAND>NIRVANA</BAND> <YEAR>1991</YEAR> </CD> </CATEGORIES> </MY_CD>

    Read the article

  • Jquery query XML document where clause

    - by user578406
    I have an XML document that I want to search a specific date and get information for just that date. My XML looks like this: <month id="01"> <day id="1"> <eitem type="dayinfo"> <caption> <text lang="cy">f. 3 r.</text> <text lang="en">f. 3 r.</text> </caption> <ref href="link" id="3"/> <thumb href="link" id="3"/> </eitem> </day> <day id="7"> <eitem type="dayinfo"> <caption> <text lang="cy">f. 5 v.</text> <text lang="en">f. 5 v.</text> </caption> <ref href="link" id="4"/> <thumb href="link" id="4"/> </eitem> </day> <day id="28"> <eitem type="dayinfo2"> <caption id="1"> <text lang="cy">test</text> <text lang="en">test2</text> </caption> <ref href="link" id="1"/> <thumb href="link" id="1"/> </eitem> </day> <day id="28"> <eitem type="dayinfo"> <caption> <text lang="cy">f. 14 v.</text> <text lang="en">f. 14 v.</text> </caption> <ref href="link" id="20"/> <thumb href="link" id="20"/> </eitem> </day> </month> My Jquery looks like this: $(xml).find('month[id=01]').each(function() { $(xml).find("day").each(function() { var day = $(this).attr('id'); alert(day); }); }); In the XML example above I only shown one month, however there are many more. In my JQuery I've tried to do 'Where month = 1' and get all the days info for that month, however that JQuery brings back days for every month. How do I do a where clause with JQuery/JavaScript on a XML document? thanks.

    Read the article

  • Parse and transform XML with missing elements into table structure

    - by dnlbrky
    I'm trying to parse an XML file. A simplified version of it looks like this: x <- '<grandparent><parent><child1>ABC123</child1><child2>1381956044</child2></parent><parent><child2>1397527137</child2></parent><parent><child3>4675</child3></parent><parent><child1>DEF456</child1><child3>3735</child3></parent><parent><child1/><child3>3735</child3></parent></grandparent>' library(XML) xmlRoot(xmlTreeParse(x)) ## <grandparent> ## <parent> ## <child1>ABC123</child1> ## <child2>1381956044</child2> ## </parent> ## <parent> ## <child2>1397527137</child2> ## </parent> ## <parent> ## <child3>4675</child3> ## </parent> ## <parent> ## <child1>DEF456</child1> ## <child3>3735</child3> ## </parent> ## <parent> ## <child1/> ## <child3>3735</child3> ## </parent> ## </grandparent> I'd like to transform the XML into a data.frame / data.table that looks like this: parent <- data.frame(child1=c("ABC123",NA,NA,"DEF456",NA), child2=c(1381956044, 1397527137, rep(NA, 3)), child3=c(rep(NA, 2), 4675, 3735, 3735)) parent ## child1 child2 child3 ## 1 ABC123 1381956044 NA ## 2 <NA> 1397527137 NA ## 3 <NA> NA 4675 ## 4 DEF456 NA 3735 ## 5 <NA> NA 3735 If each parent node always contained all of the possible elements ("child1", "child2", "child3", etc.), I could use xmlToList and unlist to flatten it, and then dcast to put it into a table. But the XML often has missing child elements. Here is an attempt with incorrect output: library(data.table) ## Flatten: dt <- as.data.table(unlist(xmlToList(x)), keep.rownames=T) setnames(dt, c("column", "value")) ## Add row numbers, but they're incorrect due to missing XML elements: dt[, row:=.SD[,.I], by=column][] column value row 1: parent.child1 ABC123 1 2: parent.child2 1381956044 1 3: parent.child2 1397527137 2 4: parent.child3 4675 1 5: parent.child1 DEF456 2 6: parent.child3 3735 2 7: parent.child3 3735 3 ## Reshape from long to wide, but some value are in the wrong row: dcast.data.table(dt, row~column, value.var="value", fill=NA) ## row parent.child1 parent.child2 parent.child3 ## 1: 1 ABC123 1381956044 4675 ## 2: 2 DEF456 1397527137 3735 ## 3: 3 NA NA 3735 I won't know ahead of time the names of the child elements, or the count of unique element names for children of the grandparent, so the answer should be flexible.

    Read the article

  • Salesforce consuming XML and display data in Visualforce report

    - by JavaKungFu
    Firstly, this question requires a bit of introduction so please bear with me. The high level is that I am connecting to a outside web service which will return some XML to my apex controller. The idea is that I want to display the XML returned into a nice tabular format in a VisualForce page. The format of the XML coming back will look something like this: <Wrapper><reportTable name='table_id' title='Report Title'> <row> <Element1><![CDATA[campaign_id]]></Element1> <Element2><![CDATA[577373]]></Element2> <Element3><![CDATA[4129]]></Element3> <Element4 dataFormat='2' dataSuffix='%'><![CDATA[0.7151]]></Element4> <Element5><![CDATA[2010-04-04]]></Element5> <Element6><![CDATA[2010-05-03]]></Element6> </row> </reportTable> ... Now currently I am using the XMLdom utility class (developed by SF for XML functions) to map this data into a custom object "reportTable" which contains a list of "row" custom objects. The reason I am building it out this way is because I don't know how many elements will be in each row, nor the number of rows. The Visualforce page looks something like this: <table><apex:repeat value="{!reportTables}" var="table"> <apex:repeat value="{!table.rows}" var="row"> <tr> <apex:repeat value="{!row.ColumnValue}" var="column"> <apex:repeat value="{!column}" var="value"> <td> <apex:outputText value="{!value}" /> </td> </apex:repeat> </apex:repeat> </tr> </apex:repeat> Questions are: 1) Does this seem like a good approach to the problem? 2) Is there a simpler/better way to consume the XML besides writing my own custom objects to map VF to? Open to any and all suggestions. I really hope there is a better way than building the HTML table myself, as then I also have to deal with styling and alignment etc. Thanks.

    Read the article

  • XML Return from an Oracle Stored Procedure

    - by Tequila Jinx
    Unfortunately most of my DB experience has been with MSSQL which tends to hold your hand a lot more than Oracle. What I'm trying to do is fairly trivial in tSQL, however, pl/sql is giving me a headache. I have the following procedure: CREATE OR REPLACE PROCEDURE USPX_GetUserbyID (USERID USERS.USERID%TYPE, USERRECORD OUT XMLTYPE) AS BEGIN SELECT XMLELEMENT("user" , XMLATTRIBUTES(u.USERID AS "userid", u.companyid as "companyid", u.usertype as "usertype", u.status as "status", u.personid as "personid") , XMLFOREST( p.FIRSTNAME AS "firstname" , p.LASTNAME AS "lastname" , p.EMAIL AS "email" , p.PHONE AS "phone" , p.PHONEEXTENSION AS "extension") , XMLELEMENT("roles", (SELECT XMLAGG(XMLELEMENT("role", r.ROLETYPE)) FROM USER_ROLES r WHERE r.USERID = USERID AND r.ISACTIVE = 1 ) ) , XMLELEMENT("watches", (SELECT XMLAGG( XMLELEMENT("watch", XMLATTRIBUTES(w.WATCHID AS "id", w.TICKETID AS "ticket") ) ) FROM USER_WATCHES w WHERE w.USERID = USERID AND w.ISACTIVE = 1 ) ) ) AS "RESULT" INTO USERRECORD FROM USERS u LEFT JOIN PEOPLE p ON p.PERSONID = u.PERSONID WHERE u.USERID = USERID; END USPX_GetUserbyID; When executed, it should return an XML document with the following structure: <user userid="" companyid="" usertype="" status="" personid=""> <firstname /> <lastname /> <email /> <phone /> <extension /> <roles> <role /> </roles> <watches> <watch id="" ticket="" /> </watches> </user> When I execute the query itself, replacing the USERID parameter with a string and removing the "into" clause, the query runs fine and returns the expected structure. However, when the procedure attempts to execute the query, passing the results of the XMLELEMENT function into the USERRECORD output parameter, I get the following exception: Error report: ORA-01422: exact fetch returns more than requested number of rows ORA-06512: at "USPX_GETUSERBYID", line 4 ORA-06512: at line 3 01422. 00000 - "exact fetch returns more than requested number of rows" *Cause: The number specified in exact fetch is less than the rows returned. *Action: Rewrite the query or change number of rows requested I'm baffled trying to nail this down, and unfortunately my google-fu hasn't helped. I've found plenty of Oracle SQL|XML examples, but none that deal with XML returns from a procedure. Note: I know that an alternate method of retrieving XML using DBMS methods exists, however, it's my understanding that that functionality is deprecated in favor of SQL|XML.

    Read the article

  • Configuring Hibernate logging using Log4j XML config file?

    - by James McMahon
    I haven't been able to find any documentation on how to configure Hibernate's logging using the XML style configuration file for Log4j. Is this even possible or do I have use a properties style configuration file to control Hibernate's logging? If anyone has any information or links to documentation it would appreciated. EDIT: Just to clarify, I am looking for example of the actual XML syntax to control Hibernate. EDIT2: Here is what I have in my XML config file. <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> <appender name="console" class="org.apache.log4j.ConsoleAppender"> <param name="Threshold" value="info"/> <param name="Target" value="System.out"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d{ABSOLUTE} [%t] %-5p %c{1} - %m%n"/> </layout> </appender> <appender name="rolling-file" class="org.apache.log4j.RollingFileAppender"> <param name="file" value="Program-Name.log"/> <param name="MaxFileSize" value="1000KB"/> <!-- Keep one backup file --> <param name="MaxBackupIndex" value="4"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d [%t] %-5p %l - %m%n"/> </layout> </appender> <root> <priority value ="debug" /> <appender-ref ref="console" /> <appender-ref ref="rolling-file" /> </root> </log4j:configuration> Logging works fine but I am looking for a way to step down and control the hibernate logging in way that separate from my application level logging, as it currently is flooding my logs. I have found examples of using the preference file to do this, I was just wondering how I can do this in a XML file.

    Read the article

  • No output from Linq to XML

    - by Gogster
    Hi all, I have the following code: protected void Page_Load(object sender, EventArgs e) { XElement xml = XElement.Load(Server.MapPath("ArenasMembers.xml")); var query = from p in xml.Descendants("members") select new { Name = p.Element("name").Value, Email = p.Attribute("email").Value }; foreach (var member in query) { Response.Write("Employee: " + member.Name + " " + member.Email + "<br />"); } } Which, using the hover information in Visual Studio, is reading the XNL file in correctly, however the foreach is not outputting any of the records. XML: <?xml version="1.0" encoding="utf-8" ?> <members> <member> <arena>EAA Office</arena> <memberid>1</memberid> <name>Jane Doe</name> <email>[email protected]</email> </member> <member> <arena>EAA Office</arena> <memberid>2</memberid> <name>John Bull</name> <email>[email protected]</email> </member> <member> <arena>O2 Arena</arena> <memberid>3</memberid> <name>John Doe</name> <email>[email protected]</email> </member> <member> <arena>O2 Arena</arena> <memberid>4</memberid> <name>Bernard Cribbins</name> <email>[email protected]</email> </member> <member> <arena>Colourline Arena</arena> <memberid>5</memberid> <name>John Bon Jovi</name> <email>[email protected]</email> </member> <member> <arena>NIA</arena> <memberid>6</memberid> <name>Rhianna</name> <email>[email protected]</email> </member> </members> Can you see what is wrong?

    Read the article

  • Why am I getting org.xml.sax.SAXException for this block of XML?

    - by drachenstern
    I've anonymised a bit of this. Hopefully it doesn't detract from the useful message. stringARRAY is where I think I'm getting thrown at, but I'm not sure, so if I'm looking at the wrong place, lemme know. From the WSDL <xsd:element name="LongishOpName"> <xsd:complexType> <xsd:sequence> <xsd:element maxOccurs="unbounded" name="stringARRAY" type="xsd:string" /> <xsd:element name="stringfield1" type="xsd:string" /> <xsd:element name="stringfield2" type="xsd:string" /> </xsd:sequence> </xsd:complexType> </xsd:element> Actual method call looks like this: string originalValue = "some useful value"; string[] usefulName1 = new[] { originalValue }; service.response[] responses = server.LongishOpName( usefulName1, someString1, someString2 ); And it generates this XML to the server (Thanks to Fiddler2): <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <LongishOpName xmlns="http://appropriate-namespace"> <stringARRAY>114003</stringARRAY> <stringfield1>a string</stringfield1> <stringfield2>a string</stringfield2> </LongishOpName> </soap:Body> </soap:Envelope> To which I get this response <?xml version="1.0" encoding="utf-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <soapenv:Fault> <faultcode>soapenv:Server.userException</faultcode> <faultstring>org.xml.sax.SAXException: Found character data inside an array element while deserializing</faultstring> <detail> <ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">SERVERNAME</ns1:hostname> </detail> </soapenv:Fault> </soapenv:Body> </soapenv:Envelope> Is my soap message actually coming out malformed? (yes I am using the ASP.NET web references to do all the lifting, I'm not generating by hand) Should I be doing something different? Do I just need to go home and sleep on it and tomorrow everything will "just work"?

    Read the article

  • Extracting Certain XML Elements with PHP SimpleXML

    - by Peter
    I am having some problems parsing this piece of XML using SimpleXML. There is always only one Series element, and a variable number of Episode elements beneath. I want to parse XML so I can store the Series data in one table, and all the Episode data in another table. XML: <Data> <Series> <id>80348</id> <Genre>|Action and Adventure|Comedy|Drama|</Genre> <IMDB_ID>tt0934814</IMDB_ID> <SeriesID>68724</SeriesID> <SeriesName>Chuck</SeriesName> <banner>graphical/80348-g.jpg</banner> </Series> <Episode> <id>935481</id> <Director>Robert Duncan McNeill</Director> <EpisodeName>Chuck Versus the Third Dimension 2D</EpisodeName> <EpisodeNumber>1</EpisodeNumber> <seasonid>27984</seasonid> <seriesid>80348</seriesid> </Episode> <Episode> <id>935483</id> <Director>Robert Duncan McNeill</Director> <EpisodeName>Buy More #15: Employee Health</EpisodeName> <EpisodeNumber>2</EpisodeNumber> <seasonid>27984</seasonid> <seriesid>80348</seriesid> </Episode> </Data> When I attempt to access just the first Series element and child nodes, or iterate through the Episode elements only it does not work. I have also tried to use DOMDocument with SimpleXML, but could not get that to work at all. PHP Code: <?php if(file_exists('en.xml')) { $data = simplexml_load_file('en.xml'); foreach($data as $series) { echo 'id: <br />' . $series->id; echo 'imdb: <br />' . $series->IMDB_ID; } } ?> Output: id:80348 imdb:tt0934814 id:935481 imdb: id:1534641 imdb: Any help would be greatly appreciated.

    Read the article

  • Ajax to read updated values from XML

    - by punit
    I am creating file upload progress bar. I have a CGI script which copies the data, and here I increment the progress bar value by ONE after certain iterations. I am storing the incremented value in XML file (I also tried using plain text file). On the other side I have ajax reading incremented value from xml and depending on that it increments the DIV element. However, what happens here is, it seems to me that although the ajax reads all the incremented values but it processes it after the CGI has finished execution. That is progress bar starts execution once the file copying and other stuff in CGI is completed. My code is: AJAX:::: function polling_start() { //GETS CALLED WHEN USER HITS FILE UPLOAD BUTTON intervalID = window.setInterval(send_request,100); } window.onload = function (){ request = initXMLHttpClient(); request.overrideMimeType('text/xml'); progress = document.getElementById('progress'); } function initXMLHttpClient() { if (window.XMLHttpRequest){ // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); } else{ // code for IE6, IE5 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } return xmlhttp } function send_request() { request.open("GET","progress_bar.xml",true); request.onreadystatechange = request_handler; request.send(); } function request_handler() { if (request.readyState == 4 && request.status == 200) { var level=request.responseXML.getElementsByTagName('PROGRESS')[0].firstChild; progress.style.width = progress.innerHTML = level.nodeValue + '%'; progress.style.backgroundColor = "green"; } } /****ON SERVER SIDE*********/ char xmlDat1[] = "<DOCUMENT><PROGRESS>"; char xmlDat2[] = "</PROGRESS></DOCUMENT>"; fptr = fopen("progress_bar.xml", "w"); .........OTHER STUFF.............................. ................................. if(i == inc && j<=100) { fprintf(fptr, "%s\n", "\n\n\n]"); //fprintf(fptr, "%s\n", ""); fprintf(fptr, "%s", xmlDat1); // fprintf(fptr, "%d" ,j); fprintf(fptr, "%s" ,xmlDat2); fseek(fptr, 0, SEEK_SET); /*fprintf(fptr, "%d" ,j); fseek(fptr, 0, SEEK_SET);*/ i = 0; //sleep(1); j++; } (I also tried to write in .text, but same response) Any quick response would be appreciable.

    Read the article

  • How to implement Xml Serialization with inherited classes in C#

    - by liorafar
    I have two classes : base class name Component and inheritd class named DBComponent [Serializable] public class Component { private string name = string.Empty; private string description = string.Empty; } [Serializable] public class DBComponent : Component { private List<string> spFiles = new List<string>(); // Storage Procedure Files [XmlArrayItem("SPFile", typeof(string))] [XmlArray("SPFiles")] public List<string> SPFiles { get { return spFiles; } set { spFiles = value; } } public DBComponent(string name, string description) : base(name, description) { } } [Serializable] public class ComponentsCollection { private static ComponentsCollection instance = null; private List<Component> components = new List<Component>(); public List<Component> Components { get { return components; } set { components = value; } } public static ComponentsCollection GetInstance() { if (ccuInstance == null) { lock (lockObject) { if (instance == null) PopulateComponents(); } } return instance; } private static void PopulateComponents() { instance = new CCUniverse(); XmlSerializer xs = new XmlSerializer(instance.GetType()); instance = xs.Deserialize(XmlReader.Create("Components.xml")) as ComponentsCollection; } } } I want read\write from a Xml file. I know that I need to implement the Serialization for DBComponent class otherwise it will not read it.But i cannot find any simple article for that. all the articles that I found were too complex for this simple scenario. The Xml file looks like this: <?xml version="1.0" encoding="utf-8" ?> <ComponentsCollection> <Components> <DBComponent Name="Tenant Historical Database" Description="Tenant Historical Database"> <SPFiles> <SPFile>Setup\TenantHistoricalSP.sql</SPFile> </SPFiles> </DBComponent> <Component Name="Agent" Description="Desktop Agent" /> </Components> </ComponentsCollection> Can someone please give me a simple example of how to read this kind of xml file and what should be implemented ? Thanks Lior

    Read the article

  • open,edit and save xml file with schema using php

    - by Neat
    Hy... I'm new in XML Schema, XSL,... (I have basic understanding) On web page: http://w3schools.com/xsl/xsl_editxml.asp is shown example for open,edit,save xml file, but with asp. Do anyone know how can i open/edit and save xml file using php for next example: <?xml version="1.0" encoding="ISO-8859-1"?> <tools> <tool id="1"> <field id="prodName"> <value>HAMMER HG2606</value> </field> <field id="prodNo"> <value>32456240</value> </field> <field id="price"> <value>$30.00</value> </field> </tool> <tool id="2"> <field id="prodName"> <value>Audi</value> </field> <field id="prodNo"> <value>88885</value> </field> <field id="price"> <value>$26.00</value> </field> </tool> </tools> and do i need <tool id="2"> or just <tool> is enough. Thanks very much on replay, and i don't need another xsl like shown on w3s, just fine is refresh submitted php file after submit (will do something with ajax after). I saw replay from Mr. Writman on questions/377632/add-update-and-edit-an-xml-file-with-php but that is for now 2 complex for me...:) is there any simpler answer (solution). Thanks in advance!!!

    Read the article

  • How to transform a cached XML via XSL?

    - by TruMan1
    I have a PHP script that caches a remote XML file. I want to XSL transform it before caching, but don't know how to do this: <?php // Set this to your link Id $linkId = "0oiy8Plr697u3puyJy9VTUWfPrCEvEgJR"; // Set this to a directory that has write permissions // for this script $cacheDir = "temp/"; $cachetime = 15 * 60; // 15 minutes // Do not change anything below this line // unless you are absolutely sure $feedUrl="http://mydomain.com/messageService/guestlinkservlet?glId="; $cachefile = $cacheDir .$linkId.".xml"; header('Content-type: text/xml'); // Send from the cache if $cachetime is not exceeded if (file_exists($cachefile) && (time() - $cachetime < filemtime($cachefile))) { include($cachefile); echo "<!-- Cached ".date('jS F Y H:i', filemtime($cachefile))." -->\n"; exit; } $contents = file_get_contents($feedUrl . $linkId); // show the contents of the XML file echo $contents; // write it to the cache $fp = fopen($cachefile, 'w'); fwrite($fp, $contents); fclose($fp); ?> This is the XSL string I want to use to transform it: <xsl:template match="/"> <kml xmlns="http://www.opengis.net/kml/2.2"> <Document> <xsl:apply-templates select="messageList" /> </Document> </kml> </xsl:template> <xsl:template match="messageList"> <name>My Generated KML</name> <xsl:apply-templates select="message" /> </xsl:template> <xsl:template match="message"> <Placemark> <name><xsl:value-of select="esnName" /></name> <Point> <coordinates> <xsl:value-of select="latitude" />,<xsl:value-of select="longitude" /> </coordinates> </Point> </Placemark> </xsl:template> I want to actually transform XML input and save/return a KML format. Can someone please help adjust this script? This was given to me and I am a little new to it.

    Read the article

< Previous Page | 37 38 39 40 41 42 43 44 45 46 47 48  | Next Page >