xml

How can I extract a CDATA value from the structure created by XML::Simple?

I use a Perl script with the module XML:Simple to parse an XML feed: my $xml=XMLin($resp->content); my $xml2 = $xml->{params}{param}{value}{array}{data}{value}{struct}{member}; print $xml2->{prod_id}{value}{int}; #works fine print $xml2->{product_text}{value}{string}; #returns a hash reference (hash(0x...) What have I to modify to ...

Parsing XML with SAX/Python + no validation

Hi all, Hi, I am new to python and I'm trying to parse a XML file with SAX without validating it. The head of my xml file is: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE n:document SYSTEM "schema.dtd"> <n:document.... and I've tried to parse it with python 2.5.2: from xml.sax import make_parser, handler import sys parser = mak...

How can I translate my XML file to a CSV file, even if it has repeated tags?

I have this XML file: <cjl> <job> <plan on="1">aa</plan> <exec>d.java</exec> </job> </cjl> The job tag may be repeating and also the plan tag also may be repeating. <cjl> <job> <plan on="2">aa</plan> <exec>e.java</exec> </job> <job> <exec>f.java</exec> <plan on="1">bb</plan> ...

XPath selection by innertext

I'm trying to extract an element with a particular innertext from a parsed XML document. I know that I can select an element that has a child with a particular innertext using //myparent[mychild='foo'], but I actually just want to select the "mychild" element in this example. <myparent> <mychild> foo </mychild> </myparent> What would...

parse nodes using c#

Hello All I want to read this xml file using Id on <page> tag. <?xml version="1.0" encoding="utf-8" ?> <pages> <page id="NewsWatchVideo"> <HeaderText>Newswatch</HeaderText> <BellowText>'abc'.In this video you will see how the press responded to the .</BellowText> <FilePath>FLVPlayer_Progressive.sw...

Is there a backwards XML parser for .NET?

In my application, I have a known offset of interest in an XML string, and want to answer questions like "what is my parent element?" without parsing the whole document. This article mentions a library which appears to be in Objective-C for "backwards" XML parsing. My application doesn't require full XML support, so I'm happy to put up...

Java Swing: Generating dynamic GUI forms from XML

Hi, I am writing this application in Java, where I have a JTree on the left of the JFrame, and the item selected in the JTree determines what appears on the right. This is similar to Edit --> Preferences in Thunderbird, and several other applications' preferences. Anyhow the main difference is that in my app the stuff on the right is d...

How can i handle Special characters( =) in XML

Hello All I have some special characters in my data inside xml.So i am getting error to handle them. <SubFilePath>http://d2coa5o205622p.cloudfront.net/newswatchforweb&amp;amp;autoPlay=true&amp;amp;autoRewind=false&lt;/SubFilePath&gt; "'=' is an unexpected token. The expected token is '"; I know how to handle other special like "<","...

DOMDocument::load in PHP 5

Hello all, I open a 10MB+ XML file several times in my script in different functions: $dom = DOMDocument::load( $file ) or die('couldnt open'); 1) Is the above the old style of loading a document? I am using PHP 5. Oppening it statically? 2) Do I need to close the loading of the XML file, if possible? I suspect its caus...

How to train programmers in Oracle XML technology

Hi. I'm part of a team of clinical data programmers. We're taking on new responsibilities for loading and manipulating XML data in Oracle (specifically clinical and electronic medical record data). We don't have a lot of history with XML, XQuery, or Oracle XML services. What specific suggestions would you have for training our team? Our...

How to create Haar Cascade (xml) for using with OpenCV?

If you familiar with OpenCV library, you know what is haar cascade image object detection. I mean image object detection like human face or something else. I have haar cascade xml for face detection, but i don't know how to create my own. I want to create Haar Cascade xml to detect simple bright circle light sources (i.e. flashing infrar...

How to get DOMDocument to be nice to ASCII control characters?

The HTML document which I am parsing contains some ASCII control codes. I noticed that PHP's DOMDocument parser truncates text nodes when it finds ASCII control characters within the node, such as Device Control 0x13 End of Medium 0x19 File Separator 0x1C Group Separator 0x1D Is this a bug or a feature? Is there any...

Best XSD file generator

Hi, I am analyzing tools that generate XSD file from XML files. I find lot of tools in internet. XSD.exe utility that comes along with Visual Studio (xsd file.xml) Stylus Studio's XSD file generator XSD Interference tool from Microsoft XMLFox Professional Liquid XML Studio (XML Editor reverse engineering) Which of the above is best i...

Distinct values from xml using xsl

Hi I have xml like <categories> <category> <LOC>USA,UK,Spain <LOC> </category> <category> <LOC>India,USA,China <LOC> </category> <categories> I don't want to get the USA two times when I am displaying LOC <xsl:value of select="$LOC/> I was thinking of using some variable <xsl:variable n...

how to do simple xsd with netbeans

I need to define some schemes for an API whitch have communication sending and receiving xml strings. I want to document the scheme definition to the clients who will user that API. for example <store> <name>the store</name> <products> <product> <id></id> <name></name> <price></price> ...

How do I parse an external XML file (returned from a POST) with php?

I have a simple code written (based on some tutorials found around the internet) to parse and display an XML file. However, I only know how to reference an XML file stored on my server and I would like to be able to use an XML file that is being returned to me from a POST. Right now my code looks like this: if( ! $xml = simplexml_lo...

What is the Explanation for DOMDocument's Inconsistent Behavior when Dumping a non-ASCII Character?

I've noticed different "dumping" behaviors when using PHP's DOMDocument's saveXML() and saveHTML() methods. Here is a simple example of dumping the copyright symbol (). <?$domDoc = new DOMDocument(); $domDoc->loadHTML("&copy;"); echo $domDoc->saveHTML(); echo $domDoc->saveXML(); echo $domDoc->saveXML($domDoc); ?> The three du...

What xml parser should I use?

I have a somewhat large file (~500KiB) with a lot of small elements (~3000). I want to pick one element out of this and parse it to a java class. Attributes Simplified <xml> <attributes> <attribute> <id>4</id> <name>Test</id> </attribute> <attribute> <id>5</id> <name>Test2</name> </attribute> <!--3000...

validating xml in java as the document is built

I am working on converting an excel spread sheet into an xml document that needs to be validated against a schema. I am currently building the xml document using the DOM api, and validating at the end using SAX and a custom error handler. However, I would really like to be able to validate the xml produced from each Cell as I parse the e...

ComboBox to sorted Xml file. Need help to optimize.

I wrote a method that sorts values of a ComboBox and then saves them into Xml file. I'm very unhappy how it looks. Please feel free to take it apart and help me optimize it. The method looks very similar to this one: public void Save(ComboBox comboBoxItems) { var xmlElements = new XElement("Root"); List<string> children = n...