xml-parsing

What is the difference between SAX and DOM?

南笙酒味 提交于 2019-12-16 22:23:53
问题 I read some articles about the XML parsers and came across SAX and DOM . SAX is event-based and DOM is tree model -- I don't understand the differences between these concepts. From what I have understood, event-based means some kind of event happens to the node. Like when one clicks a particular node it will give all the sub nodes rather than loading all the nodes at the same time. But in the case of DOM parsing it will load all the nodes and make the tree model. Is my understanding correct?

Check XML node exist or not using vbscript

五迷三道 提交于 2019-12-16 18:02:33
问题 This is my XML file <ECSC> <ATTRIBUTES> < some part of attribute section > </ATTRIBUTES> <SCRIPT> <ETXML_LINE_TABTYPE> <some part of script section> </ETXML_LINE_TABTYPE> </SCRIPT> <PARAMETERS> <ETPAR_GUIX> <item> <PNAME>I_LANG</PNAME> <PTYP>I</PTYP> <PINDEX>0003</PINDEX> <PDATLEN>0128</PDATLEN> <PINTTYP>C</PINTTYP> <PINTLEN>000128</PINTLEN> <PDECIMALS>000000</PDECIMALS> <SORT_LNR>0001</SORT_LNR> <TAB_INDEX>0</TAB_INDEX> </item> <item> <PNAME>WE20_100_STEP_1</PNAME> <PTYP>X</PTYP> <PDESC>WE20

parsing xml with vbscript

ぃ、小莉子 提交于 2019-12-14 04:08:29
问题 Anyone have any examples of parsing xml with vbscript? I have a .NET generic list serialized into XML that I'm sending to a classic asp page. I thought I'd be able to use XMLDom, but the libraries don't seem to be installed on the server, so I'm looking for another solution. (Was getting "Object Required: documentElement" error) Basically I'm passing a list of around 15 objects in the form of an xml string that contains a headline and a main article section, and I want to loop through the

Edit XML with python

让人想犯罪 __ 提交于 2019-12-14 03:59:59
问题 I am trying to parse a xml file where I had wanted to grab the string of objlocation and change the contents of the string. This are the contents of the xml files I have: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <publish show="STATE"> <pubgroup objtype="ELE" location="/user_data/STATE/ITEM/character/ANM/ANM_rig_WALK_sg_v001/ANM_rig_WALK_sg_v001.xml"> <member objidx="15283942" objlabel="anm" objlocation="/user_data/STATE/ITEM/character/ANM/ANM_rig_WALK_sg_v001/ANM_rig_WALK_sg

parsing an xml file for unknown elements using python ElementTree

放肆的年华 提交于 2019-12-14 03:48:38
问题 I wish to extract all the tag names and their corresponding data from a multi-purpose xml file. Then save that information into a python dictionary (e.g tag = key, data = value). The catch being the tags names and values are unknown and of unknown quantity. <some_root_name> <tag_x>bubbles</tag_x> <tag_y>car</tag_y> <tag...>42</tag...> </some_root_name> I'm using ElementTree and can successfully extract the root tag and can extract values by referencing the tag names, but haven't been able to

How to display a specific attribute name and value beside a node in JTree?

房东的猫 提交于 2019-12-14 03:46:26
问题 I want to display the name and values of an attribute beside the node name in JTree . Can anyone tell me how to do that? Here is the code I use to display the JTree : import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.awt.Event.*; import java.io.*; import javax.swing.tree.*; import org.xml.sax.*; import org.xml.sax.helpers.*; import org.apache.xerces.parsers.*; public class XMLTreeView { private SAXTreeBuilder saxTree = null; private static String file = ""; public

How get mixed content XML/HTM?

荒凉一梦 提交于 2019-12-14 03:12:16
问题 I have a mixed content like this: <root> <element1> text </element1> <element2> <text>A <i>b</i></text> </element2> </root> I tried this Example to obtain the whole content with including the sub nodes with the tag " <i> ", but in these two Examples I use Path to XML: $reader->XML($xml); or $dom->loadXML($xml); $xpath = new DOMXpath($dom); and obtaining whole content of the XML. How can I obtain just the result text "A b"? 回答1: Should be used: $nodes = $xpath->evaluate( '//*|//text()

I can't get all the data from an xml file with php

那年仲夏 提交于 2019-12-14 03:07:19
问题 I can get the data from the xml apart from all the <Item> data. The code below only gets the data for the last one. I thought the foreach would get it for each of them but it doesn't seem to. <magic5Out version="2.1.0"> <Report customerPK="Survey_2" locationPK="229" userId="2299" template="13600" formDate="2012-04-11T00:00:00" dateTimeStarted="2012-04-11T07:34:04" dateTimeMobileReleased="2012-04-11T07:37:03" currentStatus="5" reportGuid="b174d011-77bb-4882-b87e-a2c60bdf265d"> <Results> <Item

PHP: XML to JSON fails

自作多情 提交于 2019-12-14 03:06:26
问题 When I try to convert XML(simpleXML) to JSON with json_encode, It works for XML without namesapce. For Example: <ebpacket> <head> <packettype> UserAuthorization</packettype> <staffcode> UserName </staffcode> <pwd> Password </pwd> <env> Evnironment </env> </head> </ebpacket> When I convert XML like below with attributes, json_encode returns an empty json: <soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/> <soapenv:Header /> <soapenv:Body> <ser:processTrans> <xmlValue>

Xslt : Create root element (Starting Tag )dynamically

女生的网名这么多〃 提交于 2019-12-14 03:01:10
问题 Following are the nodes in XML Data <WebServiceUrl>"http://webser.part.site"</WebServiceUrl> <UserName>nida</UserName> <Passsword>123</Password> </ProcessData> I have passed this node value to Xslt Service now i have this url NODE value in parameter e-g <xsl:param name="UserName"/> <xsl:param name="Password"/> <xsl:param name="WebServiceUrl"/> Now i want to create a soapenv:Envelope tag and use this value in it <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns