xmldom

How can i get the value of attribute in of a xml node in php?

℡╲_俬逩灬. 提交于 2019-12-11 12:18:13
问题 I'm using simplexml to read a xml file. So far i'm unable to get the attribute value i'm looking for. this is my code. if(file_exists($xmlfile)){ $doc = new DOMDocument(); $doc->load($xmlfile); $usergroup = $doc->getElementsByTagName( "preset" ); foreach($usergroup as $group){ $pname = $group->getElementsByTagName( "name" ); $att = 'code'; $name = $pname->attributes()->$att; //not working $name = $pname->getAttribute('code'); //not working if($name==$preset_name){ echo($name); $group-

“Not enough storage is available to complete this operation” when base64-encoding a zip file

邮差的信 提交于 2019-12-11 11:59:17
问题 The below code is for converting a zip file to base64 format. Dim inByteArray, base64Encoded, Const TypeBinary = 1 inByteArray = readBytes("F:path/file.zip") base64Encoded = encodeBase64(inByteArray) Private Function readBytes(file) Dim inStream ' ADODB stream object used Set inStream = CreateObject("ADODB.Stream") ' open with no arguments makes the stream an empty container inStream.Open inStream.Type = TypeBinary inStream.LoadFromFile(file) readBytes = inStream.Read() End Function Private

How to parse an XML file and write in data then save it

别来无恙 提交于 2019-12-11 06:55:10
问题 I am working on something like the following: An Excel sheet with some cells where the end user is asked to enter required values; done Code that read values entered in these cells by end users; Load an XML file; done Parse it and then write the values retrieved from Excel cells into XML file (following a rule) then save it; I am stuck here! Start my application (another script will use the XML file values later). I will simplify as much as possible: The Excel file will be like the following

Obtain page sourceCode

女生的网名这么多〃 提交于 2019-12-11 06:51:01
问题 I have a page wich contains a XSL as it's source code. Is there any way to get the page source code (as seen on right-click->show source code in IE)? EDIT: The page source code IS a XSL! I need to store it in a variable to use later. 回答1: At first glance, the XML source seems to be irremediably lost in the transformation process. The simplest way I can think of is to use AJAX to query the page again. (On most browsers, this should be very fast because of caching.) $.get(document.location,

How overwrite in node/xmldom errorHandler on DOMParser?

半城伤御伤魂 提交于 2019-12-11 06:27:57
问题 I use https://github.com/jindw/xmldom and want check parseerrors on XML files. The documentation write it's necessary to overwrite locator + errorHandler on constructor of DOMParser. But I can't find anywhere code example, how to use these in node context. Documentation say: //errorHandler is supported new DOMParser({ /** * locator is always need for error position info */ locator:{}, /** * you can override the errorHandler for xml parser * @link http://www.saxproject.org/apidoc/org/xml/sax

Remove a parent node and all children based on text value in child

落花浮王杯 提交于 2019-12-11 03:49:56
问题 I am trying to read an xml file with vbscript and if the ATTRIBUTE_DATA contains V-3008, I want to delete/remove the whole vuln .... vuln that contains it. - I have tried all different XPath variations and can't come up with the one that will do that. I have had it deleting the entire row that contains it but that is no good. I did search this site first and there isn't a whole lot on this topic: https://stackoverflow.com/search?q=xpath+vbscript+remove+node Here is some basic code I have

Perl XML::DOM Copy Node Tree Between Files

南笙酒味 提交于 2019-12-10 15:38:09
问题 I'm just trying to add the people nodes from one XML to another with XML::DOM and even though I am cloning the tree in question, I am still getting a "WRONG_DOCUMENT_ERR" because it says the node came from another file. It happens right when I try to append the node onto the new file. Am I doing it right? I've even found that the correct solution is to import the node, but a google search of "import site:http://search.cpan.org/~tjmather/XML-DOM-1.44/" gives nothing. Now I'm seriously

dom xml parser java, same tags

烂漫一生 提交于 2019-12-08 12:30:02
问题 i have this xml document which has varying number of same named tags. how can i get the count of the child elements and the value of it. <Question> <QuestionText>ABC?</QuestionText> <Option>A1 - XYZ</Option> <Option>A2 - WXY</Option> <Option>A2 - HJK</Option> <ID>1</ID> </Question> <Question> <QuestionText>ERY?</QuestionText> <QuestionText>NNN?</QuestionText> <QuestionText>KKKK?</QuestionText> <ID>2</ID> </Question> The output should read... ID:2 Has 1 QuestionText and 3 Option QuestionText 1

java xml document.getTextContent() stays empty

旧街凉风 提交于 2019-12-07 04:43:45
问题 I'm trying to build an xml document in a JUnit test. doc=docBuilder.newDocument(); Element root = doc.createElement("Settings"); doc.appendChild(root); Element label0 = doc.createElement("label_0"); root.appendChild(label0); String s=doc.getTextContent(); System.out.println(s); Yet the document stays empty (i.e. the println yields null .) I don'thave a clue why that is. The actual problem is that a subsequent XPath expression throws the error: Unable to evaluate expression using this context

java xml document.getTextContent() stays empty

二次信任 提交于 2019-12-05 09:17:34
I'm trying to build an xml document in a JUnit test. doc=docBuilder.newDocument(); Element root = doc.createElement("Settings"); doc.appendChild(root); Element label0 = doc.createElement("label_0"); root.appendChild(label0); String s=doc.getTextContent(); System.out.println(s); Yet the document stays empty (i.e. the println yields null .) I don'thave a clue why that is. The actual problem is that a subsequent XPath expression throws the error: Unable to evaluate expression using this context . The return value of getTextContent on Document is defined to null- See Node . To retreive the text