Questions tagged [xml-libxml]

For the Perl XML parsing module. For the C library libxml2, use the libxml2 tag.

225 questions
3
votes
2 answers

XML::LibXML issue finding XML nodes with a namespace

I am writing an XML parser and am having an issue with the program handling a link. I am attempting to parse an XML hierarchy Settings/Setting then findnode 'Value'. The following is an example of the XML:
3
votes
2 answers

XML::LibXML::Reader need warn on schema errors instead of exit

Basically I need to use the schema option from the perl module XML::libXML::Reader in order to validate a large (>1GB) XML file as the file is parsed. Previously I have used the xmllint command to validate an XML file against a given schema (xsd)…
Chazg76
  • 619
  • 5
  • 10
3
votes
2 answers

dump XML::LibXML elements

I would like to dump the xml doc tree similar to the way perl data types can be dumped. use Data::Dumper; print Dumper($foo); Recursivly dumps the structure contained by $foo (even if there are cyclic dependencies). However use XML::LibXML; my…
vlad_tepesch
  • 6,681
  • 1
  • 38
  • 80
3
votes
2 answers

How to prevent XML::LibXML to save modified xml using self-closing tag

The following working code reads my XML file containing lots of empty elements, then applies 2 changes and saves it again under different name. But it also changes empty elements like to self-closing tags like which…
Petr Matousu
  • 3,120
  • 1
  • 20
  • 32
3
votes
1 answer

Perl .bundle files

On my OSX machine, deep within a jungle of lib directories, I was able to see this -r-xr-xr-x 1 user users 45700 Feb 01 1:47 LibXSLT.bundle* 1) What are these .bundle files ? 2) Who creates them ? CPAN modules ? 3) If so, then can we control its…
Recker
  • 1,915
  • 25
  • 55
3
votes
1 answer

Validating XML in Perl with libxml and an XSD file

I am trying to have my perl script get an Xxml file from online and validate it according to an XSD file. The code to do this is as follows: my $url = shift @ARGV; my $response = $ua->get($url) || die "Can't fetch file"; my $file =…
Gnats
  • 273
  • 1
  • 3
  • 12
3
votes
3 answers

XML removeChild, but out output has a blank row

Simple removeChild test, although the xml line is removed, it maintains an empty blank row, how come? Btw - my source xml file does have indents, however even when I remove them I get the same result. So what's the point of being able to…
CraigP
  • 453
  • 1
  • 3
  • 17
3
votes
2 answers

Unregister namespaces in scope of context node

I am using XML::LibXML. In creating an XPath context, I need to be able to specify exactly which namespaces are available. However, all of the namespaces in the scope of the context node are automatically registered with the XPathContext object. I…
Nate Glenn
  • 6,455
  • 8
  • 52
  • 95
3
votes
3 answers

Find value of child node

Ok, this is a pretty rudimentary question, but I'm new to Perl and I honestly can't seem to find the answer anywhere, even though I'm sure it will be ridiculously simple. Let's say I have the following XML schema:
Devin
  • 1,014
  • 1
  • 9
  • 28
3
votes
3 answers

How do I use XML::LibXML to parse XML using SAX?

The only example code I have found so far is so old it won't work anymore (uses deprecated classes). All I need is something basic that demonstrates: Loading and parsing the XML from a file Defining the SAX event handler(s) Reading the attributes…
Paul Chernoch
  • 5,275
  • 3
  • 52
  • 73
3
votes
3 answers

Perl using XML Path Context to extract out data

I have the following xml and I want the attributes…
Samiron
  • 5,169
  • 2
  • 28
  • 55
3
votes
2 answers

Using XML::LibXML in Perl to alter XML file: newline chars are Unix, not Windows

Dear Perl and XML gurus I have a task to update values inside XML file using XPath. I use XML::LibXML library in Perl to read, alter and save XML file: # Read XML file my $parser = XML::LibXML->new(); my $doc = $parser->load_xml(location =>…
Ivan
  • 9,089
  • 4
  • 61
  • 74
3
votes
3 answers

Can't validate XML with XML schema and Perl (XML::LibXML)

xml: mario
qwertoyo
  • 1,332
  • 2
  • 15
  • 31
2
votes
1 answer

How to add Child and Grandchild XML tags by XML::LibXML?

I'm trying to make a simple XML file and add Child and Grandchild XML tags by XML::LibXML. I made country and location tags as below, but I want to add child and grandchild tags under country and location tags such as value. How do I add…
Monica
  • 176
  • 8
2
votes
2 answers

How to add newline for each XML output?

I'm trying to add newlines to each <> line in the XML output of XML::LibXML from https://stackoverflow.com/a/2934794/19508169. use strict; use warnings; use XML::LibXML; my $doc = XML::LibXML::Document->new('1.0', 'utf-8'); my $root =…
Monica
  • 176
  • 8
1 2
3
14 15