For the Perl XML parsing module. For the C library libxml2, use the libxml2 tag.
Questions tagged [xml-libxml]
225 questions
0
votes
1 answer
Why is my XML file empty after generating with XML::LibXML
This is my perl script
#!/usr/bin/perl
use XML::LibXML;
$doc = XML::LibXML::Document->new;
my $root = $doc->createElement("log");
$root -> setAttribute("time" => "now");
my $tag = $doc->createElement("greeting");
my $value = "hello";
$tag ->…

Bram Vanroy
- 27,032
- 24
- 137
- 239
0
votes
1 answer
Perl XML::LibXML very slow processing due to slope within elements
I wrote a code to import an xml-file into a database and encountered a huge performance problem. The xml-file has 150 Mb and contains 170,000 elements (ART) with corresponding subelements (REF_DATA, ...). I was able to find out the cause of the…

giordano
- 2,954
- 7
- 35
- 57
0
votes
0 answers
Perl / XML::LibXML no parsing due to namespace
I used XML::XPath to parse an xml-file and I encountered no problem. For several reason (not mantained (?), slowly, see for example here) I try XML::LibXML but don't succeed. The problem seems to be in the root of the xml-file. The following code…

giordano
- 2,954
- 7
- 35
- 57
0
votes
1 answer
Perl XML lib get full xpath
Looking to return the full xpath from a general xpath that may grab multiple results.
The search string would be something general like this:
/myXmlPath/@myValue
The contained xml nodes might look something like this:

Bruce Allen
- 81
- 5
0
votes
2 answers
Adding a new node using XML:libXML throwing error
Here is what the xml looks like
-
…

user1549994
- 125
- 2
- 15
0
votes
4 answers
Replace XML node with String in Perl using LibXML
I'm currently using a perl script with LibXML to process a given XML file. This goes decently well, but if I have a node with both child nodes and free text, I begin to struggle.
An example input would be:
this node…

LindenRathan
- 147
- 3
- 10
0
votes
1 answer
access sub child value by libxml::xpathcontext
I want to access the value of sub child and modify it. This is my xml
Hello
…

user3922604
- 131
- 1
- 10
0
votes
2 answers
LibXML : colon in removeAttribute and value in getAttribute
This is my xml file
Hello
wwf
warrior
…

user3922604
- 131
- 1
- 10
0
votes
3 answers
Is there an equivalent to XML::DOM::Node::dispose in XML::LibXML?
Does there exist an equivalent for the method dispose of XML::DOM in XML::LibXML?
I have to parse many XML files and I don't want to have memory problems.

Eranos
- 1
0
votes
1 answer
Is there a reason to use the XML::LibXML::Number-object in my XML::LibXML-example?
In this example I get to times '96'. Is there a possible case where I would need a XML::LibXML-Number-object to to achieve the goal?
#!/usr/bin/env perl
use warnings; use strict;
use 5.012;
use XML::LibXML;
my $xml_string =<

sid_com
- 24,137
- 26
- 96
- 187
0
votes
2 answers
XML::LibXML: How to get a Number/Boolean-object with find?
From http://metacpan.org/pod/XML::LibXML::Node:
find evaluates the XPath 1.0 expression using the current node as the context of the expression, and returns the result depending on what type of result the XPath expression had. For example, the…

sid_com
- 24,137
- 26
- 96
- 187
0
votes
1 answer
How can I tell Perl XML::LibXML to use newer libxml2 library during runtime?
Our machines come with libxml2 2.7.6 pre-installed on them. However, someone needed a newer version of libxml2 and installed 2.7.8 on our networked file system. Likewise, they used this version of libxml2 to compile their version of the Perl module…

YonkeyDonk64
- 281
- 2
- 12
0
votes
1 answer
How to count number of levels (depth) in XML branch in perl XML::LibXML?
I have a very simple problem. I want to find number of levels of an XML branch. Like:
…

aloha
- 1,561
- 13
- 26
0
votes
1 answer
Perl Read XML value
use strict;
use warnings;
use XML::LibXML;
my $xml = XML::LibXML->load_xml(IO => \*DATA);
for my $role ($xml->findnodes('//@role')) {
print $role->value;
}
__DATA__

chinna_82
- 6,353
- 17
- 79
- 134
0
votes
0 answers
xpath query on Linux command line
I am trying to use xpath queries on stack exchange data. The xml file has the following structure.
According to the data the row has the following attributes. It…

Ramakrishnan Kannan
- 604
- 1
- 11
- 24