This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
source "https://rubygems.org"
|
||||
|
||||
gemspec
|
||||
|
||||
group :development do
|
||||
# bootstrapping
|
||||
gem "bundler", "~> 2.3"
|
||||
gem "rake", "13.2.1"
|
||||
|
||||
# building extensions
|
||||
gem "rake-compiler", "1.2.8"
|
||||
gem "rake-compiler-dock", "1.7.0"
|
||||
|
||||
# parser generator
|
||||
gem "rexical", "1.0.8"
|
||||
|
||||
# tests
|
||||
gem "minitest", "5.25.4"
|
||||
gem "minitest-parallel_fork", "2.0.0"
|
||||
gem "ruby_memcheck", "3.0.0"
|
||||
gem "rubyzip", "~> 2.3.2"
|
||||
gem "simplecov", "= 0.21.2"
|
||||
|
||||
# rubocop
|
||||
gem "standard", "1.43.0"
|
||||
gem "rubocop-minitest", "0.36.0"
|
||||
gem "rubocop-packaging", "0.5.2"
|
||||
gem "rubocop-rake", "0.6.0"
|
||||
end
|
||||
|
||||
# If Psych doesn't build, you can disable this group locally by running
|
||||
# `bundle config set --local without rdoc`
|
||||
# Then re-run `bundle install`.
|
||||
group :rdoc do
|
||||
gem "rdoc", "6.10.0" unless RUBY_PLATFORM == "java" || ENV["CI"]
|
||||
end
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,9 @@
|
||||
The MIT License
|
||||
|
||||
Copyright 2008 -- 2023 by Mike Dalessio, Aaron Patterson, Yoko Harada, Akinori MUSHA, John Shahid, Karol Bucek, Sam Ruby, Craig Barnes, Stephen Checkoway, Lars Kanis, Sergio Arbeo, Timothy Elliott, Nobuyoshi Nakada, Charles Nutter, Patrick Mahoney.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1,293 @@
|
||||
<div><img src="https://nokogiri.org/images/nokogiri-serif-black.png" align="right"/></div>
|
||||
|
||||
# Nokogiri
|
||||
|
||||
Nokogiri (鋸) makes it easy and painless to work with XML and HTML from Ruby. It provides a sensible, easy-to-understand API for [reading](https://nokogiri.org/tutorials/parsing_an_html_xml_document.html), writing, [modifying](https://nokogiri.org/tutorials/modifying_an_html_xml_document.html), and [querying](https://nokogiri.org/tutorials/searching_a_xml_html_document.html) documents. It is fast and standards-compliant by relying on native parsers like libxml2, libgumbo, and xerces.
|
||||
|
||||
## Guiding Principles
|
||||
|
||||
Some guiding principles Nokogiri tries to follow:
|
||||
|
||||
- be secure-by-default by treating all documents as **untrusted** by default
|
||||
- be a **thin-as-reasonable layer** on top of the underlying parsers, and don't attempt to fix behavioral differences between the parsers
|
||||
|
||||
|
||||
## Features Overview
|
||||
|
||||
- DOM Parser for XML, HTML4, and HTML5
|
||||
- SAX Parser for XML and HTML4
|
||||
- Push Parser for XML and HTML4
|
||||
- Document search via XPath 1.0
|
||||
- Document search via CSS3 selectors, with some jquery-like extensions
|
||||
- XSD Schema validation
|
||||
- XSLT transformation
|
||||
- "Builder" DSL for XML and HTML documents
|
||||
|
||||
|
||||
## Status
|
||||
|
||||
[](https://github.com/sparklemotion/nokogiri/actions/workflows/ci.yml)
|
||||
[](https://ci.appveyor.com/project/flavorjones/nokogiri/branch/main)
|
||||
|
||||
[](https://rubygems.org/gems/nokogiri)
|
||||
[](https://docs.github.com/en/code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/about-dependabot-security-updates#about-compatibility-scores)
|
||||
|
||||
[](https://bestpractices.coreinfrastructure.org/projects/5344)
|
||||
[](https://tidelift.com/subscription/pkg/rubygems-nokogiri?utm_source=rubygems-nokogiri&utm_medium=referral&utm_campaign=readme)
|
||||
|
||||
|
||||
## Support, Getting Help, and Reporting Issues
|
||||
|
||||
All official documentation is posted at https://nokogiri.org (the source for which is at https://github.com/sparklemotion/nokogiri.org/, and we welcome contributions).
|
||||
|
||||
### Reading
|
||||
|
||||
Your first stops for learning more about Nokogiri should be:
|
||||
|
||||
- [API Documentation](https://nokogiri.org/rdoc/index.html)
|
||||
- [Tutorials](https://nokogiri.org/tutorials/toc.html)
|
||||
- An excellent community-maintained [Cheat Sheet](https://github.com/sparklemotion/nokogiri/wiki/Cheat-sheet)
|
||||
|
||||
|
||||
### Ask For Help
|
||||
|
||||
There are a few ways to ask exploratory questions:
|
||||
|
||||
- The Nokogiri mailing list is active at https://groups.google.com/group/nokogiri-talk
|
||||
- Open an issue using the "Help Request" template at https://github.com/sparklemotion/nokogiri/issues
|
||||
- Open a discussion at https://github.com/sparklemotion/nokogiri/discussions
|
||||
|
||||
Please do not mail the maintainers at their personal addresses.
|
||||
|
||||
|
||||
### Report A Bug
|
||||
|
||||
The Nokogiri bug tracker is at https://github.com/sparklemotion/nokogiri/issues
|
||||
|
||||
Please use the "Bug Report" or "Installation Difficulties" templates.
|
||||
|
||||
|
||||
### Security and Vulnerability Reporting
|
||||
|
||||
Please report vulnerabilities at https://hackerone.com/nokogiri
|
||||
|
||||
Full information and description of our security policy is in [`SECURITY.md`](SECURITY.md)
|
||||
|
||||
|
||||
### Semantic Versioning Policy
|
||||
|
||||
Nokogiri follows [Semantic Versioning](https://semver.org/) (since 2017 or so). [](https://docs.github.com/en/code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/about-dependabot-security-updates#about-compatibility-scores)
|
||||
|
||||
We bump `Major.Minor.Patch` versions following this guidance:
|
||||
|
||||
`Major`: (we've never done this)
|
||||
|
||||
- Significant backwards-incompatible changes to the public API that would require rewriting existing application code.
|
||||
- Some examples of backwards-incompatible changes we might someday consider for a Major release are at [`ROADMAP.md`](ROADMAP.md).
|
||||
|
||||
`Minor`:
|
||||
|
||||
- Features and bugfixes.
|
||||
- Updating packaged libraries for non-security-related reasons.
|
||||
- Dropping support for EOLed Ruby versions. [Some folks find this objectionable](https://github.com/sparklemotion/nokogiri/issues/1568), but [SemVer says this is OK if the public API hasn't changed](https://semver.org/#what-should-i-do-if-i-update-my-own-dependencies-without-changing-the-public-api).
|
||||
- Backwards-incompatible changes to internal or private methods and constants. These are detailed in the "Changes" section of each changelog entry.
|
||||
- Removal of deprecated methods or parameters, after a generous transition period; usually when those methods or parameters are rarely-used or dangerous to the user. Essentially, removals that do not justify a major version bump.
|
||||
|
||||
|
||||
`Patch`:
|
||||
|
||||
- Bugfixes.
|
||||
- Security updates.
|
||||
- Updating packaged libraries for security-related reasons.
|
||||
|
||||
|
||||
### Sponsorship
|
||||
|
||||
You can help sponsor the maintainers of this software through one of these organizations:
|
||||
|
||||
- [github.com/sponsors/flavorjones](https://github.com/sponsors/flavorjones)
|
||||
- [opencollective.com/nokogiri](https://opencollective.com/nokogiri)
|
||||
- [tidelift.com/subscription/pkg/rubygems-nokogiri](https://tidelift.com/subscription/pkg/rubygems-nokogiri?utm_source=rubygems-nokogiri&utm_medium=referral&utm_campaign=readme)
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
Requirements:
|
||||
|
||||
- Ruby >= 3.1
|
||||
- JRuby >= 9.4.0.0
|
||||
|
||||
If you are compiling the native extension against a system version of libxml2:
|
||||
|
||||
- libxml2 >= 2.9.2 (recommended >= 2.12.0)
|
||||
|
||||
|
||||
### Native Gems: Faster, more reliable installation
|
||||
|
||||
"Native gems" contain pre-compiled libraries for a specific machine architecture. On supported platforms, this removes the need for compiling the C extension and the packaged libraries, or for system dependencies to exist. This results in **much faster installation** and **more reliable installation**, which as you probably know are the biggest headaches for Nokogiri users.
|
||||
|
||||
### Supported Platforms
|
||||
|
||||
Nokogiri ships pre-compiled, "native" gems for the following platforms:
|
||||
|
||||
- Linux:
|
||||
- `x86_64-linux-gnu`, `aarch64-linux-gnu`, and `arm-linux-gnu` (req: `glibc >= 2.29`)
|
||||
- `x86_64-linux-musl`, `aarch64-linux-musl`, and `arm-linux-musl`
|
||||
- Darwin/MacOS: `x86_64-darwin` and `arm64-darwin`
|
||||
- Windows: `x64-mingw-ucrt`
|
||||
- Java: any platform running JRuby 9.4 or higher
|
||||
|
||||
To determine whether your system supports one of these gems, look at the output of `bundle platform` or `ruby -e 'puts Gem::Platform.local.to_s'`.
|
||||
|
||||
If you're on a supported platform, either `gem install` or `bundle install` should install a native gem without any additional action on your part. This installation should only take a few seconds, and your output should look something like:
|
||||
|
||||
``` sh
|
||||
$ gem install nokogiri
|
||||
Fetching nokogiri-1.11.0-x86_64-linux.gem
|
||||
Successfully installed nokogiri-1.11.0-x86_64-linux
|
||||
1 gem installed
|
||||
```
|
||||
|
||||
|
||||
### Other Installation Options
|
||||
|
||||
Because Nokogiri is a C extension, it requires that you have a C compiler toolchain, Ruby development header files, and some system dependencies installed.
|
||||
|
||||
The following may work for you if you have an appropriately-configured system:
|
||||
|
||||
``` bash
|
||||
gem install nokogiri
|
||||
```
|
||||
|
||||
If you have any issues, please visit [Installing Nokogiri](https://nokogiri.org/tutorials/installing_nokogiri.html) for more complete instructions and troubleshooting.
|
||||
|
||||
|
||||
## How To Use Nokogiri
|
||||
|
||||
Nokogiri is a large library, and so it's challenging to briefly summarize it. We've tried to provide long, real-world examples at [Tutorials](https://nokogiri.org/tutorials/toc.html).
|
||||
|
||||
### Parsing and Querying
|
||||
|
||||
Here is example usage for parsing and querying a document:
|
||||
|
||||
```ruby
|
||||
#! /usr/bin/env ruby
|
||||
|
||||
require 'nokogiri'
|
||||
require 'open-uri'
|
||||
|
||||
# Fetch and parse HTML document
|
||||
doc = Nokogiri::HTML(URI.open('https://nokogiri.org/tutorials/installing_nokogiri.html'))
|
||||
|
||||
# Search for nodes by css
|
||||
doc.css('nav ul.menu li a', 'article h2').each do |link|
|
||||
puts link.content
|
||||
end
|
||||
|
||||
# Search for nodes by xpath
|
||||
doc.xpath('//nav//ul//li/a', '//article//h2').each do |link|
|
||||
puts link.content
|
||||
end
|
||||
|
||||
# Or mix and match
|
||||
doc.search('nav ul.menu li a', '//article//h2').each do |link|
|
||||
puts link.content
|
||||
end
|
||||
```
|
||||
|
||||
|
||||
### Encoding
|
||||
|
||||
Strings are always stored as UTF-8 internally. Methods that return
|
||||
text values will always return UTF-8 encoded strings. Methods that
|
||||
return a string containing markup (like `to_xml`, `to_html` and
|
||||
`inner_html`) will return a string encoded like the source document.
|
||||
|
||||
__WARNING__
|
||||
|
||||
Some documents declare one encoding, but actually use a different
|
||||
one. In these cases, which encoding should the parser choose?
|
||||
|
||||
Data is just a stream of bytes. Humans add meaning to that stream. Any
|
||||
particular set of bytes could be valid characters in multiple
|
||||
encodings, so detecting encoding with 100% accuracy is not
|
||||
possible. `libxml2` does its best, but it can't be right all the time.
|
||||
|
||||
If you want Nokogiri to handle the document encoding properly, your
|
||||
best bet is to explicitly set the encoding. Here is an example of
|
||||
explicitly setting the encoding to EUC-JP on the parser:
|
||||
|
||||
```ruby
|
||||
doc = Nokogiri.XML('<foo><bar /></foo>', nil, 'EUC-JP')
|
||||
```
|
||||
|
||||
|
||||
## Technical Overview
|
||||
|
||||
### Guiding Principles
|
||||
|
||||
As noted above, two guiding principles of the software are:
|
||||
|
||||
- be secure-by-default by treating all documents as **untrusted** by default
|
||||
- be a **thin-as-reasonable layer** on top of the underlying parsers, and don't attempt to fix behavioral differences between the parsers
|
||||
|
||||
Notably, despite all parsers being standards-compliant, there are behavioral inconsistencies between the parsers used in the CRuby and JRuby implementations, and Nokogiri does not and should not attempt to remove these inconsistencies. Instead, we surface these differences in the test suite when they are important/semantic; or we intentionally write tests to depend only on the important/semantic bits (omitting whitespace from regex matchers on results, for example).
|
||||
|
||||
|
||||
### CRuby
|
||||
|
||||
The Ruby (a.k.a., CRuby, MRI, YARV) implementation is a C extension that depends on libxml2 and libxslt (which in turn depend on zlib and possibly libiconv).
|
||||
|
||||
These dependencies are met by default by Nokogiri's packaged versions of the libxml2 and libxslt source code, but a configuration option `--use-system-libraries` is provided to allow specification of alternative library locations. See [Installing Nokogiri](https://nokogiri.org/tutorials/installing_nokogiri.html) for full documentation.
|
||||
|
||||
We provide native gems by pre-compiling libxml2 and libxslt (and potentially zlib and libiconv) and packaging them into the gem file. In this case, no compilation is necessary at installation time, which leads to faster and more reliable installation.
|
||||
|
||||
See [`LICENSE-DEPENDENCIES.md`](LICENSE-DEPENDENCIES.md) for more information on which dependencies are provided in which native and source gems.
|
||||
|
||||
|
||||
### JRuby
|
||||
|
||||
The Java (a.k.a. JRuby) implementation is a Java extension that depends primarily on Xerces and NekoHTML for parsing, though additional dependencies are on `isorelax`, `nekodtd`, `jing`, `serializer`, `xalan-j`, and `xml-apis`.
|
||||
|
||||
These dependencies are provided by pre-compiled jar files packaged in the `java` platform gem.
|
||||
|
||||
See [`LICENSE-DEPENDENCIES.md`](LICENSE-DEPENDENCIES.md) for more information on which dependencies are provided in which native and source gems.
|
||||
|
||||
|
||||
## Contributing
|
||||
|
||||
See [`CONTRIBUTING.md`](CONTRIBUTING.md) for an intro guide to developing Nokogiri.
|
||||
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
We've adopted the Contributor Covenant code of conduct, which you can read in full in [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md).
|
||||
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the terms of the MIT license.
|
||||
|
||||
See this license at [`LICENSE.md`](LICENSE.md).
|
||||
|
||||
|
||||
### Dependencies
|
||||
|
||||
Some additional libraries may be distributed with your version of Nokogiri. Please see [`LICENSE-DEPENDENCIES.md`](LICENSE-DEPENDENCIES.md) for a discussion of the variations as well as the licenses thereof.
|
||||
|
||||
|
||||
## Authors
|
||||
|
||||
- Mike Dalessio
|
||||
- Aaron Patterson
|
||||
- Yoko Harada
|
||||
- Akinori MUSHA
|
||||
- John Shahid
|
||||
- Karol Bucek
|
||||
- Sam Ruby
|
||||
- Craig Barnes
|
||||
- Stephen Checkoway
|
||||
- Lars Kanis
|
||||
- Sergio Arbeo
|
||||
- Timothy Elliott
|
||||
- Nobuyoshi Nakada
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "optparse"
|
||||
require "open-uri"
|
||||
require "uri"
|
||||
require "rubygems"
|
||||
require "nokogiri"
|
||||
autoload :IRB, "irb"
|
||||
|
||||
parse_class = Nokogiri
|
||||
encoding = nil
|
||||
|
||||
# This module provides some tunables with the nokogiri CLI for use in
|
||||
# your ~/.nokogirirc.
|
||||
module Nokogiri
|
||||
module CLI
|
||||
class << self
|
||||
# Specify the console engine, defaulted to IRB.
|
||||
#
|
||||
# call-seq:
|
||||
# require 'pry'
|
||||
# Nokogiri::CLI.console = Pry
|
||||
attr_writer :console
|
||||
|
||||
def console
|
||||
case @console
|
||||
when Symbol
|
||||
Kernel.const_get(@console)
|
||||
else
|
||||
@console
|
||||
end
|
||||
end
|
||||
|
||||
attr_accessor :rcfile
|
||||
end
|
||||
|
||||
self.rcfile = File.expand_path("~/.nokogirirc")
|
||||
self.console = :IRB
|
||||
end
|
||||
end
|
||||
|
||||
def safe_read(uri_or_path)
|
||||
uri = URI.parse(uri_or_path)
|
||||
case uri
|
||||
when URI::HTTP
|
||||
uri.read
|
||||
when URI::File
|
||||
File.read(uri.path)
|
||||
else
|
||||
File.read(uri_or_path)
|
||||
end
|
||||
end
|
||||
|
||||
opts = OptionParser.new do |opts|
|
||||
opts.banner = "Nokogiri: an HTML, XML, SAX, and Reader parser"
|
||||
opts.define_head("Usage: nokogiri <uri|path> [options]")
|
||||
opts.separator("")
|
||||
opts.separator("Examples:")
|
||||
opts.separator(" nokogiri https://www.ruby-lang.org/")
|
||||
opts.separator(" nokogiri ./public/index.html")
|
||||
opts.separator(" curl -s http://www.nokogiri.org | nokogiri -e'p $_.css(\"h1\").length'")
|
||||
opts.separator("")
|
||||
opts.separator("Options:")
|
||||
|
||||
opts.on("--type type", "Parse as type: xml or html (default: auto)", [:xml, :html]) do |v|
|
||||
parse_class = { xml: Nokogiri::XML, html: Nokogiri::HTML }[v]
|
||||
end
|
||||
|
||||
opts.on("-C file", "Specifies initialization file to load (default #{Nokogiri::CLI.rcfile})") do |v|
|
||||
Nokogiri::CLI.rcfile = v
|
||||
end
|
||||
|
||||
opts.on("-E", "--encoding encoding", "Read as encoding (default: #{encoding || "none"})") do |v|
|
||||
encoding = v
|
||||
end
|
||||
|
||||
opts.on("-e command", "Specifies script from command-line.") do |v|
|
||||
@script = v
|
||||
end
|
||||
|
||||
opts.on("--rng <uri|path>", "Validate using this rng file.") do |v|
|
||||
@rng = Nokogiri::XML::RelaxNG(safe_read(v))
|
||||
end
|
||||
|
||||
opts.on_tail("-?", "--help", "Show this message") do
|
||||
puts opts
|
||||
exit
|
||||
end
|
||||
|
||||
opts.on_tail("-v", "--version", "Show version") do
|
||||
puts Nokogiri::VersionInfo.instance.to_markdown
|
||||
exit
|
||||
end
|
||||
end
|
||||
opts.parse!
|
||||
|
||||
url = ARGV.shift
|
||||
|
||||
if url.to_s.strip.empty? && $stdin.tty?
|
||||
puts opts
|
||||
exit 1
|
||||
end
|
||||
|
||||
if File.file?(Nokogiri::CLI.rcfile)
|
||||
load Nokogiri::CLI.rcfile
|
||||
end
|
||||
|
||||
@doc = if url || $stdin.tty?
|
||||
parse_class.parse(safe_read(url), url, encoding)
|
||||
else
|
||||
parse_class.parse($stdin, nil, encoding)
|
||||
end
|
||||
|
||||
$_ = @doc
|
||||
|
||||
if @rng
|
||||
@rng.validate(@doc).each do |error|
|
||||
puts error.message
|
||||
end
|
||||
elsif @script
|
||||
begin
|
||||
eval(@script, binding, "<main>") # rubocop:disable Security/Eval
|
||||
rescue Exception => e # rubocop:disable Lint/RescueException
|
||||
warn("ERROR: Exception raised while evaluating '#{@script}'")
|
||||
raise e
|
||||
end
|
||||
else
|
||||
puts "Your document is stored in @doc..."
|
||||
Nokogiri::CLI.console.start
|
||||
end
|
||||
@@ -0,0 +1,42 @@
|
||||
---
|
||||
libxml2:
|
||||
version: "2.13.6"
|
||||
sha256: "f453480307524968f7a04ec65e64f2a83a825973bcd260a2e7691be82ae70c96"
|
||||
# sha-256 hash provided in https://download.gnome.org/sources/libxml2/2.13/libxml2-2.13.6.sha256sum
|
||||
|
||||
libxslt:
|
||||
version: "1.1.42"
|
||||
sha256: "85ca62cac0d41fc77d3f6033da9df6fd73d20ea2fc18b0a3609ffb4110e1baeb"
|
||||
# sha-256 hash provided in https://download.gnome.org/sources/libxslt/1.1/libxslt-1.1.42.sha256sum
|
||||
|
||||
zlib:
|
||||
version: "1.3.1"
|
||||
sha256: "9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23"
|
||||
# SHA-256 hash provided on http://zlib.net/
|
||||
|
||||
libiconv:
|
||||
version: "1.17"
|
||||
sha256: "8f74213b56238c85a50a5329f77e06198771e70dd9a739779f4c02f65d971313"
|
||||
# signature verified by following this path:
|
||||
# - release announced at https://savannah.gnu.org/forum/forum.php?forum_id=10175
|
||||
# - which links to https://savannah.gnu.org/users/haible as the releaser
|
||||
# - which links to https://savannah.gnu.org/people/viewgpg.php?user_id=1871 as the gpg key
|
||||
#
|
||||
# So:
|
||||
# - wget -q -O - https://savannah.gnu.org/people/viewgpg.php?user_id=1871 | gpg --import
|
||||
# gpg: key F5BE8B267C6A406D: 1 signature not checked due to a missing key
|
||||
# gpg: key F5BE8B267C6A406D: public key "Bruno Haible (Open Source Development) <bruno@clisp.org>" imported
|
||||
# gpg: Total number processed: 1
|
||||
# gpg: imported: 1
|
||||
# gpg: marginals needed: 3 completes needed: 1 trust model: pgp
|
||||
# gpg: depth: 0 valid: 4 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 4u
|
||||
# gpg: next trustdb check due at 2024-05-09
|
||||
# - gpg --verify libiconv-1.17.tar.gz.sig ports/archives/libiconv-1.17.tar.gz
|
||||
# gpg: Signature made Sun 15 May 2022 11:26:42 AM EDT
|
||||
# gpg: using RSA key 9001B85AF9E1B83DF1BDA942F5BE8B267C6A406D
|
||||
# gpg: Good signature from "Bruno Haible (Open Source Development) <bruno@clisp.org>" [unknown]
|
||||
# gpg: WARNING: This key is not certified with a trusted signature!
|
||||
# gpg: There is no indication that the signature belongs to the owner.
|
||||
# Primary key fingerprint: 9001 B85A F9E1 B83D F1BD A942 F5BE 8B26 7C6A 406D
|
||||
#
|
||||
# And this sha256sum is calculated from that verified tarball.
|
||||
@@ -0,0 +1,38 @@
|
||||
# -*-makefile-*-
|
||||
# DO NOT DELETE
|
||||
|
||||
gumbo.o: $(srcdir)/nokogiri.h
|
||||
html_document.o: $(srcdir)/nokogiri.h
|
||||
html_element_description.o: $(srcdir)/nokogiri.h
|
||||
html_entity_lookup.o: $(srcdir)/nokogiri.h
|
||||
html_sax_parser_context.o: $(srcdir)/nokogiri.h
|
||||
html_sax_push_parser.o: $(srcdir)/nokogiri.h
|
||||
libxml2_backwards_compat.o: $(srcdir)/nokogiri.h
|
||||
nokogiri.o: $(srcdir)/nokogiri.h
|
||||
test_global_handlers.o: $(srcdir)/nokogiri.h
|
||||
xml_attr.o: $(srcdir)/nokogiri.h
|
||||
xml_attribute_decl.o: $(srcdir)/nokogiri.h
|
||||
xml_cdata.o: $(srcdir)/nokogiri.h
|
||||
xml_comment.o: $(srcdir)/nokogiri.h
|
||||
xml_document.o: $(srcdir)/nokogiri.h
|
||||
xml_document_fragment.o: $(srcdir)/nokogiri.h
|
||||
xml_dtd.o: $(srcdir)/nokogiri.h
|
||||
xml_element_content.o: $(srcdir)/nokogiri.h
|
||||
xml_element_decl.o: $(srcdir)/nokogiri.h
|
||||
xml_encoding_handler.o: $(srcdir)/nokogiri.h
|
||||
xml_entity_decl.o: $(srcdir)/nokogiri.h
|
||||
xml_entity_reference.o: $(srcdir)/nokogiri.h
|
||||
xml_namespace.o: $(srcdir)/nokogiri.h
|
||||
xml_node.o: $(srcdir)/nokogiri.h
|
||||
xml_node_set.o: $(srcdir)/nokogiri.h
|
||||
xml_processing_instruction.o: $(srcdir)/nokogiri.h
|
||||
xml_reader.o: $(srcdir)/nokogiri.h
|
||||
xml_relax_ng.o: $(srcdir)/nokogiri.h
|
||||
xml_sax_parser.o: $(srcdir)/nokogiri.h
|
||||
xml_sax_parser_context.o: $(srcdir)/nokogiri.h
|
||||
xml_sax_push_parser.o: $(srcdir)/nokogiri.h
|
||||
xml_schema.o: $(srcdir)/nokogiri.h
|
||||
xml_syntax_error.o: $(srcdir)/nokogiri.h
|
||||
xml_text.o: $(srcdir)/nokogiri.h
|
||||
xml_xpath_context.o: $(srcdir)/nokogiri.h
|
||||
xslt_stylesheet.o: $(srcdir)/nokogiri.h
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,610 @@
|
||||
//
|
||||
// Copyright 2013-2021 Sam Ruby, Stephen Checkoway
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
//
|
||||
// nokogumbo.c defines the following:
|
||||
//
|
||||
// class Nokogumbo
|
||||
// def parse(utf8_string) # returns Nokogiri::HTML5::Document
|
||||
// end
|
||||
//
|
||||
// Processing starts by calling gumbo_parse_with_options. The resulting document tree
|
||||
// is then walked, a parallel libxml2 tree is constructed, and the final document is
|
||||
// then wrapped using noko_xml_document_wrap. This approach reduces memory and CPU
|
||||
// requirements as Ruby objects are only built when necessary.
|
||||
//
|
||||
|
||||
#include <nokogiri.h>
|
||||
|
||||
#include "nokogiri_gumbo.h"
|
||||
|
||||
VALUE cNokogiriHtml5Document;
|
||||
|
||||
// Interned symbols
|
||||
static ID internal_subset;
|
||||
static ID parent;
|
||||
|
||||
#include <nokogiri.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/HTMLtree.h>
|
||||
|
||||
// URI = system id
|
||||
// external id = public id
|
||||
static xmlDocPtr
|
||||
new_html_doc(const char *dtd_name, const char *system, const char *public)
|
||||
{
|
||||
// These two libxml2 functions take the public and system ids in
|
||||
// opposite orders.
|
||||
htmlDocPtr doc = htmlNewDocNoDtD(/* URI */ NULL, /* ExternalID */NULL);
|
||||
assert(doc);
|
||||
if (dtd_name) {
|
||||
xmlCreateIntSubset(doc, (const xmlChar *)dtd_name, (const xmlChar *)public, (const xmlChar *)system);
|
||||
}
|
||||
return doc;
|
||||
}
|
||||
|
||||
static xmlNodePtr
|
||||
get_parent(xmlNodePtr node)
|
||||
{
|
||||
return node->parent;
|
||||
}
|
||||
|
||||
static GumboOutput *
|
||||
perform_parse(const GumboOptions *options, VALUE input)
|
||||
{
|
||||
assert(RTEST(input));
|
||||
Check_Type(input, T_STRING);
|
||||
GumboOutput *output = gumbo_parse_with_options(
|
||||
options,
|
||||
RSTRING_PTR(input),
|
||||
(size_t)RSTRING_LEN(input)
|
||||
);
|
||||
|
||||
const char *status_string = gumbo_status_to_string(output->status);
|
||||
switch (output->status) {
|
||||
case GUMBO_STATUS_OK:
|
||||
break;
|
||||
case GUMBO_STATUS_TOO_MANY_ATTRIBUTES:
|
||||
case GUMBO_STATUS_TREE_TOO_DEEP:
|
||||
gumbo_destroy_output(output);
|
||||
rb_raise(rb_eArgError, "%s", status_string);
|
||||
case GUMBO_STATUS_OUT_OF_MEMORY:
|
||||
gumbo_destroy_output(output);
|
||||
rb_raise(rb_eNoMemError, "%s", status_string);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
static xmlNsPtr
|
||||
lookup_or_add_ns(
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr root,
|
||||
const char *href,
|
||||
const char *prefix
|
||||
)
|
||||
{
|
||||
xmlNsPtr ns = xmlSearchNs(doc, root, (const xmlChar *)prefix);
|
||||
if (ns) {
|
||||
return ns;
|
||||
}
|
||||
return xmlNewNs(root, (const xmlChar *)href, (const xmlChar *)prefix);
|
||||
}
|
||||
|
||||
static void
|
||||
set_line(xmlNodePtr node, size_t line)
|
||||
{
|
||||
// libxml2 uses 65535 to mean look elsewhere for the line number on some
|
||||
// nodes.
|
||||
if (line < 65535) {
|
||||
node->line = (unsigned short)line;
|
||||
}
|
||||
}
|
||||
|
||||
// Construct an XML tree rooted at xml_output_node from the Gumbo tree rooted
|
||||
// at gumbo_node.
|
||||
static void
|
||||
build_tree(
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr xml_output_node,
|
||||
const GumboNode *gumbo_node
|
||||
)
|
||||
{
|
||||
xmlNodePtr xml_root = NULL;
|
||||
xmlNodePtr xml_node = xml_output_node;
|
||||
size_t child_index = 0;
|
||||
|
||||
while (true) {
|
||||
assert(gumbo_node != NULL);
|
||||
const GumboVector *children = gumbo_node->type == GUMBO_NODE_DOCUMENT ?
|
||||
&gumbo_node->v.document.children : &gumbo_node->v.element.children;
|
||||
if (child_index >= children->length) {
|
||||
// Move up the tree and to the next child.
|
||||
if (xml_node == xml_output_node) {
|
||||
// We've built as much of the tree as we can.
|
||||
return;
|
||||
}
|
||||
child_index = gumbo_node->index_within_parent + 1;
|
||||
gumbo_node = gumbo_node->parent;
|
||||
xml_node = get_parent(xml_node);
|
||||
// Children of fragments don't share the same root, so reset it and
|
||||
// it'll be set below. In the non-fragment case, this will only happen
|
||||
// after the html element has been finished at which point there are no
|
||||
// further elements.
|
||||
if (xml_node == xml_output_node) {
|
||||
xml_root = NULL;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
const GumboNode *gumbo_child = children->data[child_index++];
|
||||
xmlNodePtr xml_child;
|
||||
|
||||
switch (gumbo_child->type) {
|
||||
case GUMBO_NODE_DOCUMENT:
|
||||
abort(); // Bug in Gumbo.
|
||||
|
||||
case GUMBO_NODE_TEXT:
|
||||
case GUMBO_NODE_WHITESPACE:
|
||||
xml_child = xmlNewDocText(doc, (const xmlChar *)gumbo_child->v.text.text);
|
||||
set_line(xml_child, gumbo_child->v.text.start_pos.line);
|
||||
xmlAddChild(xml_node, xml_child);
|
||||
break;
|
||||
|
||||
case GUMBO_NODE_CDATA:
|
||||
xml_child = xmlNewCDataBlock(doc, (const xmlChar *)gumbo_child->v.text.text,
|
||||
(int) strlen(gumbo_child->v.text.text));
|
||||
set_line(xml_child, gumbo_child->v.text.start_pos.line);
|
||||
xmlAddChild(xml_node, xml_child);
|
||||
break;
|
||||
|
||||
case GUMBO_NODE_COMMENT:
|
||||
xml_child = xmlNewDocComment(doc, (const xmlChar *)gumbo_child->v.text.text);
|
||||
set_line(xml_child, gumbo_child->v.text.start_pos.line);
|
||||
xmlAddChild(xml_node, xml_child);
|
||||
break;
|
||||
|
||||
case GUMBO_NODE_TEMPLATE:
|
||||
// XXX: Should create a template element and a new DocumentFragment
|
||||
case GUMBO_NODE_ELEMENT: {
|
||||
xml_child = xmlNewDocNode(doc, NULL, (const xmlChar *)gumbo_child->v.element.name, NULL);
|
||||
set_line(xml_child, gumbo_child->v.element.start_pos.line);
|
||||
if (xml_root == NULL) {
|
||||
xml_root = xml_child;
|
||||
}
|
||||
xmlNsPtr ns = NULL;
|
||||
switch (gumbo_child->v.element.tag_namespace) {
|
||||
case GUMBO_NAMESPACE_HTML:
|
||||
break;
|
||||
case GUMBO_NAMESPACE_SVG:
|
||||
ns = lookup_or_add_ns(doc, xml_root, "http://www.w3.org/2000/svg", "svg");
|
||||
break;
|
||||
case GUMBO_NAMESPACE_MATHML:
|
||||
ns = lookup_or_add_ns(doc, xml_root, "http://www.w3.org/1998/Math/MathML", "math");
|
||||
break;
|
||||
}
|
||||
if (ns != NULL) {
|
||||
xmlSetNs(xml_child, ns);
|
||||
}
|
||||
xmlAddChild(xml_node, xml_child);
|
||||
|
||||
// Add the attributes.
|
||||
const GumboVector *attrs = &gumbo_child->v.element.attributes;
|
||||
for (size_t i = 0; i < attrs->length; i++) {
|
||||
const GumboAttribute *attr = attrs->data[i];
|
||||
|
||||
switch (attr->attr_namespace) {
|
||||
case GUMBO_ATTR_NAMESPACE_XLINK:
|
||||
ns = lookup_or_add_ns(doc, xml_root, "http://www.w3.org/1999/xlink", "xlink");
|
||||
break;
|
||||
|
||||
case GUMBO_ATTR_NAMESPACE_XML:
|
||||
ns = lookup_or_add_ns(doc, xml_root, "http://www.w3.org/XML/1998/namespace", "xml");
|
||||
break;
|
||||
|
||||
case GUMBO_ATTR_NAMESPACE_XMLNS:
|
||||
ns = lookup_or_add_ns(doc, xml_root, "http://www.w3.org/2000/xmlns/", "xmlns");
|
||||
break;
|
||||
|
||||
default:
|
||||
ns = NULL;
|
||||
}
|
||||
xmlNewNsProp(xml_child, ns, (const xmlChar *)attr->name, (const xmlChar *)attr->value);
|
||||
}
|
||||
|
||||
// Add children for this element.
|
||||
child_index = 0;
|
||||
gumbo_node = gumbo_child;
|
||||
xml_node = xml_child;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
add_errors(const GumboOutput *output, VALUE rdoc, VALUE input, VALUE url)
|
||||
{
|
||||
const char *input_str = RSTRING_PTR(input);
|
||||
size_t input_len = (size_t)RSTRING_LEN(input);
|
||||
|
||||
// Add parse errors to rdoc.
|
||||
if (output->errors.length) {
|
||||
const GumboVector *errors = &output->errors;
|
||||
VALUE rerrors = rb_ary_new2(errors->length);
|
||||
|
||||
for (size_t i = 0; i < errors->length; i++) {
|
||||
GumboError *err = errors->data[i];
|
||||
GumboSourcePosition position = gumbo_error_position(err);
|
||||
char *msg;
|
||||
size_t size = gumbo_caret_diagnostic_to_string(err, input_str, input_len, &msg);
|
||||
VALUE err_str = rb_utf8_str_new(msg, (int)size);
|
||||
free(msg);
|
||||
VALUE syntax_error = rb_class_new_instance(1, &err_str, cNokogiriXmlSyntaxError);
|
||||
const char *error_code = gumbo_error_code(err);
|
||||
VALUE str1 = error_code ? rb_utf8_str_new_static(error_code, (int)strlen(error_code)) : Qnil;
|
||||
rb_iv_set(syntax_error, "@domain", INT2NUM(1)); // XML_FROM_PARSER
|
||||
rb_iv_set(syntax_error, "@code", INT2NUM(1)); // XML_ERR_INTERNAL_ERROR
|
||||
rb_iv_set(syntax_error, "@level", INT2NUM(2)); // XML_ERR_ERROR
|
||||
rb_iv_set(syntax_error, "@file", url);
|
||||
rb_iv_set(syntax_error, "@line", SIZET2NUM(position.line));
|
||||
rb_iv_set(syntax_error, "@str1", str1);
|
||||
rb_iv_set(syntax_error, "@str2", Qnil);
|
||||
rb_iv_set(syntax_error, "@str3", Qnil);
|
||||
rb_iv_set(syntax_error, "@int1", INT2NUM(0));
|
||||
rb_iv_set(syntax_error, "@column", SIZET2NUM(position.column));
|
||||
rb_ary_push(rerrors, syntax_error);
|
||||
}
|
||||
rb_iv_set(rdoc, "@errors", rerrors);
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
GumboOutput *output;
|
||||
VALUE input;
|
||||
VALUE url_or_frag;
|
||||
VALUE klass;
|
||||
xmlDocPtr doc;
|
||||
} ParseArgs;
|
||||
|
||||
static VALUE
|
||||
parse_cleanup(VALUE parse_args)
|
||||
{
|
||||
ParseArgs *args = (ParseArgs *)parse_args;
|
||||
gumbo_destroy_output(args->output);
|
||||
// Make sure garbage collection doesn't mark the objects as being live based
|
||||
// on references from the ParseArgs. This may be unnecessary.
|
||||
args->input = Qnil;
|
||||
args->url_or_frag = Qnil;
|
||||
if (args->doc != NULL) {
|
||||
xmlFreeDoc(args->doc);
|
||||
}
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
// Scan the keyword arguments for options common to the document and fragment
|
||||
// parse.
|
||||
static GumboOptions
|
||||
common_options(VALUE kwargs)
|
||||
{
|
||||
// The order of the keywords determines the order of the values below.
|
||||
// If this order is changed, then setting the options below must change as
|
||||
// well.
|
||||
ID keywords[] = {
|
||||
// Required keywords.
|
||||
rb_intern_const("max_attributes"),
|
||||
rb_intern_const("max_errors"),
|
||||
rb_intern_const("max_tree_depth"),
|
||||
|
||||
// Optional keywords.
|
||||
rb_intern_const("parse_noscript_content_as_text"),
|
||||
};
|
||||
VALUE values[sizeof keywords / sizeof keywords[0]];
|
||||
|
||||
// Extract the values coresponding to the required keywords. Raise an error
|
||||
// if required arguments are missing.
|
||||
rb_get_kwargs(kwargs, keywords, 3, 1, values);
|
||||
|
||||
GumboOptions options = kGumboDefaultOptions;
|
||||
options.max_attributes = NUM2INT(values[0]);
|
||||
options.max_errors = NUM2INT(values[1]);
|
||||
|
||||
// handle negative values
|
||||
int depth = NUM2INT(values[2]);
|
||||
options.max_tree_depth = depth < 0 ? UINT_MAX : (unsigned int)depth;
|
||||
|
||||
options.parse_noscript_content_as_text = values[3] != Qundef && RTEST(values[3]);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
static VALUE parse_continue(VALUE parse_args);
|
||||
|
||||
/*
|
||||
* @!visibility protected
|
||||
*/
|
||||
static VALUE
|
||||
noko_gumbo_s_parse(int argc, VALUE *argv, VALUE _self)
|
||||
{
|
||||
VALUE input, url, klass, kwargs;
|
||||
|
||||
rb_scan_args(argc, argv, "3:", &input, &url, &klass, &kwargs);
|
||||
if (NIL_P(kwargs)) {
|
||||
kwargs = rb_hash_new();
|
||||
}
|
||||
|
||||
GumboOptions options = common_options(kwargs);
|
||||
|
||||
GumboOutput *output = perform_parse(&options, input);
|
||||
ParseArgs args = {
|
||||
.output = output,
|
||||
.input = input,
|
||||
.url_or_frag = url,
|
||||
.klass = klass,
|
||||
.doc = NULL,
|
||||
};
|
||||
|
||||
return rb_ensure(parse_continue, (VALUE)(&args), parse_cleanup, (VALUE)(&args));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
parse_continue(VALUE parse_args)
|
||||
{
|
||||
ParseArgs *args = (ParseArgs *)parse_args;
|
||||
GumboOutput *output = args->output;
|
||||
xmlDocPtr doc;
|
||||
if (output->document->v.document.has_doctype) {
|
||||
const char *name = output->document->v.document.name;
|
||||
const char *public = output->document->v.document.public_identifier;
|
||||
const char *system = output->document->v.document.system_identifier;
|
||||
public = public[0] ? public : NULL;
|
||||
system = system[0] ? system : NULL;
|
||||
doc = new_html_doc(name, system, public);
|
||||
} else {
|
||||
doc = new_html_doc(NULL, NULL, NULL);
|
||||
}
|
||||
args->doc = doc; // Make sure doc gets cleaned up if an error is thrown.
|
||||
build_tree(doc, (xmlNodePtr)doc, output->document);
|
||||
VALUE rdoc = noko_xml_document_wrap(args->klass, doc);
|
||||
rb_iv_set(rdoc, "@url", args->url_or_frag);
|
||||
rb_iv_set(rdoc, "@quirks_mode", INT2NUM(output->document->v.document.doc_type_quirks_mode));
|
||||
args->doc = NULL; // The Ruby runtime now owns doc so don't delete it.
|
||||
add_errors(output, rdoc, args->input, args->url_or_frag);
|
||||
return rdoc;
|
||||
}
|
||||
|
||||
static int
|
||||
lookup_namespace(VALUE node, bool require_known_ns)
|
||||
{
|
||||
ID namespace, href;
|
||||
CONST_ID(namespace, "namespace");
|
||||
CONST_ID(href, "href");
|
||||
VALUE ns = rb_funcall(node, namespace, 0);
|
||||
|
||||
if (NIL_P(ns)) {
|
||||
return GUMBO_NAMESPACE_HTML;
|
||||
}
|
||||
ns = rb_funcall(ns, href, 0);
|
||||
assert(RTEST(ns));
|
||||
Check_Type(ns, T_STRING);
|
||||
|
||||
const char *href_ptr = RSTRING_PTR(ns);
|
||||
size_t href_len = (size_t)RSTRING_LEN(ns);
|
||||
#define NAMESPACE_P(uri) (href_len == sizeof uri - 1 && !memcmp(href_ptr, uri, href_len))
|
||||
if (NAMESPACE_P("http://www.w3.org/1999/xhtml")) {
|
||||
return GUMBO_NAMESPACE_HTML;
|
||||
}
|
||||
if (NAMESPACE_P("http://www.w3.org/1998/Math/MathML")) {
|
||||
return GUMBO_NAMESPACE_MATHML;
|
||||
}
|
||||
if (NAMESPACE_P("http://www.w3.org/2000/svg")) {
|
||||
return GUMBO_NAMESPACE_SVG;
|
||||
}
|
||||
#undef NAMESPACE_P
|
||||
if (require_known_ns) {
|
||||
rb_raise(rb_eArgError, "Unexpected namespace URI \"%*s\"", (int)href_len, href_ptr);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static xmlNodePtr
|
||||
extract_xml_node(VALUE node)
|
||||
{
|
||||
xmlNodePtr xml_node;
|
||||
Noko_Node_Get_Struct(node, xmlNode, xml_node);
|
||||
return xml_node;
|
||||
}
|
||||
|
||||
static VALUE fragment_continue(VALUE parse_args);
|
||||
|
||||
/*
|
||||
* @!visibility protected
|
||||
*/
|
||||
static VALUE
|
||||
noko_gumbo_s_fragment(int argc, VALUE *argv, VALUE _self)
|
||||
{
|
||||
VALUE doc_fragment;
|
||||
VALUE tags;
|
||||
VALUE ctx;
|
||||
VALUE kwargs;
|
||||
ID name = rb_intern_const("name");
|
||||
const char *ctx_tag;
|
||||
GumboNamespaceEnum ctx_ns;
|
||||
GumboQuirksModeEnum quirks_mode;
|
||||
bool form = false;
|
||||
const char *encoding = NULL;
|
||||
|
||||
rb_scan_args(argc, argv, "3:", &doc_fragment, &tags, &ctx, &kwargs);
|
||||
if (NIL_P(kwargs)) {
|
||||
kwargs = rb_hash_new();
|
||||
}
|
||||
|
||||
GumboOptions options = common_options(kwargs);
|
||||
|
||||
if (NIL_P(ctx)) {
|
||||
ctx_tag = "body";
|
||||
ctx_ns = GUMBO_NAMESPACE_HTML;
|
||||
} else if (TYPE(ctx) == T_STRING) {
|
||||
ctx_tag = StringValueCStr(ctx);
|
||||
ctx_ns = GUMBO_NAMESPACE_HTML;
|
||||
size_t len = (size_t)RSTRING_LEN(ctx);
|
||||
const char *colon = memchr(ctx_tag, ':', len);
|
||||
if (colon) {
|
||||
switch (colon - ctx_tag) {
|
||||
case 3:
|
||||
if (st_strncasecmp(ctx_tag, "svg", 3) != 0) {
|
||||
goto error;
|
||||
}
|
||||
ctx_ns = GUMBO_NAMESPACE_SVG;
|
||||
break;
|
||||
case 4:
|
||||
if (st_strncasecmp(ctx_tag, "html", 4) == 0) {
|
||||
ctx_ns = GUMBO_NAMESPACE_HTML;
|
||||
} else if (st_strncasecmp(ctx_tag, "math", 4) == 0) {
|
||||
ctx_ns = GUMBO_NAMESPACE_MATHML;
|
||||
} else {
|
||||
goto error;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
error:
|
||||
rb_raise(rb_eArgError, "Invalid context namespace '%*s'", (int)(colon - ctx_tag), ctx_tag);
|
||||
}
|
||||
ctx_tag = colon + 1;
|
||||
} else {
|
||||
// For convenience, put 'svg' and 'math' in their namespaces.
|
||||
if (len == 3 && st_strncasecmp(ctx_tag, "svg", 3) == 0) {
|
||||
ctx_ns = GUMBO_NAMESPACE_SVG;
|
||||
} else if (len == 4 && st_strncasecmp(ctx_tag, "math", 4) == 0) {
|
||||
ctx_ns = GUMBO_NAMESPACE_MATHML;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if it's a form.
|
||||
form = ctx_ns == GUMBO_NAMESPACE_HTML && st_strcasecmp(ctx_tag, "form") == 0;
|
||||
} else {
|
||||
ID element_ = rb_intern_const("element?");
|
||||
|
||||
// Context fragment name.
|
||||
VALUE tag_name = rb_funcall(ctx, name, 0);
|
||||
assert(RTEST(tag_name));
|
||||
Check_Type(tag_name, T_STRING);
|
||||
ctx_tag = StringValueCStr(tag_name);
|
||||
|
||||
// Context fragment namespace.
|
||||
ctx_ns = lookup_namespace(ctx, true);
|
||||
|
||||
// Check for a form ancestor, including self.
|
||||
for (VALUE node = ctx;
|
||||
!NIL_P(node);
|
||||
node = rb_respond_to(node, parent) ? rb_funcall(node, parent, 0) : Qnil) {
|
||||
if (!RTEST(rb_funcall(node, element_, 0))) {
|
||||
continue;
|
||||
}
|
||||
VALUE element_name = rb_funcall(node, name, 0);
|
||||
if (RSTRING_LEN(element_name) == 4
|
||||
&& !st_strcasecmp(RSTRING_PTR(element_name), "form")
|
||||
&& lookup_namespace(node, false) == GUMBO_NAMESPACE_HTML) {
|
||||
form = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Encoding.
|
||||
if (ctx_ns == GUMBO_NAMESPACE_MATHML
|
||||
&& RSTRING_LEN(tag_name) == 14
|
||||
&& !st_strcasecmp(ctx_tag, "annotation-xml")) {
|
||||
VALUE enc = rb_funcall(ctx, rb_intern_const("[]"),
|
||||
1,
|
||||
rb_utf8_str_new_static("encoding", 8));
|
||||
if (RTEST(enc)) {
|
||||
Check_Type(enc, T_STRING);
|
||||
encoding = StringValueCStr(enc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Quirks mode.
|
||||
VALUE doc = rb_funcall(doc_fragment, rb_intern_const("document"), 0);
|
||||
VALUE dtd = rb_funcall(doc, internal_subset, 0);
|
||||
VALUE doc_quirks_mode = rb_iv_get(doc, "@quirks_mode");
|
||||
if (NIL_P(ctx) || (TYPE(ctx) == T_STRING) || NIL_P(doc_quirks_mode)) {
|
||||
quirks_mode = GUMBO_DOCTYPE_NO_QUIRKS;
|
||||
} else if (NIL_P(dtd)) {
|
||||
quirks_mode = GUMBO_DOCTYPE_QUIRKS;
|
||||
} else {
|
||||
VALUE dtd_name = rb_funcall(dtd, name, 0);
|
||||
VALUE pubid = rb_funcall(dtd, rb_intern_const("external_id"), 0);
|
||||
VALUE sysid = rb_funcall(dtd, rb_intern_const("system_id"), 0);
|
||||
quirks_mode = gumbo_compute_quirks_mode(
|
||||
NIL_P(dtd_name) ? NULL : StringValueCStr(dtd_name),
|
||||
NIL_P(pubid) ? NULL : StringValueCStr(pubid),
|
||||
NIL_P(sysid) ? NULL : StringValueCStr(sysid)
|
||||
);
|
||||
}
|
||||
|
||||
// Perform a fragment parse.
|
||||
options.fragment_context = ctx_tag;
|
||||
options.fragment_namespace = ctx_ns;
|
||||
options.fragment_encoding = encoding;
|
||||
options.quirks_mode = quirks_mode;
|
||||
options.fragment_context_has_form_ancestor = form;
|
||||
|
||||
// Add one to the max tree depth to account for the HTML element.
|
||||
if (options.max_tree_depth < UINT_MAX) { options.max_tree_depth++; }
|
||||
|
||||
GumboOutput *output = perform_parse(&options, tags);
|
||||
ParseArgs args = {
|
||||
.output = output,
|
||||
.input = tags,
|
||||
.url_or_frag = doc_fragment,
|
||||
.doc = (xmlDocPtr)extract_xml_node(doc),
|
||||
};
|
||||
rb_ensure(fragment_continue, (VALUE)(&args), parse_cleanup, (VALUE)(&args));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
fragment_continue(VALUE parse_args)
|
||||
{
|
||||
ParseArgs *args = (ParseArgs *)parse_args;
|
||||
GumboOutput *output = args->output;
|
||||
VALUE doc_fragment = args->url_or_frag;
|
||||
xmlDocPtr xml_doc = args->doc;
|
||||
|
||||
args->doc = NULL; // The Ruby runtime owns doc so make sure we don't delete it.
|
||||
xmlNodePtr xml_frag = extract_xml_node(doc_fragment);
|
||||
build_tree(xml_doc, xml_frag, output->root);
|
||||
rb_iv_set(doc_fragment, "@quirks_mode", INT2NUM(output->document->v.document.doc_type_quirks_mode));
|
||||
add_errors(output, doc_fragment, args->input, rb_utf8_str_new_static("#fragment", 9));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
// Initialize the Nokogumbo class and fetch constants we will use later.
|
||||
void
|
||||
noko_init_gumbo(void)
|
||||
{
|
||||
// Class constants.
|
||||
cNokogiriHtml5Document = rb_define_class_under(mNokogiriHtml5, "Document", cNokogiriHtml4Document);
|
||||
rb_gc_register_mark_object(cNokogiriHtml5Document);
|
||||
|
||||
// Interned symbols.
|
||||
internal_subset = rb_intern_const("internal_subset");
|
||||
parent = rb_intern_const("parent");
|
||||
|
||||
// Define Nokogumbo module with parse and fragment methods.
|
||||
rb_define_singleton_method(mNokogiriGumbo, "parse", noko_gumbo_s_parse, -1);
|
||||
rb_define_singleton_method(mNokogiriGumbo, "fragment", noko_gumbo_s_fragment, -1);
|
||||
}
|
||||
|
||||
// vim: set shiftwidth=2 softtabstop=2 tabstop=8 expandtab:
|
||||
@@ -0,0 +1,171 @@
|
||||
#include <nokogiri.h>
|
||||
|
||||
VALUE cNokogiriHtml4Document ;
|
||||
|
||||
static ID id_encoding_found;
|
||||
static ID id_to_s;
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* new(uri=nil, external_id=nil) → HTML4::Document
|
||||
*
|
||||
* Create a new empty document with base URI +uri+ and external ID +external_id+.
|
||||
*/
|
||||
static VALUE
|
||||
rb_html_document_s_new(int argc, VALUE *argv, VALUE klass)
|
||||
{
|
||||
VALUE uri, external_id, rest, rb_doc;
|
||||
htmlDocPtr doc;
|
||||
|
||||
rb_scan_args(argc, argv, "0*", &rest);
|
||||
uri = rb_ary_entry(rest, (long)0);
|
||||
external_id = rb_ary_entry(rest, (long)1);
|
||||
|
||||
doc = htmlNewDoc(
|
||||
RTEST(uri) ? (const xmlChar *)StringValueCStr(uri) : NULL,
|
||||
RTEST(external_id) ? (const xmlChar *)StringValueCStr(external_id) : NULL
|
||||
);
|
||||
rb_doc = noko_xml_document_wrap_with_init_args(klass, doc, argc, argv);
|
||||
return rb_doc ;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* read_io(io, url, encoding, options)
|
||||
*
|
||||
* Read the HTML document from +io+ with given +url+, +encoding+,
|
||||
* and +options+. See Nokogiri::HTML4.parse
|
||||
*/
|
||||
static VALUE
|
||||
rb_html_document_s_read_io(VALUE klass, VALUE rb_io, VALUE rb_url, VALUE rb_encoding, VALUE rb_options)
|
||||
{
|
||||
VALUE rb_doc;
|
||||
VALUE rb_error_list = rb_ary_new();
|
||||
htmlDocPtr c_doc;
|
||||
const char *c_url = NIL_P(rb_url) ? NULL : StringValueCStr(rb_url);
|
||||
const char *c_encoding = NIL_P(rb_encoding) ? NULL : StringValueCStr(rb_encoding);
|
||||
int options = NUM2INT(rb_options);
|
||||
|
||||
xmlSetStructuredErrorFunc((void *)rb_error_list, noko__error_array_pusher);
|
||||
|
||||
c_doc = htmlReadIO(noko_io_read, noko_io_close, (void *)rb_io, c_url, c_encoding, options);
|
||||
|
||||
xmlSetStructuredErrorFunc(NULL, NULL);
|
||||
|
||||
/*
|
||||
* If EncodingFound has occurred in EncodingReader, make sure to do
|
||||
* a cleanup and propagate the error.
|
||||
*/
|
||||
if (rb_respond_to(rb_io, id_encoding_found)) {
|
||||
VALUE encoding_found = rb_funcall(rb_io, id_encoding_found, 0);
|
||||
if (!NIL_P(encoding_found)) {
|
||||
xmlFreeDoc(c_doc);
|
||||
rb_exc_raise(encoding_found);
|
||||
}
|
||||
}
|
||||
|
||||
if ((c_doc == NULL) || (!(options & XML_PARSE_RECOVER) && (RARRAY_LEN(rb_error_list) > 0))) {
|
||||
VALUE rb_error ;
|
||||
|
||||
xmlFreeDoc(c_doc);
|
||||
|
||||
rb_error = rb_ary_entry(rb_error_list, 0);
|
||||
if (rb_error == Qnil) {
|
||||
rb_raise(rb_eRuntimeError, "Could not parse document");
|
||||
} else {
|
||||
VALUE exception_message = rb_funcall(rb_error, id_to_s, 0);
|
||||
exception_message = rb_str_concat(rb_str_new2("Parser without recover option encountered error or warning: "),
|
||||
exception_message);
|
||||
rb_exc_raise(rb_class_new_instance(1, &exception_message, cNokogiriXmlSyntaxError));
|
||||
}
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
rb_doc = noko_xml_document_wrap(klass, c_doc);
|
||||
rb_iv_set(rb_doc, "@errors", rb_error_list);
|
||||
return rb_doc;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* read_memory(string, url, encoding, options)
|
||||
*
|
||||
* Read the HTML document contained in +string+ with given +url+, +encoding+,
|
||||
* and +options+. See Nokogiri::HTML4.parse
|
||||
*/
|
||||
static VALUE
|
||||
rb_html_document_s_read_memory(VALUE klass, VALUE rb_html, VALUE rb_url, VALUE rb_encoding, VALUE rb_options)
|
||||
{
|
||||
VALUE rb_doc;
|
||||
VALUE rb_error_list = rb_ary_new();
|
||||
htmlDocPtr c_doc;
|
||||
const char *c_buffer = StringValuePtr(rb_html);
|
||||
const char *c_url = NIL_P(rb_url) ? NULL : StringValueCStr(rb_url);
|
||||
const char *c_encoding = NIL_P(rb_encoding) ? NULL : StringValueCStr(rb_encoding);
|
||||
int html_len = (int)RSTRING_LEN(rb_html);
|
||||
int options = NUM2INT(rb_options);
|
||||
|
||||
xmlSetStructuredErrorFunc((void *)rb_error_list, noko__error_array_pusher);
|
||||
|
||||
c_doc = htmlReadMemory(c_buffer, html_len, c_url, c_encoding, options);
|
||||
|
||||
xmlSetStructuredErrorFunc(NULL, NULL);
|
||||
|
||||
if ((c_doc == NULL) || (!(options & XML_PARSE_RECOVER) && (RARRAY_LEN(rb_error_list) > 0))) {
|
||||
VALUE rb_error ;
|
||||
|
||||
xmlFreeDoc(c_doc);
|
||||
|
||||
rb_error = rb_ary_entry(rb_error_list, 0);
|
||||
if (rb_error == Qnil) {
|
||||
rb_raise(rb_eRuntimeError, "Could not parse document");
|
||||
} else {
|
||||
VALUE exception_message = rb_funcall(rb_error, id_to_s, 0);
|
||||
exception_message = rb_str_concat(rb_str_new2("Parser without recover option encountered error or warning: "),
|
||||
exception_message);
|
||||
rb_exc_raise(rb_class_new_instance(1, &exception_message, cNokogiriXmlSyntaxError));
|
||||
}
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
rb_doc = noko_xml_document_wrap(klass, c_doc);
|
||||
rb_iv_set(rb_doc, "@errors", rb_error_list);
|
||||
return rb_doc;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* type
|
||||
*
|
||||
* The type for this document
|
||||
*/
|
||||
static VALUE
|
||||
rb_html_document_type(VALUE self)
|
||||
{
|
||||
htmlDocPtr doc = noko_xml_document_unwrap(self);
|
||||
return INT2NUM(doc->type);
|
||||
}
|
||||
|
||||
void
|
||||
noko_init_html_document(void)
|
||||
{
|
||||
/* this is here so that rdoc doesn't ignore this file. */
|
||||
/*
|
||||
mNokogiri = rb_define_module("Nokogiri");
|
||||
mNokogiriHtml4 = rb_define_module_under(mNokogiri, "HTML4");
|
||||
*/
|
||||
|
||||
assert(cNokogiriXmlDocument);
|
||||
cNokogiriHtml4Document = rb_define_class_under(mNokogiriHtml4, "Document", cNokogiriXmlDocument);
|
||||
|
||||
rb_define_singleton_method(cNokogiriHtml4Document, "read_memory", rb_html_document_s_read_memory, 4);
|
||||
rb_define_singleton_method(cNokogiriHtml4Document, "read_io", rb_html_document_s_read_io, 4);
|
||||
rb_define_singleton_method(cNokogiriHtml4Document, "new", rb_html_document_s_new, -1);
|
||||
|
||||
rb_define_method(cNokogiriHtml4Document, "type", rb_html_document_type, 0);
|
||||
|
||||
id_encoding_found = rb_intern("encoding_found");
|
||||
id_to_s = rb_intern("to_s");
|
||||
}
|
||||
@@ -0,0 +1,299 @@
|
||||
#include <nokogiri.h>
|
||||
|
||||
static const rb_data_type_t html_elem_desc_type = {
|
||||
.wrap_struct_name = "htmlElemDesc",
|
||||
.flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
|
||||
};
|
||||
|
||||
VALUE cNokogiriHtml4ElementDescription ;
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* required_attributes
|
||||
*
|
||||
* A list of required attributes for this element
|
||||
*/
|
||||
static VALUE
|
||||
required_attributes(VALUE self)
|
||||
{
|
||||
const htmlElemDesc *description;
|
||||
VALUE list;
|
||||
int i;
|
||||
|
||||
TypedData_Get_Struct(self, htmlElemDesc, &html_elem_desc_type, description);
|
||||
|
||||
list = rb_ary_new();
|
||||
|
||||
if (NULL == description->attrs_req) { return list; }
|
||||
|
||||
for (i = 0; description->attrs_depr[i]; i++) {
|
||||
rb_ary_push(list, NOKOGIRI_STR_NEW2(description->attrs_req[i]));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* deprecated_attributes
|
||||
*
|
||||
* A list of deprecated attributes for this element
|
||||
*/
|
||||
static VALUE
|
||||
deprecated_attributes(VALUE self)
|
||||
{
|
||||
const htmlElemDesc *description;
|
||||
VALUE list;
|
||||
int i;
|
||||
|
||||
TypedData_Get_Struct(self, htmlElemDesc, &html_elem_desc_type, description);
|
||||
|
||||
list = rb_ary_new();
|
||||
|
||||
if (NULL == description->attrs_depr) { return list; }
|
||||
|
||||
for (i = 0; description->attrs_depr[i]; i++) {
|
||||
rb_ary_push(list, NOKOGIRI_STR_NEW2(description->attrs_depr[i]));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* optional_attributes
|
||||
*
|
||||
* A list of optional attributes for this element
|
||||
*/
|
||||
static VALUE
|
||||
optional_attributes(VALUE self)
|
||||
{
|
||||
const htmlElemDesc *description;
|
||||
VALUE list;
|
||||
int i;
|
||||
|
||||
TypedData_Get_Struct(self, htmlElemDesc, &html_elem_desc_type, description);
|
||||
|
||||
list = rb_ary_new();
|
||||
|
||||
if (NULL == description->attrs_opt) { return list; }
|
||||
|
||||
for (i = 0; description->attrs_opt[i]; i++) {
|
||||
rb_ary_push(list, NOKOGIRI_STR_NEW2(description->attrs_opt[i]));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* default_sub_element
|
||||
*
|
||||
* The default sub element for this element
|
||||
*/
|
||||
static VALUE
|
||||
default_sub_element(VALUE self)
|
||||
{
|
||||
const htmlElemDesc *description;
|
||||
TypedData_Get_Struct(self, htmlElemDesc, &html_elem_desc_type, description);
|
||||
|
||||
if (description->defaultsubelt) {
|
||||
return NOKOGIRI_STR_NEW2(description->defaultsubelt);
|
||||
}
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* sub_elements
|
||||
*
|
||||
* A list of allowed sub elements for this element.
|
||||
*/
|
||||
static VALUE
|
||||
sub_elements(VALUE self)
|
||||
{
|
||||
const htmlElemDesc *description;
|
||||
VALUE list;
|
||||
int i;
|
||||
|
||||
TypedData_Get_Struct(self, htmlElemDesc, &html_elem_desc_type, description);
|
||||
|
||||
list = rb_ary_new();
|
||||
|
||||
if (NULL == description->subelts) { return list; }
|
||||
|
||||
for (i = 0; description->subelts[i]; i++) {
|
||||
rb_ary_push(list, NOKOGIRI_STR_NEW2(description->subelts[i]));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* description
|
||||
*
|
||||
* The description for this element
|
||||
*/
|
||||
static VALUE
|
||||
description(VALUE self)
|
||||
{
|
||||
const htmlElemDesc *description;
|
||||
TypedData_Get_Struct(self, htmlElemDesc, &html_elem_desc_type, description);
|
||||
|
||||
return NOKOGIRI_STR_NEW2(description->desc);
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* inline?
|
||||
*
|
||||
* Is this element an inline element?
|
||||
*/
|
||||
static VALUE
|
||||
inline_eh(VALUE self)
|
||||
{
|
||||
const htmlElemDesc *description;
|
||||
TypedData_Get_Struct(self, htmlElemDesc, &html_elem_desc_type, description);
|
||||
|
||||
if (description->isinline) { return Qtrue; }
|
||||
return Qfalse;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* deprecated?
|
||||
*
|
||||
* Is this element deprecated?
|
||||
*/
|
||||
static VALUE
|
||||
deprecated_eh(VALUE self)
|
||||
{
|
||||
const htmlElemDesc *description;
|
||||
TypedData_Get_Struct(self, htmlElemDesc, &html_elem_desc_type, description);
|
||||
|
||||
if (description->depr) { return Qtrue; }
|
||||
return Qfalse;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* empty?
|
||||
*
|
||||
* Is this an empty element?
|
||||
*/
|
||||
static VALUE
|
||||
empty_eh(VALUE self)
|
||||
{
|
||||
const htmlElemDesc *description;
|
||||
TypedData_Get_Struct(self, htmlElemDesc, &html_elem_desc_type, description);
|
||||
|
||||
if (description->empty) { return Qtrue; }
|
||||
return Qfalse;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* save_end_tag?
|
||||
*
|
||||
* Should the end tag be saved?
|
||||
*/
|
||||
static VALUE
|
||||
save_end_tag_eh(VALUE self)
|
||||
{
|
||||
const htmlElemDesc *description;
|
||||
TypedData_Get_Struct(self, htmlElemDesc, &html_elem_desc_type, description);
|
||||
|
||||
if (description->saveEndTag) { return Qtrue; }
|
||||
return Qfalse;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* implied_end_tag?
|
||||
*
|
||||
* Can the end tag be implied for this tag?
|
||||
*/
|
||||
static VALUE
|
||||
implied_end_tag_eh(VALUE self)
|
||||
{
|
||||
const htmlElemDesc *description;
|
||||
TypedData_Get_Struct(self, htmlElemDesc, &html_elem_desc_type, description);
|
||||
|
||||
if (description->endTag) { return Qtrue; }
|
||||
return Qfalse;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* implied_start_tag?
|
||||
*
|
||||
* Can the start tag be implied for this tag?
|
||||
*/
|
||||
static VALUE
|
||||
implied_start_tag_eh(VALUE self)
|
||||
{
|
||||
const htmlElemDesc *description;
|
||||
TypedData_Get_Struct(self, htmlElemDesc, &html_elem_desc_type, description);
|
||||
|
||||
if (description->startTag) { return Qtrue; }
|
||||
return Qfalse;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* name
|
||||
*
|
||||
* Get the tag name for this ElementDescription
|
||||
*/
|
||||
static VALUE
|
||||
name(VALUE self)
|
||||
{
|
||||
const htmlElemDesc *description;
|
||||
TypedData_Get_Struct(self, htmlElemDesc, &html_elem_desc_type, description);
|
||||
|
||||
if (NULL == description->name) { return Qnil; }
|
||||
return NOKOGIRI_STR_NEW2(description->name);
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* [](tag_name)
|
||||
*
|
||||
* Get ElementDescription for +tag_name+
|
||||
*/
|
||||
static VALUE
|
||||
get_description(VALUE klass, VALUE tag_name)
|
||||
{
|
||||
const htmlElemDesc *description = htmlTagLookup(
|
||||
(const xmlChar *)StringValueCStr(tag_name)
|
||||
);
|
||||
|
||||
if (NULL == description) { return Qnil; }
|
||||
return TypedData_Wrap_Struct(klass, &html_elem_desc_type, DISCARD_CONST_QUAL(void *, description));
|
||||
}
|
||||
|
||||
void
|
||||
noko_init_html_element_description(void)
|
||||
{
|
||||
cNokogiriHtml4ElementDescription = rb_define_class_under(mNokogiriHtml4, "ElementDescription", rb_cObject);
|
||||
|
||||
rb_undef_alloc_func(cNokogiriHtml4ElementDescription);
|
||||
|
||||
rb_define_singleton_method(cNokogiriHtml4ElementDescription, "[]", get_description, 1);
|
||||
|
||||
rb_define_method(cNokogiriHtml4ElementDescription, "name", name, 0);
|
||||
rb_define_method(cNokogiriHtml4ElementDescription, "implied_start_tag?", implied_start_tag_eh, 0);
|
||||
rb_define_method(cNokogiriHtml4ElementDescription, "implied_end_tag?", implied_end_tag_eh, 0);
|
||||
rb_define_method(cNokogiriHtml4ElementDescription, "save_end_tag?", save_end_tag_eh, 0);
|
||||
rb_define_method(cNokogiriHtml4ElementDescription, "empty?", empty_eh, 0);
|
||||
rb_define_method(cNokogiriHtml4ElementDescription, "deprecated?", deprecated_eh, 0);
|
||||
rb_define_method(cNokogiriHtml4ElementDescription, "inline?", inline_eh, 0);
|
||||
rb_define_method(cNokogiriHtml4ElementDescription, "description", description, 0);
|
||||
rb_define_method(cNokogiriHtml4ElementDescription, "sub_elements", sub_elements, 0);
|
||||
rb_define_method(cNokogiriHtml4ElementDescription, "default_sub_element", default_sub_element, 0);
|
||||
rb_define_method(cNokogiriHtml4ElementDescription, "optional_attributes", optional_attributes, 0);
|
||||
rb_define_method(cNokogiriHtml4ElementDescription, "deprecated_attributes", deprecated_attributes, 0);
|
||||
rb_define_method(cNokogiriHtml4ElementDescription, "required_attributes", required_attributes, 0);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
#include <nokogiri.h>
|
||||
|
||||
static VALUE cNokogiriHtml4EntityLookup;
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* get(key)
|
||||
*
|
||||
* Get the HTML4::EntityDescription for +key+
|
||||
*/
|
||||
static VALUE
|
||||
get(VALUE _, VALUE rb_entity_name)
|
||||
{
|
||||
VALUE cNokogiriHtml4EntityDescription;
|
||||
const htmlEntityDesc *c_entity_desc;
|
||||
VALUE rb_constructor_args[3];
|
||||
|
||||
c_entity_desc = htmlEntityLookup((const xmlChar *)StringValueCStr(rb_entity_name));
|
||||
if (NULL == c_entity_desc) {
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
rb_constructor_args[0] = UINT2NUM(c_entity_desc->value);
|
||||
rb_constructor_args[1] = NOKOGIRI_STR_NEW2(c_entity_desc->name);
|
||||
rb_constructor_args[2] = NOKOGIRI_STR_NEW2(c_entity_desc->desc);
|
||||
|
||||
cNokogiriHtml4EntityDescription = rb_const_get_at(mNokogiriHtml4, rb_intern("EntityDescription"));
|
||||
return rb_class_new_instance(3, rb_constructor_args, cNokogiriHtml4EntityDescription);
|
||||
}
|
||||
|
||||
void
|
||||
noko_init_html_entity_lookup(void)
|
||||
{
|
||||
cNokogiriHtml4EntityLookup = rb_define_class_under(mNokogiriHtml4, "EntityLookup", rb_cObject);
|
||||
|
||||
rb_define_method(cNokogiriHtml4EntityLookup, "get", get, 1);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
#include <nokogiri.h>
|
||||
|
||||
VALUE cNokogiriHtml4SaxParser;
|
||||
|
||||
static ID id_start_document;
|
||||
|
||||
static void
|
||||
noko_html4_sax_parser_start_document(void *ctx)
|
||||
{
|
||||
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr)ctx;
|
||||
VALUE self = (VALUE)ctxt->_private;
|
||||
VALUE doc = rb_iv_get(self, "@document");
|
||||
|
||||
xmlSAX2StartDocument(ctx);
|
||||
|
||||
rb_funcall(doc, id_start_document, 0);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
noko_html4_sax_parser_initialize(VALUE self)
|
||||
{
|
||||
xmlSAXHandlerPtr handler = noko_xml_sax_parser_unwrap(self);
|
||||
|
||||
rb_call_super(0, NULL);
|
||||
|
||||
handler->startDocument = noko_html4_sax_parser_start_document;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
void
|
||||
noko_init_html4_sax_parser(void)
|
||||
{
|
||||
cNokogiriHtml4SaxParser = rb_define_class_under(mNokogiriHtml4Sax, "Parser", cNokogiriXmlSaxParser);
|
||||
|
||||
rb_define_private_method(cNokogiriHtml4SaxParser, "initialize_native",
|
||||
noko_html4_sax_parser_initialize, 0);
|
||||
|
||||
id_start_document = rb_intern("start_document");
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
#include <nokogiri.h>
|
||||
|
||||
VALUE cNokogiriHtml4SaxParserContext ;
|
||||
|
||||
/* :nodoc: */
|
||||
static VALUE
|
||||
noko_html4_sax_parser_context_s_native_memory(VALUE rb_class, VALUE rb_input, VALUE rb_encoding)
|
||||
{
|
||||
Check_Type(rb_input, T_STRING);
|
||||
if (!(int)RSTRING_LEN(rb_input)) {
|
||||
rb_raise(rb_eRuntimeError, "input string cannot be empty");
|
||||
}
|
||||
|
||||
if (!NIL_P(rb_encoding) && !rb_obj_is_kind_of(rb_encoding, rb_cEncoding)) {
|
||||
rb_raise(rb_eTypeError, "argument must be an Encoding object");
|
||||
}
|
||||
|
||||
htmlParserCtxtPtr c_context =
|
||||
htmlCreateMemoryParserCtxt(StringValuePtr(rb_input), (int)RSTRING_LEN(rb_input));
|
||||
if (!c_context) {
|
||||
rb_raise(rb_eRuntimeError, "failed to create xml sax parser context");
|
||||
}
|
||||
|
||||
noko_xml_sax_parser_context_set_encoding(c_context, rb_encoding);
|
||||
|
||||
if (c_context->sax) {
|
||||
xmlFree(c_context->sax);
|
||||
c_context->sax = NULL;
|
||||
}
|
||||
|
||||
return noko_xml_sax_parser_context_wrap(rb_class, c_context);
|
||||
}
|
||||
|
||||
/* :nodoc: */
|
||||
static VALUE
|
||||
noko_html4_sax_parser_context_s_native_file(VALUE rb_class, VALUE rb_filename, VALUE rb_encoding)
|
||||
{
|
||||
if (!NIL_P(rb_encoding) && !rb_obj_is_kind_of(rb_encoding, rb_cEncoding)) {
|
||||
rb_raise(rb_eTypeError, "argument must be an Encoding object");
|
||||
}
|
||||
|
||||
htmlParserCtxtPtr c_context = htmlCreateFileParserCtxt(StringValueCStr(rb_filename), NULL);
|
||||
if (!c_context) {
|
||||
rb_raise(rb_eRuntimeError, "failed to create xml sax parser context");
|
||||
}
|
||||
|
||||
noko_xml_sax_parser_context_set_encoding(c_context, rb_encoding);
|
||||
|
||||
if (c_context->sax) {
|
||||
xmlFree(c_context->sax);
|
||||
c_context->sax = NULL;
|
||||
}
|
||||
|
||||
return noko_xml_sax_parser_context_wrap(rb_class, c_context);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
noko_html4_sax_parser_context__parse_with(VALUE rb_context, VALUE rb_sax_parser)
|
||||
{
|
||||
htmlParserCtxtPtr ctxt;
|
||||
htmlSAXHandlerPtr sax;
|
||||
|
||||
if (!rb_obj_is_kind_of(rb_sax_parser, cNokogiriXmlSaxParser)) {
|
||||
rb_raise(rb_eArgError, "argument must be a Nokogiri::XML::SAX::Parser");
|
||||
}
|
||||
|
||||
ctxt = noko_xml_sax_parser_context_unwrap(rb_context);
|
||||
sax = noko_xml_sax_parser_unwrap(rb_sax_parser);
|
||||
|
||||
ctxt->sax = sax;
|
||||
ctxt->userData = ctxt; /* so we can use libxml2/SAX2.c handlers if we want to */
|
||||
ctxt->_private = (void *)rb_sax_parser;
|
||||
|
||||
xmlSetStructuredErrorFunc(NULL, NULL);
|
||||
|
||||
/* although we're calling back into Ruby here, we don't need to worry about exceptions, because we
|
||||
* don't have any cleanup to do. The only memory we need to free is handled by
|
||||
* xml_sax_parser_context_type_free */
|
||||
htmlParseDocument(ctxt);
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
void
|
||||
noko_init_html_sax_parser_context(void)
|
||||
{
|
||||
assert(cNokogiriXmlSaxParserContext);
|
||||
cNokogiriHtml4SaxParserContext = rb_define_class_under(mNokogiriHtml4Sax, "ParserContext",
|
||||
cNokogiriXmlSaxParserContext);
|
||||
|
||||
rb_define_singleton_method(cNokogiriHtml4SaxParserContext, "native_memory",
|
||||
noko_html4_sax_parser_context_s_native_memory, 2);
|
||||
rb_define_singleton_method(cNokogiriHtml4SaxParserContext, "native_file",
|
||||
noko_html4_sax_parser_context_s_native_file, 2);
|
||||
|
||||
rb_define_method(cNokogiriHtml4SaxParserContext, "parse_with",
|
||||
noko_html4_sax_parser_context__parse_with, 1);
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
#include <nokogiri.h>
|
||||
|
||||
VALUE cNokogiriHtml4SaxPushParser;
|
||||
|
||||
/*
|
||||
* Write +chunk+ to PushParser. +last_chunk+ triggers the end_document handle
|
||||
*/
|
||||
static VALUE
|
||||
noko_html4_sax_push_parser__native_write(VALUE self, VALUE rb_chunk, VALUE rb_last_chunk)
|
||||
{
|
||||
xmlParserCtxtPtr ctx;
|
||||
const char *chunk = NULL;
|
||||
int size = 0;
|
||||
int status = 0;
|
||||
libxmlStructuredErrorHandlerState handler_state;
|
||||
|
||||
ctx = noko_xml_sax_push_parser_unwrap(self);
|
||||
|
||||
if (Qnil != rb_chunk) {
|
||||
chunk = StringValuePtr(rb_chunk);
|
||||
size = (int)RSTRING_LEN(rb_chunk);
|
||||
}
|
||||
|
||||
noko__structured_error_func_save_and_set(&handler_state, NULL, NULL);
|
||||
|
||||
status = htmlParseChunk(ctx, chunk, size, Qtrue == rb_last_chunk ? 1 : 0);
|
||||
|
||||
noko__structured_error_func_restore(&handler_state);
|
||||
|
||||
if ((status != 0) && !(xmlCtxtGetOptions(ctx) & XML_PARSE_RECOVER)) {
|
||||
// TODO: there appear to be no tests for this block
|
||||
xmlErrorConstPtr e = xmlCtxtGetLastError(ctx);
|
||||
noko__error_raise(NULL, e);
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize the push parser with +xml_sax+ using +filename+
|
||||
*/
|
||||
static VALUE
|
||||
noko_html4_sax_push_parser__initialize_native(
|
||||
VALUE self,
|
||||
VALUE rb_xml_sax,
|
||||
VALUE rb_filename,
|
||||
VALUE encoding
|
||||
)
|
||||
{
|
||||
htmlSAXHandlerPtr sax;
|
||||
const char *filename = NULL;
|
||||
htmlParserCtxtPtr ctx;
|
||||
xmlCharEncoding enc = XML_CHAR_ENCODING_NONE;
|
||||
|
||||
sax = noko_xml_sax_parser_unwrap(rb_xml_sax);
|
||||
|
||||
if (rb_filename != Qnil) { filename = StringValueCStr(rb_filename); }
|
||||
|
||||
if (!NIL_P(encoding)) {
|
||||
enc = xmlParseCharEncoding(StringValueCStr(encoding));
|
||||
if (enc == XML_CHAR_ENCODING_ERROR) {
|
||||
rb_raise(rb_eArgError, "Unsupported Encoding");
|
||||
}
|
||||
}
|
||||
|
||||
ctx = htmlCreatePushParserCtxt(
|
||||
sax,
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
filename,
|
||||
enc
|
||||
);
|
||||
if (ctx == NULL) {
|
||||
rb_raise(rb_eRuntimeError, "Could not create a parser context");
|
||||
}
|
||||
|
||||
ctx->userData = ctx;
|
||||
ctx->_private = (void *)rb_xml_sax;
|
||||
|
||||
DATA_PTR(self) = ctx;
|
||||
return self;
|
||||
}
|
||||
|
||||
void
|
||||
noko_init_html_sax_push_parser(void)
|
||||
{
|
||||
assert(cNokogiriXmlSaxPushParser);
|
||||
cNokogiriHtml4SaxPushParser =
|
||||
rb_define_class_under(mNokogiriHtml4Sax, "PushParser", cNokogiriXmlSaxPushParser);
|
||||
|
||||
rb_define_private_method(cNokogiriHtml4SaxPushParser, "initialize_native",
|
||||
noko_html4_sax_push_parser__initialize_native, 3);
|
||||
rb_define_private_method(cNokogiriHtml4SaxPushParser, "native_write",
|
||||
noko_html4_sax_push_parser__native_write, 2);
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Summary: main header file
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __EXSLT_H__
|
||||
#define __EXSLT_H__
|
||||
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/xpath.h>
|
||||
#include "exsltexports.h"
|
||||
#include <libexslt/exsltconfig.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
EXSLTPUBVAR const char *exsltLibraryVersion;
|
||||
EXSLTPUBVAR const int exsltLibexsltVersion;
|
||||
EXSLTPUBVAR const int exsltLibxsltVersion;
|
||||
EXSLTPUBVAR const int exsltLibxmlVersion;
|
||||
|
||||
/**
|
||||
* EXSLT_COMMON_NAMESPACE:
|
||||
*
|
||||
* Namespace for EXSLT common functions
|
||||
*/
|
||||
#define EXSLT_COMMON_NAMESPACE ((const xmlChar *) "http://exslt.org/common")
|
||||
/**
|
||||
* EXSLT_CRYPTO_NAMESPACE:
|
||||
*
|
||||
* Namespace for EXSLT crypto functions
|
||||
*/
|
||||
#define EXSLT_CRYPTO_NAMESPACE ((const xmlChar *) "http://exslt.org/crypto")
|
||||
/**
|
||||
* EXSLT_MATH_NAMESPACE:
|
||||
*
|
||||
* Namespace for EXSLT math functions
|
||||
*/
|
||||
#define EXSLT_MATH_NAMESPACE ((const xmlChar *) "http://exslt.org/math")
|
||||
/**
|
||||
* EXSLT_SETS_NAMESPACE:
|
||||
*
|
||||
* Namespace for EXSLT set functions
|
||||
*/
|
||||
#define EXSLT_SETS_NAMESPACE ((const xmlChar *) "http://exslt.org/sets")
|
||||
/**
|
||||
* EXSLT_FUNCTIONS_NAMESPACE:
|
||||
*
|
||||
* Namespace for EXSLT functions extension functions
|
||||
*/
|
||||
#define EXSLT_FUNCTIONS_NAMESPACE ((const xmlChar *) "http://exslt.org/functions")
|
||||
/**
|
||||
* EXSLT_STRINGS_NAMESPACE:
|
||||
*
|
||||
* Namespace for EXSLT strings functions
|
||||
*/
|
||||
#define EXSLT_STRINGS_NAMESPACE ((const xmlChar *) "http://exslt.org/strings")
|
||||
/**
|
||||
* EXSLT_DATE_NAMESPACE:
|
||||
*
|
||||
* Namespace for EXSLT date functions
|
||||
*/
|
||||
#define EXSLT_DATE_NAMESPACE ((const xmlChar *) "http://exslt.org/dates-and-times")
|
||||
/**
|
||||
* EXSLT_DYNAMIC_NAMESPACE:
|
||||
*
|
||||
* Namespace for EXSLT dynamic functions
|
||||
*/
|
||||
#define EXSLT_DYNAMIC_NAMESPACE ((const xmlChar *) "http://exslt.org/dynamic")
|
||||
|
||||
/**
|
||||
* SAXON_NAMESPACE:
|
||||
*
|
||||
* Namespace for SAXON extensions functions
|
||||
*/
|
||||
#define SAXON_NAMESPACE ((const xmlChar *) "http://icl.com/saxon")
|
||||
|
||||
EXSLTPUBFUN void EXSLTCALL exsltCommonRegister (void);
|
||||
#ifdef EXSLT_CRYPTO_ENABLED
|
||||
EXSLTPUBFUN void EXSLTCALL exsltCryptoRegister (void);
|
||||
#endif
|
||||
EXSLTPUBFUN void EXSLTCALL exsltMathRegister (void);
|
||||
EXSLTPUBFUN void EXSLTCALL exsltSetsRegister (void);
|
||||
EXSLTPUBFUN void EXSLTCALL exsltFuncRegister (void);
|
||||
EXSLTPUBFUN void EXSLTCALL exsltStrRegister (void);
|
||||
EXSLTPUBFUN void EXSLTCALL exsltDateRegister (void);
|
||||
EXSLTPUBFUN void EXSLTCALL exsltSaxonRegister (void);
|
||||
EXSLTPUBFUN void EXSLTCALL exsltDynRegister(void);
|
||||
|
||||
EXSLTPUBFUN void EXSLTCALL exsltRegisterAll (void);
|
||||
|
||||
EXSLTPUBFUN int EXSLTCALL exsltDateXpathCtxtRegister (xmlXPathContextPtr ctxt,
|
||||
const xmlChar *prefix);
|
||||
EXSLTPUBFUN int EXSLTCALL exsltMathXpathCtxtRegister (xmlXPathContextPtr ctxt,
|
||||
const xmlChar *prefix);
|
||||
EXSLTPUBFUN int EXSLTCALL exsltSetsXpathCtxtRegister (xmlXPathContextPtr ctxt,
|
||||
const xmlChar *prefix);
|
||||
EXSLTPUBFUN int EXSLTCALL exsltStrXpathCtxtRegister (xmlXPathContextPtr ctxt,
|
||||
const xmlChar *prefix);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __EXSLT_H__ */
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* exsltconfig.h: compile-time version information for the EXSLT library
|
||||
*
|
||||
* See Copyright for the status of this software.
|
||||
*
|
||||
* daniel@veillard.com
|
||||
*/
|
||||
|
||||
#ifndef __XML_EXSLTCONFIG_H__
|
||||
#define __XML_EXSLTCONFIG_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBEXSLT_DOTTED_VERSION:
|
||||
*
|
||||
* the version string like "1.2.3"
|
||||
*/
|
||||
#define LIBEXSLT_DOTTED_VERSION "0.8.23"
|
||||
|
||||
/**
|
||||
* LIBEXSLT_VERSION:
|
||||
*
|
||||
* the version number: 1.2.3 value is 10203
|
||||
*/
|
||||
#define LIBEXSLT_VERSION 823
|
||||
|
||||
/**
|
||||
* LIBEXSLT_VERSION_STRING:
|
||||
*
|
||||
* the version number string, 1.2.3 value is "10203"
|
||||
*/
|
||||
#define LIBEXSLT_VERSION_STRING "823"
|
||||
|
||||
/**
|
||||
* LIBEXSLT_VERSION_EXTRA:
|
||||
*
|
||||
* extra version information, used to show a Git commit description
|
||||
*/
|
||||
#define LIBEXSLT_VERSION_EXTRA ""
|
||||
|
||||
/**
|
||||
* WITH_CRYPTO:
|
||||
*
|
||||
* Whether crypto support is configured into exslt
|
||||
*/
|
||||
#if 0
|
||||
#define EXSLT_CRYPTO_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ATTRIBUTE_UNUSED:
|
||||
*
|
||||
* This macro is used to flag unused function parameters to GCC
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
#ifndef ATTRIBUTE_UNUSED
|
||||
#define ATTRIBUTE_UNUSED __attribute__((unused))
|
||||
#endif
|
||||
#else
|
||||
#define ATTRIBUTE_UNUSED
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XML_EXSLTCONFIG_H__ */
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Summary: macros for marking symbols as exportable/importable.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*/
|
||||
|
||||
#ifndef __EXSLT_EXPORTS_H__
|
||||
#define __EXSLT_EXPORTS_H__
|
||||
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
/** DOC_DISABLE */
|
||||
|
||||
#ifdef LIBEXSLT_STATIC
|
||||
#define EXSLTPUBLIC
|
||||
#elif defined(IN_LIBEXSLT)
|
||||
#define EXSLTPUBLIC __declspec(dllexport)
|
||||
#else
|
||||
#define EXSLTPUBLIC __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#define EXSLTCALL __cdecl
|
||||
|
||||
/** DOC_ENABLE */
|
||||
#else /* not Windows */
|
||||
|
||||
/**
|
||||
* EXSLTPUBLIC:
|
||||
*
|
||||
* Macro which declares a public symbol
|
||||
*/
|
||||
#define EXSLTPUBLIC
|
||||
|
||||
/**
|
||||
* EXSLTCALL:
|
||||
*
|
||||
* Macro which declares the calling convention for exported functions
|
||||
*/
|
||||
#define EXSLTCALL
|
||||
|
||||
#endif /* platform switch */
|
||||
|
||||
/*
|
||||
* EXSLTPUBFUN:
|
||||
*
|
||||
* Macro which declares an exportable function
|
||||
*/
|
||||
#define EXSLTPUBFUN EXSLTPUBLIC
|
||||
|
||||
/**
|
||||
* EXSLTPUBVAR:
|
||||
*
|
||||
* Macro which declares an exportable variable
|
||||
*/
|
||||
#define EXSLTPUBVAR EXSLTPUBLIC extern
|
||||
|
||||
/* Compatibility */
|
||||
#if !defined(LIBEXSLT_PUBLIC)
|
||||
#define LIBEXSLT_PUBLIC EXSLTPUBVAR
|
||||
#endif
|
||||
|
||||
#endif /* __EXSLT_EXPORTS_H__ */
|
||||
|
||||
|
||||
+336
@@ -0,0 +1,336 @@
|
||||
/*
|
||||
* Summary: interface for an HTML 4.0 non-verifying parser
|
||||
* Description: this module implements an HTML 4.0 non-verifying parser
|
||||
* with API compatible with the XML parser ones. It should
|
||||
* be able to parse "real world" HTML, even if severely
|
||||
* broken from a specification point of view.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __HTML_PARSER_H__
|
||||
#define __HTML_PARSER_H__
|
||||
#include <libxml/xmlversion.h>
|
||||
#include <libxml/parser.h>
|
||||
|
||||
#ifdef LIBXML_HTML_ENABLED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Most of the back-end structures from XML and HTML are shared.
|
||||
*/
|
||||
typedef xmlParserCtxt htmlParserCtxt;
|
||||
typedef xmlParserCtxtPtr htmlParserCtxtPtr;
|
||||
typedef xmlParserNodeInfo htmlParserNodeInfo;
|
||||
typedef xmlSAXHandler htmlSAXHandler;
|
||||
typedef xmlSAXHandlerPtr htmlSAXHandlerPtr;
|
||||
typedef xmlParserInput htmlParserInput;
|
||||
typedef xmlParserInputPtr htmlParserInputPtr;
|
||||
typedef xmlDocPtr htmlDocPtr;
|
||||
typedef xmlNodePtr htmlNodePtr;
|
||||
|
||||
/*
|
||||
* Internal description of an HTML element, representing HTML 4.01
|
||||
* and XHTML 1.0 (which share the same structure).
|
||||
*/
|
||||
typedef struct _htmlElemDesc htmlElemDesc;
|
||||
typedef htmlElemDesc *htmlElemDescPtr;
|
||||
struct _htmlElemDesc {
|
||||
const char *name; /* The tag name */
|
||||
char startTag; /* Whether the start tag can be implied */
|
||||
char endTag; /* Whether the end tag can be implied */
|
||||
char saveEndTag; /* Whether the end tag should be saved */
|
||||
char empty; /* Is this an empty element ? */
|
||||
char depr; /* Is this a deprecated element ? */
|
||||
char dtd; /* 1: only in Loose DTD, 2: only Frameset one */
|
||||
char isinline; /* is this a block 0 or inline 1 element */
|
||||
const char *desc; /* the description */
|
||||
|
||||
/* NRK Jan.2003
|
||||
* New fields encapsulating HTML structure
|
||||
*
|
||||
* Bugs:
|
||||
* This is a very limited representation. It fails to tell us when
|
||||
* an element *requires* subelements (we only have whether they're
|
||||
* allowed or not), and it doesn't tell us where CDATA and PCDATA
|
||||
* are allowed. Some element relationships are not fully represented:
|
||||
* these are flagged with the word MODIFIER
|
||||
*/
|
||||
const char** subelts; /* allowed sub-elements of this element */
|
||||
const char* defaultsubelt; /* subelement for suggested auto-repair
|
||||
if necessary or NULL */
|
||||
const char** attrs_opt; /* Optional Attributes */
|
||||
const char** attrs_depr; /* Additional deprecated attributes */
|
||||
const char** attrs_req; /* Required attributes */
|
||||
};
|
||||
|
||||
/*
|
||||
* Internal description of an HTML entity.
|
||||
*/
|
||||
typedef struct _htmlEntityDesc htmlEntityDesc;
|
||||
typedef htmlEntityDesc *htmlEntityDescPtr;
|
||||
struct _htmlEntityDesc {
|
||||
unsigned int value; /* the UNICODE value for the character */
|
||||
const char *name; /* The entity name */
|
||||
const char *desc; /* the description */
|
||||
};
|
||||
|
||||
#ifdef LIBXML_SAX1_ENABLED
|
||||
|
||||
XML_DEPRECATED
|
||||
XMLPUBVAR const xmlSAXHandlerV1 htmlDefaultSAXHandler;
|
||||
|
||||
#ifdef LIBXML_THREAD_ENABLED
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN const xmlSAXHandlerV1 *__htmlDefaultSAXHandler(void);
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_SAX1_ENABLED */
|
||||
|
||||
/*
|
||||
* There is only few public functions.
|
||||
*/
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
htmlInitAutoClose (void);
|
||||
XMLPUBFUN const htmlElemDesc *
|
||||
htmlTagLookup (const xmlChar *tag);
|
||||
XMLPUBFUN const htmlEntityDesc *
|
||||
htmlEntityLookup(const xmlChar *name);
|
||||
XMLPUBFUN const htmlEntityDesc *
|
||||
htmlEntityValueLookup(unsigned int value);
|
||||
|
||||
XMLPUBFUN int
|
||||
htmlIsAutoClosed(htmlDocPtr doc,
|
||||
htmlNodePtr elem);
|
||||
XMLPUBFUN int
|
||||
htmlAutoCloseTag(htmlDocPtr doc,
|
||||
const xmlChar *name,
|
||||
htmlNodePtr elem);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN const htmlEntityDesc *
|
||||
htmlParseEntityRef(htmlParserCtxtPtr ctxt,
|
||||
const xmlChar **str);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
htmlParseCharRef(htmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
htmlParseElement(htmlParserCtxtPtr ctxt);
|
||||
|
||||
XMLPUBFUN htmlParserCtxtPtr
|
||||
htmlNewParserCtxt(void);
|
||||
XMLPUBFUN htmlParserCtxtPtr
|
||||
htmlNewSAXParserCtxt(const htmlSAXHandler *sax,
|
||||
void *userData);
|
||||
|
||||
XMLPUBFUN htmlParserCtxtPtr
|
||||
htmlCreateMemoryParserCtxt(const char *buffer,
|
||||
int size);
|
||||
|
||||
XMLPUBFUN int
|
||||
htmlParseDocument(htmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN htmlDocPtr
|
||||
htmlSAXParseDoc (const xmlChar *cur,
|
||||
const char *encoding,
|
||||
htmlSAXHandlerPtr sax,
|
||||
void *userData);
|
||||
XMLPUBFUN htmlDocPtr
|
||||
htmlParseDoc (const xmlChar *cur,
|
||||
const char *encoding);
|
||||
XMLPUBFUN htmlParserCtxtPtr
|
||||
htmlCreateFileParserCtxt(const char *filename,
|
||||
const char *encoding);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN htmlDocPtr
|
||||
htmlSAXParseFile(const char *filename,
|
||||
const char *encoding,
|
||||
htmlSAXHandlerPtr sax,
|
||||
void *userData);
|
||||
XMLPUBFUN htmlDocPtr
|
||||
htmlParseFile (const char *filename,
|
||||
const char *encoding);
|
||||
XMLPUBFUN int
|
||||
UTF8ToHtml (unsigned char *out,
|
||||
int *outlen,
|
||||
const unsigned char *in,
|
||||
int *inlen);
|
||||
XMLPUBFUN int
|
||||
htmlEncodeEntities(unsigned char *out,
|
||||
int *outlen,
|
||||
const unsigned char *in,
|
||||
int *inlen, int quoteChar);
|
||||
XMLPUBFUN int
|
||||
htmlIsScriptAttribute(const xmlChar *name);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
htmlHandleOmittedElem(int val);
|
||||
|
||||
#ifdef LIBXML_PUSH_ENABLED
|
||||
/**
|
||||
* Interfaces for the Push mode.
|
||||
*/
|
||||
XMLPUBFUN htmlParserCtxtPtr
|
||||
htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax,
|
||||
void *user_data,
|
||||
const char *chunk,
|
||||
int size,
|
||||
const char *filename,
|
||||
xmlCharEncoding enc);
|
||||
XMLPUBFUN int
|
||||
htmlParseChunk (htmlParserCtxtPtr ctxt,
|
||||
const char *chunk,
|
||||
int size,
|
||||
int terminate);
|
||||
#endif /* LIBXML_PUSH_ENABLED */
|
||||
|
||||
XMLPUBFUN void
|
||||
htmlFreeParserCtxt (htmlParserCtxtPtr ctxt);
|
||||
|
||||
/*
|
||||
* New set of simpler/more flexible APIs
|
||||
*/
|
||||
/**
|
||||
* xmlParserOption:
|
||||
*
|
||||
* This is the set of XML parser options that can be passed down
|
||||
* to the xmlReadDoc() and similar calls.
|
||||
*/
|
||||
typedef enum {
|
||||
HTML_PARSE_RECOVER = 1<<0, /* Relaxed parsing */
|
||||
HTML_PARSE_NODEFDTD = 1<<2, /* do not default a doctype if not found */
|
||||
HTML_PARSE_NOERROR = 1<<5, /* suppress error reports */
|
||||
HTML_PARSE_NOWARNING= 1<<6, /* suppress warning reports */
|
||||
HTML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */
|
||||
HTML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */
|
||||
HTML_PARSE_NONET = 1<<11,/* Forbid network access */
|
||||
HTML_PARSE_NOIMPLIED= 1<<13,/* Do not add implied html/body... elements */
|
||||
HTML_PARSE_COMPACT = 1<<16,/* compact small text nodes */
|
||||
HTML_PARSE_IGNORE_ENC=1<<21 /* ignore internal document encoding hint */
|
||||
} htmlParserOption;
|
||||
|
||||
XMLPUBFUN void
|
||||
htmlCtxtReset (htmlParserCtxtPtr ctxt);
|
||||
XMLPUBFUN int
|
||||
htmlCtxtUseOptions (htmlParserCtxtPtr ctxt,
|
||||
int options);
|
||||
XMLPUBFUN htmlDocPtr
|
||||
htmlReadDoc (const xmlChar *cur,
|
||||
const char *URL,
|
||||
const char *encoding,
|
||||
int options);
|
||||
XMLPUBFUN htmlDocPtr
|
||||
htmlReadFile (const char *URL,
|
||||
const char *encoding,
|
||||
int options);
|
||||
XMLPUBFUN htmlDocPtr
|
||||
htmlReadMemory (const char *buffer,
|
||||
int size,
|
||||
const char *URL,
|
||||
const char *encoding,
|
||||
int options);
|
||||
XMLPUBFUN htmlDocPtr
|
||||
htmlReadFd (int fd,
|
||||
const char *URL,
|
||||
const char *encoding,
|
||||
int options);
|
||||
XMLPUBFUN htmlDocPtr
|
||||
htmlReadIO (xmlInputReadCallback ioread,
|
||||
xmlInputCloseCallback ioclose,
|
||||
void *ioctx,
|
||||
const char *URL,
|
||||
const char *encoding,
|
||||
int options);
|
||||
XMLPUBFUN htmlDocPtr
|
||||
htmlCtxtParseDocument (htmlParserCtxtPtr ctxt,
|
||||
xmlParserInputPtr input);
|
||||
XMLPUBFUN htmlDocPtr
|
||||
htmlCtxtReadDoc (xmlParserCtxtPtr ctxt,
|
||||
const xmlChar *cur,
|
||||
const char *URL,
|
||||
const char *encoding,
|
||||
int options);
|
||||
XMLPUBFUN htmlDocPtr
|
||||
htmlCtxtReadFile (xmlParserCtxtPtr ctxt,
|
||||
const char *filename,
|
||||
const char *encoding,
|
||||
int options);
|
||||
XMLPUBFUN htmlDocPtr
|
||||
htmlCtxtReadMemory (xmlParserCtxtPtr ctxt,
|
||||
const char *buffer,
|
||||
int size,
|
||||
const char *URL,
|
||||
const char *encoding,
|
||||
int options);
|
||||
XMLPUBFUN htmlDocPtr
|
||||
htmlCtxtReadFd (xmlParserCtxtPtr ctxt,
|
||||
int fd,
|
||||
const char *URL,
|
||||
const char *encoding,
|
||||
int options);
|
||||
XMLPUBFUN htmlDocPtr
|
||||
htmlCtxtReadIO (xmlParserCtxtPtr ctxt,
|
||||
xmlInputReadCallback ioread,
|
||||
xmlInputCloseCallback ioclose,
|
||||
void *ioctx,
|
||||
const char *URL,
|
||||
const char *encoding,
|
||||
int options);
|
||||
|
||||
/* NRK/Jan2003: further knowledge of HTML structure
|
||||
*/
|
||||
typedef enum {
|
||||
HTML_NA = 0 , /* something we don't check at all */
|
||||
HTML_INVALID = 0x1 ,
|
||||
HTML_DEPRECATED = 0x2 ,
|
||||
HTML_VALID = 0x4 ,
|
||||
HTML_REQUIRED = 0xc /* VALID bit set so ( & HTML_VALID ) is TRUE */
|
||||
} htmlStatus ;
|
||||
|
||||
/* Using htmlElemDesc rather than name here, to emphasise the fact
|
||||
that otherwise there's a lookup overhead
|
||||
*/
|
||||
XMLPUBFUN htmlStatus htmlAttrAllowed(const htmlElemDesc*, const xmlChar*, int) ;
|
||||
XMLPUBFUN int htmlElementAllowedHere(const htmlElemDesc*, const xmlChar*) ;
|
||||
XMLPUBFUN htmlStatus htmlElementStatusHere(const htmlElemDesc*, const htmlElemDesc*) ;
|
||||
XMLPUBFUN htmlStatus htmlNodeStatus(htmlNodePtr, int) ;
|
||||
/**
|
||||
* htmlDefaultSubelement:
|
||||
* @elt: HTML element
|
||||
*
|
||||
* Returns the default subelement for this element
|
||||
*/
|
||||
#define htmlDefaultSubelement(elt) elt->defaultsubelt
|
||||
/**
|
||||
* htmlElementAllowedHereDesc:
|
||||
* @parent: HTML parent element
|
||||
* @elt: HTML element
|
||||
*
|
||||
* Checks whether an HTML element description may be a
|
||||
* direct child of the specified element.
|
||||
*
|
||||
* Returns 1 if allowed; 0 otherwise.
|
||||
*/
|
||||
#define htmlElementAllowedHereDesc(parent,elt) \
|
||||
htmlElementAllowedHere((parent), (elt)->name)
|
||||
/**
|
||||
* htmlRequiredAttrs:
|
||||
* @elt: HTML element
|
||||
*
|
||||
* Returns the attributes required for the specified element.
|
||||
*/
|
||||
#define htmlRequiredAttrs(elt) (elt)->attrs_req
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_HTML_ENABLED */
|
||||
#endif /* __HTML_PARSER_H__ */
|
||||
+147
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* Summary: specific APIs to process HTML tree, especially serialization
|
||||
* Description: this module implements a few function needed to process
|
||||
* tree in an HTML specific way.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __HTML_TREE_H__
|
||||
#define __HTML_TREE_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <libxml/xmlversion.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/HTMLparser.h>
|
||||
|
||||
#ifdef LIBXML_HTML_ENABLED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* HTML_TEXT_NODE:
|
||||
*
|
||||
* Macro. A text node in a HTML document is really implemented
|
||||
* the same way as a text node in an XML document.
|
||||
*/
|
||||
#define HTML_TEXT_NODE XML_TEXT_NODE
|
||||
/**
|
||||
* HTML_ENTITY_REF_NODE:
|
||||
*
|
||||
* Macro. An entity reference in a HTML document is really implemented
|
||||
* the same way as an entity reference in an XML document.
|
||||
*/
|
||||
#define HTML_ENTITY_REF_NODE XML_ENTITY_REF_NODE
|
||||
/**
|
||||
* HTML_COMMENT_NODE:
|
||||
*
|
||||
* Macro. A comment in a HTML document is really implemented
|
||||
* the same way as a comment in an XML document.
|
||||
*/
|
||||
#define HTML_COMMENT_NODE XML_COMMENT_NODE
|
||||
/**
|
||||
* HTML_PRESERVE_NODE:
|
||||
*
|
||||
* Macro. A preserved node in a HTML document is really implemented
|
||||
* the same way as a CDATA section in an XML document.
|
||||
*/
|
||||
#define HTML_PRESERVE_NODE XML_CDATA_SECTION_NODE
|
||||
/**
|
||||
* HTML_PI_NODE:
|
||||
*
|
||||
* Macro. A processing instruction in a HTML document is really implemented
|
||||
* the same way as a processing instruction in an XML document.
|
||||
*/
|
||||
#define HTML_PI_NODE XML_PI_NODE
|
||||
|
||||
XMLPUBFUN htmlDocPtr
|
||||
htmlNewDoc (const xmlChar *URI,
|
||||
const xmlChar *ExternalID);
|
||||
XMLPUBFUN htmlDocPtr
|
||||
htmlNewDocNoDtD (const xmlChar *URI,
|
||||
const xmlChar *ExternalID);
|
||||
XMLPUBFUN const xmlChar *
|
||||
htmlGetMetaEncoding (htmlDocPtr doc);
|
||||
XMLPUBFUN int
|
||||
htmlSetMetaEncoding (htmlDocPtr doc,
|
||||
const xmlChar *encoding);
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
XMLPUBFUN void
|
||||
htmlDocDumpMemory (xmlDocPtr cur,
|
||||
xmlChar **mem,
|
||||
int *size);
|
||||
XMLPUBFUN void
|
||||
htmlDocDumpMemoryFormat (xmlDocPtr cur,
|
||||
xmlChar **mem,
|
||||
int *size,
|
||||
int format);
|
||||
XMLPUBFUN int
|
||||
htmlDocDump (FILE *f,
|
||||
xmlDocPtr cur);
|
||||
XMLPUBFUN int
|
||||
htmlSaveFile (const char *filename,
|
||||
xmlDocPtr cur);
|
||||
XMLPUBFUN int
|
||||
htmlNodeDump (xmlBufferPtr buf,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr cur);
|
||||
XMLPUBFUN void
|
||||
htmlNodeDumpFile (FILE *out,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr cur);
|
||||
XMLPUBFUN int
|
||||
htmlNodeDumpFileFormat (FILE *out,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr cur,
|
||||
const char *encoding,
|
||||
int format);
|
||||
XMLPUBFUN int
|
||||
htmlSaveFileEnc (const char *filename,
|
||||
xmlDocPtr cur,
|
||||
const char *encoding);
|
||||
XMLPUBFUN int
|
||||
htmlSaveFileFormat (const char *filename,
|
||||
xmlDocPtr cur,
|
||||
const char *encoding,
|
||||
int format);
|
||||
|
||||
XMLPUBFUN void
|
||||
htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr cur,
|
||||
const char *encoding,
|
||||
int format);
|
||||
XMLPUBFUN void
|
||||
htmlDocContentDumpOutput(xmlOutputBufferPtr buf,
|
||||
xmlDocPtr cur,
|
||||
const char *encoding);
|
||||
XMLPUBFUN void
|
||||
htmlDocContentDumpFormatOutput(xmlOutputBufferPtr buf,
|
||||
xmlDocPtr cur,
|
||||
const char *encoding,
|
||||
int format);
|
||||
XMLPUBFUN void
|
||||
htmlNodeDumpOutput (xmlOutputBufferPtr buf,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr cur,
|
||||
const char *encoding);
|
||||
|
||||
#endif /* LIBXML_OUTPUT_ENABLED */
|
||||
|
||||
XMLPUBFUN int
|
||||
htmlIsBooleanAttr (const xmlChar *name);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_HTML_ENABLED */
|
||||
|
||||
#endif /* __HTML_TREE_H__ */
|
||||
|
||||
@@ -0,0 +1,202 @@
|
||||
/*
|
||||
* Summary: Old SAX version 1 handler, deprecated
|
||||
* Description: DEPRECATED set of SAX version 1 interfaces used to
|
||||
* build the DOM tree.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __XML_SAX_H__
|
||||
#define __XML_SAX_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
#include <libxml/parser.h>
|
||||
|
||||
#ifdef LIBXML_LEGACY_ENABLED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN const xmlChar *
|
||||
getPublicId (void *ctx);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN const xmlChar *
|
||||
getSystemId (void *ctx);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
setDocumentLocator (void *ctx,
|
||||
xmlSAXLocatorPtr loc);
|
||||
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
getLineNumber (void *ctx);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
getColumnNumber (void *ctx);
|
||||
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
isStandalone (void *ctx);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
hasInternalSubset (void *ctx);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
hasExternalSubset (void *ctx);
|
||||
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
internalSubset (void *ctx,
|
||||
const xmlChar *name,
|
||||
const xmlChar *ExternalID,
|
||||
const xmlChar *SystemID);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
externalSubset (void *ctx,
|
||||
const xmlChar *name,
|
||||
const xmlChar *ExternalID,
|
||||
const xmlChar *SystemID);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlEntityPtr
|
||||
getEntity (void *ctx,
|
||||
const xmlChar *name);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlEntityPtr
|
||||
getParameterEntity (void *ctx,
|
||||
const xmlChar *name);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlParserInputPtr
|
||||
resolveEntity (void *ctx,
|
||||
const xmlChar *publicId,
|
||||
const xmlChar *systemId);
|
||||
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
entityDecl (void *ctx,
|
||||
const xmlChar *name,
|
||||
int type,
|
||||
const xmlChar *publicId,
|
||||
const xmlChar *systemId,
|
||||
xmlChar *content);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
attributeDecl (void *ctx,
|
||||
const xmlChar *elem,
|
||||
const xmlChar *fullname,
|
||||
int type,
|
||||
int def,
|
||||
const xmlChar *defaultValue,
|
||||
xmlEnumerationPtr tree);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
elementDecl (void *ctx,
|
||||
const xmlChar *name,
|
||||
int type,
|
||||
xmlElementContentPtr content);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
notationDecl (void *ctx,
|
||||
const xmlChar *name,
|
||||
const xmlChar *publicId,
|
||||
const xmlChar *systemId);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
unparsedEntityDecl (void *ctx,
|
||||
const xmlChar *name,
|
||||
const xmlChar *publicId,
|
||||
const xmlChar *systemId,
|
||||
const xmlChar *notationName);
|
||||
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
startDocument (void *ctx);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
endDocument (void *ctx);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
attribute (void *ctx,
|
||||
const xmlChar *fullname,
|
||||
const xmlChar *value);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
startElement (void *ctx,
|
||||
const xmlChar *fullname,
|
||||
const xmlChar **atts);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
endElement (void *ctx,
|
||||
const xmlChar *name);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
reference (void *ctx,
|
||||
const xmlChar *name);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
characters (void *ctx,
|
||||
const xmlChar *ch,
|
||||
int len);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
ignorableWhitespace (void *ctx,
|
||||
const xmlChar *ch,
|
||||
int len);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
processingInstruction (void *ctx,
|
||||
const xmlChar *target,
|
||||
const xmlChar *data);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
globalNamespace (void *ctx,
|
||||
const xmlChar *href,
|
||||
const xmlChar *prefix);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
setNamespace (void *ctx,
|
||||
const xmlChar *name);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlNsPtr
|
||||
getNamespace (void *ctx);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
checkNamespace (void *ctx,
|
||||
xmlChar *nameSpace);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
namespaceDecl (void *ctx,
|
||||
const xmlChar *href,
|
||||
const xmlChar *prefix);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
comment (void *ctx,
|
||||
const xmlChar *value);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
cdataBlock (void *ctx,
|
||||
const xmlChar *value,
|
||||
int len);
|
||||
|
||||
#ifdef LIBXML_SAX1_ENABLED
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
initxmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr,
|
||||
int warning);
|
||||
#ifdef LIBXML_HTML_ENABLED
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
inithtmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr);
|
||||
#endif
|
||||
#endif /* LIBXML_SAX1_ENABLED */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_LEGACY_ENABLED */
|
||||
|
||||
#endif /* __XML_SAX_H__ */
|
||||
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* Summary: SAX2 parser interface used to build the DOM tree
|
||||
* Description: those are the default SAX2 interfaces used by
|
||||
* the library when building DOM tree.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __XML_SAX2_H__
|
||||
#define __XML_SAX2_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
#include <libxml/parser.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlSAX2GetPublicId (void *ctx);
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlSAX2GetSystemId (void *ctx);
|
||||
XMLPUBFUN void
|
||||
xmlSAX2SetDocumentLocator (void *ctx,
|
||||
xmlSAXLocatorPtr loc);
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlSAX2GetLineNumber (void *ctx);
|
||||
XMLPUBFUN int
|
||||
xmlSAX2GetColumnNumber (void *ctx);
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlSAX2IsStandalone (void *ctx);
|
||||
XMLPUBFUN int
|
||||
xmlSAX2HasInternalSubset (void *ctx);
|
||||
XMLPUBFUN int
|
||||
xmlSAX2HasExternalSubset (void *ctx);
|
||||
|
||||
XMLPUBFUN void
|
||||
xmlSAX2InternalSubset (void *ctx,
|
||||
const xmlChar *name,
|
||||
const xmlChar *ExternalID,
|
||||
const xmlChar *SystemID);
|
||||
XMLPUBFUN void
|
||||
xmlSAX2ExternalSubset (void *ctx,
|
||||
const xmlChar *name,
|
||||
const xmlChar *ExternalID,
|
||||
const xmlChar *SystemID);
|
||||
XMLPUBFUN xmlEntityPtr
|
||||
xmlSAX2GetEntity (void *ctx,
|
||||
const xmlChar *name);
|
||||
XMLPUBFUN xmlEntityPtr
|
||||
xmlSAX2GetParameterEntity (void *ctx,
|
||||
const xmlChar *name);
|
||||
XMLPUBFUN xmlParserInputPtr
|
||||
xmlSAX2ResolveEntity (void *ctx,
|
||||
const xmlChar *publicId,
|
||||
const xmlChar *systemId);
|
||||
|
||||
XMLPUBFUN void
|
||||
xmlSAX2EntityDecl (void *ctx,
|
||||
const xmlChar *name,
|
||||
int type,
|
||||
const xmlChar *publicId,
|
||||
const xmlChar *systemId,
|
||||
xmlChar *content);
|
||||
XMLPUBFUN void
|
||||
xmlSAX2AttributeDecl (void *ctx,
|
||||
const xmlChar *elem,
|
||||
const xmlChar *fullname,
|
||||
int type,
|
||||
int def,
|
||||
const xmlChar *defaultValue,
|
||||
xmlEnumerationPtr tree);
|
||||
XMLPUBFUN void
|
||||
xmlSAX2ElementDecl (void *ctx,
|
||||
const xmlChar *name,
|
||||
int type,
|
||||
xmlElementContentPtr content);
|
||||
XMLPUBFUN void
|
||||
xmlSAX2NotationDecl (void *ctx,
|
||||
const xmlChar *name,
|
||||
const xmlChar *publicId,
|
||||
const xmlChar *systemId);
|
||||
XMLPUBFUN void
|
||||
xmlSAX2UnparsedEntityDecl (void *ctx,
|
||||
const xmlChar *name,
|
||||
const xmlChar *publicId,
|
||||
const xmlChar *systemId,
|
||||
const xmlChar *notationName);
|
||||
|
||||
XMLPUBFUN void
|
||||
xmlSAX2StartDocument (void *ctx);
|
||||
XMLPUBFUN void
|
||||
xmlSAX2EndDocument (void *ctx);
|
||||
#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || \
|
||||
defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_LEGACY_ENABLED)
|
||||
XMLPUBFUN void
|
||||
xmlSAX2StartElement (void *ctx,
|
||||
const xmlChar *fullname,
|
||||
const xmlChar **atts);
|
||||
XMLPUBFUN void
|
||||
xmlSAX2EndElement (void *ctx,
|
||||
const xmlChar *name);
|
||||
#endif /* LIBXML_SAX1_ENABLED or LIBXML_HTML_ENABLED or LIBXML_LEGACY_ENABLED */
|
||||
XMLPUBFUN void
|
||||
xmlSAX2StartElementNs (void *ctx,
|
||||
const xmlChar *localname,
|
||||
const xmlChar *prefix,
|
||||
const xmlChar *URI,
|
||||
int nb_namespaces,
|
||||
const xmlChar **namespaces,
|
||||
int nb_attributes,
|
||||
int nb_defaulted,
|
||||
const xmlChar **attributes);
|
||||
XMLPUBFUN void
|
||||
xmlSAX2EndElementNs (void *ctx,
|
||||
const xmlChar *localname,
|
||||
const xmlChar *prefix,
|
||||
const xmlChar *URI);
|
||||
XMLPUBFUN void
|
||||
xmlSAX2Reference (void *ctx,
|
||||
const xmlChar *name);
|
||||
XMLPUBFUN void
|
||||
xmlSAX2Characters (void *ctx,
|
||||
const xmlChar *ch,
|
||||
int len);
|
||||
XMLPUBFUN void
|
||||
xmlSAX2IgnorableWhitespace (void *ctx,
|
||||
const xmlChar *ch,
|
||||
int len);
|
||||
XMLPUBFUN void
|
||||
xmlSAX2ProcessingInstruction (void *ctx,
|
||||
const xmlChar *target,
|
||||
const xmlChar *data);
|
||||
XMLPUBFUN void
|
||||
xmlSAX2Comment (void *ctx,
|
||||
const xmlChar *value);
|
||||
XMLPUBFUN void
|
||||
xmlSAX2CDataBlock (void *ctx,
|
||||
const xmlChar *value,
|
||||
int len);
|
||||
|
||||
#ifdef LIBXML_SAX1_ENABLED
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlSAXDefaultVersion (int version);
|
||||
#endif /* LIBXML_SAX1_ENABLED */
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlSAXVersion (xmlSAXHandler *hdlr,
|
||||
int version);
|
||||
XMLPUBFUN void
|
||||
xmlSAX2InitDefaultSAXHandler (xmlSAXHandler *hdlr,
|
||||
int warning);
|
||||
#ifdef LIBXML_HTML_ENABLED
|
||||
XMLPUBFUN void
|
||||
xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
htmlDefaultSAXHandlerInit (void);
|
||||
#endif
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlDefaultSAXHandlerInit (void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __XML_SAX2_H__ */
|
||||
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* Summary: Provide Canonical XML and Exclusive XML Canonicalization
|
||||
* Description: the c14n modules provides a
|
||||
*
|
||||
* "Canonical XML" implementation
|
||||
* http://www.w3.org/TR/xml-c14n
|
||||
*
|
||||
* and an
|
||||
*
|
||||
* "Exclusive XML Canonicalization" implementation
|
||||
* http://www.w3.org/TR/xml-exc-c14n
|
||||
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Aleksey Sanin <aleksey@aleksey.com>
|
||||
*/
|
||||
#ifndef __XML_C14N_H__
|
||||
#define __XML_C14N_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#ifdef LIBXML_C14N_ENABLED
|
||||
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/xpath.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* XML Canonicalization
|
||||
* http://www.w3.org/TR/xml-c14n
|
||||
*
|
||||
* Exclusive XML Canonicalization
|
||||
* http://www.w3.org/TR/xml-exc-c14n
|
||||
*
|
||||
* Canonical form of an XML document could be created if and only if
|
||||
* a) default attributes (if any) are added to all nodes
|
||||
* b) all character and parsed entity references are resolved
|
||||
* In order to achieve this in libxml2 the document MUST be loaded with
|
||||
* following options: XML_PARSE_DTDATTR | XML_PARSE_NOENT
|
||||
*/
|
||||
|
||||
/*
|
||||
* xmlC14NMode:
|
||||
*
|
||||
* Predefined values for C14N modes
|
||||
*
|
||||
*/
|
||||
typedef enum {
|
||||
XML_C14N_1_0 = 0, /* Original C14N 1.0 spec */
|
||||
XML_C14N_EXCLUSIVE_1_0 = 1, /* Exclusive C14N 1.0 spec */
|
||||
XML_C14N_1_1 = 2 /* C14N 1.1 spec */
|
||||
} xmlC14NMode;
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlC14NDocSaveTo (xmlDocPtr doc,
|
||||
xmlNodeSetPtr nodes,
|
||||
int mode, /* a xmlC14NMode */
|
||||
xmlChar **inclusive_ns_prefixes,
|
||||
int with_comments,
|
||||
xmlOutputBufferPtr buf);
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlC14NDocDumpMemory (xmlDocPtr doc,
|
||||
xmlNodeSetPtr nodes,
|
||||
int mode, /* a xmlC14NMode */
|
||||
xmlChar **inclusive_ns_prefixes,
|
||||
int with_comments,
|
||||
xmlChar **doc_txt_ptr);
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlC14NDocSave (xmlDocPtr doc,
|
||||
xmlNodeSetPtr nodes,
|
||||
int mode, /* a xmlC14NMode */
|
||||
xmlChar **inclusive_ns_prefixes,
|
||||
int with_comments,
|
||||
const char* filename,
|
||||
int compression);
|
||||
|
||||
|
||||
/**
|
||||
* This is the core C14N function
|
||||
*/
|
||||
/**
|
||||
* xmlC14NIsVisibleCallback:
|
||||
* @user_data: user data
|
||||
* @node: the current node
|
||||
* @parent: the parent node
|
||||
*
|
||||
* Signature for a C14N callback on visible nodes
|
||||
*
|
||||
* Returns 1 if the node should be included
|
||||
*/
|
||||
typedef int (*xmlC14NIsVisibleCallback) (void* user_data,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr parent);
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlC14NExecute (xmlDocPtr doc,
|
||||
xmlC14NIsVisibleCallback is_visible_callback,
|
||||
void* user_data,
|
||||
int mode, /* a xmlC14NMode */
|
||||
xmlChar **inclusive_ns_prefixes,
|
||||
int with_comments,
|
||||
xmlOutputBufferPtr buf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* LIBXML_C14N_ENABLED */
|
||||
#endif /* __XML_C14N_H__ */
|
||||
|
||||
+182
@@ -0,0 +1,182 @@
|
||||
/**
|
||||
* Summary: interfaces to the Catalog handling system
|
||||
* Description: the catalog module implements the support for
|
||||
* XML Catalogs and SGML catalogs
|
||||
*
|
||||
* SGML Open Technical Resolution TR9401:1997.
|
||||
* http://www.jclark.com/sp/catalog.htm
|
||||
*
|
||||
* XML Catalogs Working Draft 06 August 2001
|
||||
* http://www.oasis-open.org/committees/entity/spec-2001-08-06.html
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_CATALOG_H__
|
||||
#define __XML_CATALOG_H__
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
#include <libxml/xmlstring.h>
|
||||
#include <libxml/tree.h>
|
||||
|
||||
#ifdef LIBXML_CATALOG_ENABLED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* XML_CATALOGS_NAMESPACE:
|
||||
*
|
||||
* The namespace for the XML Catalogs elements.
|
||||
*/
|
||||
#define XML_CATALOGS_NAMESPACE \
|
||||
(const xmlChar *) "urn:oasis:names:tc:entity:xmlns:xml:catalog"
|
||||
/**
|
||||
* XML_CATALOG_PI:
|
||||
*
|
||||
* The specific XML Catalog Processing Instruction name.
|
||||
*/
|
||||
#define XML_CATALOG_PI \
|
||||
(const xmlChar *) "oasis-xml-catalog"
|
||||
|
||||
/*
|
||||
* The API is voluntarily limited to general cataloging.
|
||||
*/
|
||||
typedef enum {
|
||||
XML_CATA_PREFER_NONE = 0,
|
||||
XML_CATA_PREFER_PUBLIC = 1,
|
||||
XML_CATA_PREFER_SYSTEM
|
||||
} xmlCatalogPrefer;
|
||||
|
||||
typedef enum {
|
||||
XML_CATA_ALLOW_NONE = 0,
|
||||
XML_CATA_ALLOW_GLOBAL = 1,
|
||||
XML_CATA_ALLOW_DOCUMENT = 2,
|
||||
XML_CATA_ALLOW_ALL = 3
|
||||
} xmlCatalogAllow;
|
||||
|
||||
typedef struct _xmlCatalog xmlCatalog;
|
||||
typedef xmlCatalog *xmlCatalogPtr;
|
||||
|
||||
/*
|
||||
* Operations on a given catalog.
|
||||
*/
|
||||
XMLPUBFUN xmlCatalogPtr
|
||||
xmlNewCatalog (int sgml);
|
||||
XMLPUBFUN xmlCatalogPtr
|
||||
xmlLoadACatalog (const char *filename);
|
||||
XMLPUBFUN xmlCatalogPtr
|
||||
xmlLoadSGMLSuperCatalog (const char *filename);
|
||||
XMLPUBFUN int
|
||||
xmlConvertSGMLCatalog (xmlCatalogPtr catal);
|
||||
XMLPUBFUN int
|
||||
xmlACatalogAdd (xmlCatalogPtr catal,
|
||||
const xmlChar *type,
|
||||
const xmlChar *orig,
|
||||
const xmlChar *replace);
|
||||
XMLPUBFUN int
|
||||
xmlACatalogRemove (xmlCatalogPtr catal,
|
||||
const xmlChar *value);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlACatalogResolve (xmlCatalogPtr catal,
|
||||
const xmlChar *pubID,
|
||||
const xmlChar *sysID);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlACatalogResolveSystem(xmlCatalogPtr catal,
|
||||
const xmlChar *sysID);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlACatalogResolvePublic(xmlCatalogPtr catal,
|
||||
const xmlChar *pubID);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlACatalogResolveURI (xmlCatalogPtr catal,
|
||||
const xmlChar *URI);
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
XMLPUBFUN void
|
||||
xmlACatalogDump (xmlCatalogPtr catal,
|
||||
FILE *out);
|
||||
#endif /* LIBXML_OUTPUT_ENABLED */
|
||||
XMLPUBFUN void
|
||||
xmlFreeCatalog (xmlCatalogPtr catal);
|
||||
XMLPUBFUN int
|
||||
xmlCatalogIsEmpty (xmlCatalogPtr catal);
|
||||
|
||||
/*
|
||||
* Global operations.
|
||||
*/
|
||||
XMLPUBFUN void
|
||||
xmlInitializeCatalog (void);
|
||||
XMLPUBFUN int
|
||||
xmlLoadCatalog (const char *filename);
|
||||
XMLPUBFUN void
|
||||
xmlLoadCatalogs (const char *paths);
|
||||
XMLPUBFUN void
|
||||
xmlCatalogCleanup (void);
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
XMLPUBFUN void
|
||||
xmlCatalogDump (FILE *out);
|
||||
#endif /* LIBXML_OUTPUT_ENABLED */
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlCatalogResolve (const xmlChar *pubID,
|
||||
const xmlChar *sysID);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlCatalogResolveSystem (const xmlChar *sysID);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlCatalogResolvePublic (const xmlChar *pubID);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlCatalogResolveURI (const xmlChar *URI);
|
||||
XMLPUBFUN int
|
||||
xmlCatalogAdd (const xmlChar *type,
|
||||
const xmlChar *orig,
|
||||
const xmlChar *replace);
|
||||
XMLPUBFUN int
|
||||
xmlCatalogRemove (const xmlChar *value);
|
||||
XMLPUBFUN xmlDocPtr
|
||||
xmlParseCatalogFile (const char *filename);
|
||||
XMLPUBFUN int
|
||||
xmlCatalogConvert (void);
|
||||
|
||||
/*
|
||||
* Strictly minimal interfaces for per-document catalogs used
|
||||
* by the parser.
|
||||
*/
|
||||
XMLPUBFUN void
|
||||
xmlCatalogFreeLocal (void *catalogs);
|
||||
XMLPUBFUN void *
|
||||
xmlCatalogAddLocal (void *catalogs,
|
||||
const xmlChar *URL);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlCatalogLocalResolve (void *catalogs,
|
||||
const xmlChar *pubID,
|
||||
const xmlChar *sysID);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlCatalogLocalResolveURI(void *catalogs,
|
||||
const xmlChar *URI);
|
||||
/*
|
||||
* Preference settings.
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlCatalogSetDebug (int level);
|
||||
XMLPUBFUN xmlCatalogPrefer
|
||||
xmlCatalogSetDefaultPrefer(xmlCatalogPrefer prefer);
|
||||
XMLPUBFUN void
|
||||
xmlCatalogSetDefaults (xmlCatalogAllow allow);
|
||||
XMLPUBFUN xmlCatalogAllow
|
||||
xmlCatalogGetDefaults (void);
|
||||
|
||||
|
||||
/* DEPRECATED interfaces */
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlCatalogGetSystem (const xmlChar *sysID);
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlCatalogGetPublic (const xmlChar *pubID);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* LIBXML_CATALOG_ENABLED */
|
||||
#endif /* __XML_CATALOG_H__ */
|
||||
+230
@@ -0,0 +1,230 @@
|
||||
/*
|
||||
* Summary: Unicode character range checking
|
||||
* Description: this module exports interfaces for the character
|
||||
* range validation APIs
|
||||
*
|
||||
* This file is automatically generated from the cvs source
|
||||
* definition files using the genChRanges.py Python script
|
||||
*
|
||||
* Generation date: Mon Mar 27 11:09:48 2006
|
||||
* Sources: chvalid.def
|
||||
* Author: William Brack <wbrack@mmm.com.hk>
|
||||
*/
|
||||
|
||||
#ifndef __XML_CHVALID_H__
|
||||
#define __XML_CHVALID_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
#include <libxml/xmlstring.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define our typedefs and structures
|
||||
*
|
||||
*/
|
||||
typedef struct _xmlChSRange xmlChSRange;
|
||||
typedef xmlChSRange *xmlChSRangePtr;
|
||||
struct _xmlChSRange {
|
||||
unsigned short low;
|
||||
unsigned short high;
|
||||
};
|
||||
|
||||
typedef struct _xmlChLRange xmlChLRange;
|
||||
typedef xmlChLRange *xmlChLRangePtr;
|
||||
struct _xmlChLRange {
|
||||
unsigned int low;
|
||||
unsigned int high;
|
||||
};
|
||||
|
||||
typedef struct _xmlChRangeGroup xmlChRangeGroup;
|
||||
typedef xmlChRangeGroup *xmlChRangeGroupPtr;
|
||||
struct _xmlChRangeGroup {
|
||||
int nbShortRange;
|
||||
int nbLongRange;
|
||||
const xmlChSRange *shortRange; /* points to an array of ranges */
|
||||
const xmlChLRange *longRange;
|
||||
};
|
||||
|
||||
/**
|
||||
* Range checking routine
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlCharInRange(unsigned int val, const xmlChRangeGroup *group);
|
||||
|
||||
|
||||
/**
|
||||
* xmlIsBaseChar_ch:
|
||||
* @c: char to validate
|
||||
*
|
||||
* Automatically generated by genChRanges.py
|
||||
*/
|
||||
#define xmlIsBaseChar_ch(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \
|
||||
((0x61 <= (c)) && ((c) <= 0x7a)) || \
|
||||
((0xc0 <= (c)) && ((c) <= 0xd6)) || \
|
||||
((0xd8 <= (c)) && ((c) <= 0xf6)) || \
|
||||
(0xf8 <= (c)))
|
||||
|
||||
/**
|
||||
* xmlIsBaseCharQ:
|
||||
* @c: char to validate
|
||||
*
|
||||
* Automatically generated by genChRanges.py
|
||||
*/
|
||||
#define xmlIsBaseCharQ(c) (((c) < 0x100) ? \
|
||||
xmlIsBaseChar_ch((c)) : \
|
||||
xmlCharInRange((c), &xmlIsBaseCharGroup))
|
||||
|
||||
XMLPUBVAR const xmlChRangeGroup xmlIsBaseCharGroup;
|
||||
|
||||
/**
|
||||
* xmlIsBlank_ch:
|
||||
* @c: char to validate
|
||||
*
|
||||
* Automatically generated by genChRanges.py
|
||||
*/
|
||||
#define xmlIsBlank_ch(c) (((c) == 0x20) || \
|
||||
((0x9 <= (c)) && ((c) <= 0xa)) || \
|
||||
((c) == 0xd))
|
||||
|
||||
/**
|
||||
* xmlIsBlankQ:
|
||||
* @c: char to validate
|
||||
*
|
||||
* Automatically generated by genChRanges.py
|
||||
*/
|
||||
#define xmlIsBlankQ(c) (((c) < 0x100) ? \
|
||||
xmlIsBlank_ch((c)) : 0)
|
||||
|
||||
|
||||
/**
|
||||
* xmlIsChar_ch:
|
||||
* @c: char to validate
|
||||
*
|
||||
* Automatically generated by genChRanges.py
|
||||
*/
|
||||
#define xmlIsChar_ch(c) (((0x9 <= (c)) && ((c) <= 0xa)) || \
|
||||
((c) == 0xd) || \
|
||||
(0x20 <= (c)))
|
||||
|
||||
/**
|
||||
* xmlIsCharQ:
|
||||
* @c: char to validate
|
||||
*
|
||||
* Automatically generated by genChRanges.py
|
||||
*/
|
||||
#define xmlIsCharQ(c) (((c) < 0x100) ? \
|
||||
xmlIsChar_ch((c)) :\
|
||||
(((0x100 <= (c)) && ((c) <= 0xd7ff)) || \
|
||||
((0xe000 <= (c)) && ((c) <= 0xfffd)) || \
|
||||
((0x10000 <= (c)) && ((c) <= 0x10ffff))))
|
||||
|
||||
XMLPUBVAR const xmlChRangeGroup xmlIsCharGroup;
|
||||
|
||||
/**
|
||||
* xmlIsCombiningQ:
|
||||
* @c: char to validate
|
||||
*
|
||||
* Automatically generated by genChRanges.py
|
||||
*/
|
||||
#define xmlIsCombiningQ(c) (((c) < 0x100) ? \
|
||||
0 : \
|
||||
xmlCharInRange((c), &xmlIsCombiningGroup))
|
||||
|
||||
XMLPUBVAR const xmlChRangeGroup xmlIsCombiningGroup;
|
||||
|
||||
/**
|
||||
* xmlIsDigit_ch:
|
||||
* @c: char to validate
|
||||
*
|
||||
* Automatically generated by genChRanges.py
|
||||
*/
|
||||
#define xmlIsDigit_ch(c) (((0x30 <= (c)) && ((c) <= 0x39)))
|
||||
|
||||
/**
|
||||
* xmlIsDigitQ:
|
||||
* @c: char to validate
|
||||
*
|
||||
* Automatically generated by genChRanges.py
|
||||
*/
|
||||
#define xmlIsDigitQ(c) (((c) < 0x100) ? \
|
||||
xmlIsDigit_ch((c)) : \
|
||||
xmlCharInRange((c), &xmlIsDigitGroup))
|
||||
|
||||
XMLPUBVAR const xmlChRangeGroup xmlIsDigitGroup;
|
||||
|
||||
/**
|
||||
* xmlIsExtender_ch:
|
||||
* @c: char to validate
|
||||
*
|
||||
* Automatically generated by genChRanges.py
|
||||
*/
|
||||
#define xmlIsExtender_ch(c) (((c) == 0xb7))
|
||||
|
||||
/**
|
||||
* xmlIsExtenderQ:
|
||||
* @c: char to validate
|
||||
*
|
||||
* Automatically generated by genChRanges.py
|
||||
*/
|
||||
#define xmlIsExtenderQ(c) (((c) < 0x100) ? \
|
||||
xmlIsExtender_ch((c)) : \
|
||||
xmlCharInRange((c), &xmlIsExtenderGroup))
|
||||
|
||||
XMLPUBVAR const xmlChRangeGroup xmlIsExtenderGroup;
|
||||
|
||||
/**
|
||||
* xmlIsIdeographicQ:
|
||||
* @c: char to validate
|
||||
*
|
||||
* Automatically generated by genChRanges.py
|
||||
*/
|
||||
#define xmlIsIdeographicQ(c) (((c) < 0x100) ? \
|
||||
0 :\
|
||||
(((0x4e00 <= (c)) && ((c) <= 0x9fa5)) || \
|
||||
((c) == 0x3007) || \
|
||||
((0x3021 <= (c)) && ((c) <= 0x3029))))
|
||||
|
||||
XMLPUBVAR const xmlChRangeGroup xmlIsIdeographicGroup;
|
||||
XMLPUBVAR const unsigned char xmlIsPubidChar_tab[256];
|
||||
|
||||
/**
|
||||
* xmlIsPubidChar_ch:
|
||||
* @c: char to validate
|
||||
*
|
||||
* Automatically generated by genChRanges.py
|
||||
*/
|
||||
#define xmlIsPubidChar_ch(c) (xmlIsPubidChar_tab[(c)])
|
||||
|
||||
/**
|
||||
* xmlIsPubidCharQ:
|
||||
* @c: char to validate
|
||||
*
|
||||
* Automatically generated by genChRanges.py
|
||||
*/
|
||||
#define xmlIsPubidCharQ(c) (((c) < 0x100) ? \
|
||||
xmlIsPubidChar_ch((c)) : 0)
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlIsBaseChar(unsigned int ch);
|
||||
XMLPUBFUN int
|
||||
xmlIsBlank(unsigned int ch);
|
||||
XMLPUBFUN int
|
||||
xmlIsChar(unsigned int ch);
|
||||
XMLPUBFUN int
|
||||
xmlIsCombining(unsigned int ch);
|
||||
XMLPUBFUN int
|
||||
xmlIsDigit(unsigned int ch);
|
||||
XMLPUBFUN int
|
||||
xmlIsExtender(unsigned int ch);
|
||||
XMLPUBFUN int
|
||||
xmlIsIdeographic(unsigned int ch);
|
||||
XMLPUBFUN int
|
||||
xmlIsPubidChar(unsigned int ch);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __XML_CHVALID_H__ */
|
||||
+217
@@ -0,0 +1,217 @@
|
||||
/*
|
||||
* Summary: Tree debugging APIs
|
||||
* Description: Interfaces to a set of routines used for debugging the tree
|
||||
* produced by the XML parser.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __DEBUG_XML__
|
||||
#define __DEBUG_XML__
|
||||
#include <stdio.h>
|
||||
#include <libxml/xmlversion.h>
|
||||
#include <libxml/tree.h>
|
||||
|
||||
#ifdef LIBXML_DEBUG_ENABLED
|
||||
|
||||
#include <libxml/xpath.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The standard Dump routines.
|
||||
*/
|
||||
XMLPUBFUN void
|
||||
xmlDebugDumpString (FILE *output,
|
||||
const xmlChar *str);
|
||||
XMLPUBFUN void
|
||||
xmlDebugDumpAttr (FILE *output,
|
||||
xmlAttrPtr attr,
|
||||
int depth);
|
||||
XMLPUBFUN void
|
||||
xmlDebugDumpAttrList (FILE *output,
|
||||
xmlAttrPtr attr,
|
||||
int depth);
|
||||
XMLPUBFUN void
|
||||
xmlDebugDumpOneNode (FILE *output,
|
||||
xmlNodePtr node,
|
||||
int depth);
|
||||
XMLPUBFUN void
|
||||
xmlDebugDumpNode (FILE *output,
|
||||
xmlNodePtr node,
|
||||
int depth);
|
||||
XMLPUBFUN void
|
||||
xmlDebugDumpNodeList (FILE *output,
|
||||
xmlNodePtr node,
|
||||
int depth);
|
||||
XMLPUBFUN void
|
||||
xmlDebugDumpDocumentHead(FILE *output,
|
||||
xmlDocPtr doc);
|
||||
XMLPUBFUN void
|
||||
xmlDebugDumpDocument (FILE *output,
|
||||
xmlDocPtr doc);
|
||||
XMLPUBFUN void
|
||||
xmlDebugDumpDTD (FILE *output,
|
||||
xmlDtdPtr dtd);
|
||||
XMLPUBFUN void
|
||||
xmlDebugDumpEntities (FILE *output,
|
||||
xmlDocPtr doc);
|
||||
|
||||
/****************************************************************
|
||||
* *
|
||||
* Checking routines *
|
||||
* *
|
||||
****************************************************************/
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlDebugCheckDocument (FILE * output,
|
||||
xmlDocPtr doc);
|
||||
|
||||
/****************************************************************
|
||||
* *
|
||||
* XML shell helpers *
|
||||
* *
|
||||
****************************************************************/
|
||||
|
||||
XMLPUBFUN void
|
||||
xmlLsOneNode (FILE *output, xmlNodePtr node);
|
||||
XMLPUBFUN int
|
||||
xmlLsCountNode (xmlNodePtr node);
|
||||
|
||||
XMLPUBFUN const char *
|
||||
xmlBoolToText (int boolval);
|
||||
|
||||
/****************************************************************
|
||||
* *
|
||||
* The XML shell related structures and functions *
|
||||
* *
|
||||
****************************************************************/
|
||||
|
||||
#ifdef LIBXML_XPATH_ENABLED
|
||||
/**
|
||||
* xmlShellReadlineFunc:
|
||||
* @prompt: a string prompt
|
||||
*
|
||||
* This is a generic signature for the XML shell input function.
|
||||
*
|
||||
* Returns a string which will be freed by the Shell.
|
||||
*/
|
||||
typedef char * (* xmlShellReadlineFunc)(char *prompt);
|
||||
|
||||
/**
|
||||
* xmlShellCtxt:
|
||||
*
|
||||
* A debugging shell context.
|
||||
* TODO: add the defined function tables.
|
||||
*/
|
||||
typedef struct _xmlShellCtxt xmlShellCtxt;
|
||||
typedef xmlShellCtxt *xmlShellCtxtPtr;
|
||||
struct _xmlShellCtxt {
|
||||
char *filename;
|
||||
xmlDocPtr doc;
|
||||
xmlNodePtr node;
|
||||
xmlXPathContextPtr pctxt;
|
||||
int loaded;
|
||||
FILE *output;
|
||||
xmlShellReadlineFunc input;
|
||||
};
|
||||
|
||||
/**
|
||||
* xmlShellCmd:
|
||||
* @ctxt: a shell context
|
||||
* @arg: a string argument
|
||||
* @node: a first node
|
||||
* @node2: a second node
|
||||
*
|
||||
* This is a generic signature for the XML shell functions.
|
||||
*
|
||||
* Returns an int, negative returns indicating errors.
|
||||
*/
|
||||
typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt,
|
||||
char *arg,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr node2);
|
||||
|
||||
XMLPUBFUN void
|
||||
xmlShellPrintXPathError (int errorType,
|
||||
const char *arg);
|
||||
XMLPUBFUN void
|
||||
xmlShellPrintXPathResult(xmlXPathObjectPtr list);
|
||||
XMLPUBFUN int
|
||||
xmlShellList (xmlShellCtxtPtr ctxt,
|
||||
char *arg,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr node2);
|
||||
XMLPUBFUN int
|
||||
xmlShellBase (xmlShellCtxtPtr ctxt,
|
||||
char *arg,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr node2);
|
||||
XMLPUBFUN int
|
||||
xmlShellDir (xmlShellCtxtPtr ctxt,
|
||||
char *arg,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr node2);
|
||||
XMLPUBFUN int
|
||||
xmlShellLoad (xmlShellCtxtPtr ctxt,
|
||||
char *filename,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr node2);
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
XMLPUBFUN void
|
||||
xmlShellPrintNode (xmlNodePtr node);
|
||||
XMLPUBFUN int
|
||||
xmlShellCat (xmlShellCtxtPtr ctxt,
|
||||
char *arg,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr node2);
|
||||
XMLPUBFUN int
|
||||
xmlShellWrite (xmlShellCtxtPtr ctxt,
|
||||
char *filename,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr node2);
|
||||
XMLPUBFUN int
|
||||
xmlShellSave (xmlShellCtxtPtr ctxt,
|
||||
char *filename,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr node2);
|
||||
#endif /* LIBXML_OUTPUT_ENABLED */
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
XMLPUBFUN int
|
||||
xmlShellValidate (xmlShellCtxtPtr ctxt,
|
||||
char *dtd,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr node2);
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
XMLPUBFUN int
|
||||
xmlShellDu (xmlShellCtxtPtr ctxt,
|
||||
char *arg,
|
||||
xmlNodePtr tree,
|
||||
xmlNodePtr node2);
|
||||
XMLPUBFUN int
|
||||
xmlShellPwd (xmlShellCtxtPtr ctxt,
|
||||
char *buffer,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr node2);
|
||||
|
||||
/*
|
||||
* The Shell interface.
|
||||
*/
|
||||
XMLPUBFUN void
|
||||
xmlShell (xmlDocPtr doc,
|
||||
const char *filename,
|
||||
xmlShellReadlineFunc input,
|
||||
FILE *output);
|
||||
|
||||
#endif /* LIBXML_XPATH_ENABLED */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_DEBUG_ENABLED */
|
||||
#endif /* __DEBUG_XML__ */
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Summary: string dictionary
|
||||
* Description: dictionary of reusable strings, just used to avoid allocation
|
||||
* and freeing operations.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_DICT_H__
|
||||
#define __XML_DICT_H__
|
||||
|
||||
#include <stddef.h>
|
||||
#include <libxml/xmlversion.h>
|
||||
#include <libxml/xmlstring.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The dictionary.
|
||||
*/
|
||||
typedef struct _xmlDict xmlDict;
|
||||
typedef xmlDict *xmlDictPtr;
|
||||
|
||||
/*
|
||||
* Initializer
|
||||
*/
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlInitializeDict(void);
|
||||
|
||||
/*
|
||||
* Constructor and destructor.
|
||||
*/
|
||||
XMLPUBFUN xmlDictPtr
|
||||
xmlDictCreate (void);
|
||||
XMLPUBFUN size_t
|
||||
xmlDictSetLimit (xmlDictPtr dict,
|
||||
size_t limit);
|
||||
XMLPUBFUN size_t
|
||||
xmlDictGetUsage (xmlDictPtr dict);
|
||||
XMLPUBFUN xmlDictPtr
|
||||
xmlDictCreateSub(xmlDictPtr sub);
|
||||
XMLPUBFUN int
|
||||
xmlDictReference(xmlDictPtr dict);
|
||||
XMLPUBFUN void
|
||||
xmlDictFree (xmlDictPtr dict);
|
||||
|
||||
/*
|
||||
* Lookup of entry in the dictionary.
|
||||
*/
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlDictLookup (xmlDictPtr dict,
|
||||
const xmlChar *name,
|
||||
int len);
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlDictExists (xmlDictPtr dict,
|
||||
const xmlChar *name,
|
||||
int len);
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlDictQLookup (xmlDictPtr dict,
|
||||
const xmlChar *prefix,
|
||||
const xmlChar *name);
|
||||
XMLPUBFUN int
|
||||
xmlDictOwns (xmlDictPtr dict,
|
||||
const xmlChar *str);
|
||||
XMLPUBFUN int
|
||||
xmlDictSize (xmlDictPtr dict);
|
||||
|
||||
/*
|
||||
* Cleanup function
|
||||
*/
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlDictCleanup (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* ! __XML_DICT_H__ */
|
||||
+244
@@ -0,0 +1,244 @@
|
||||
/*
|
||||
* Summary: interface for the encoding conversion functions
|
||||
* Description: interface for the encoding conversion functions needed for
|
||||
* XML basic encoding and iconv() support.
|
||||
*
|
||||
* Related specs are
|
||||
* rfc2044 (UTF-8 and UTF-16) F. Yergeau Alis Technologies
|
||||
* [ISO-10646] UTF-8 and UTF-16 in Annexes
|
||||
* [ISO-8859-1] ISO Latin-1 characters codes.
|
||||
* [UNICODE] The Unicode Consortium, "The Unicode Standard --
|
||||
* Worldwide Character Encoding -- Version 1.0", Addison-
|
||||
* Wesley, Volume 1, 1991, Volume 2, 1992. UTF-8 is
|
||||
* described in Unicode Technical Report #4.
|
||||
* [US-ASCII] Coded Character Set--7-bit American Standard Code for
|
||||
* Information Interchange, ANSI X3.4-1986.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_CHAR_ENCODING_H__
|
||||
#define __XML_CHAR_ENCODING_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#ifdef LIBXML_ICONV_ENABLED
|
||||
#include <iconv.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
XML_ENC_ERR_SUCCESS = 0,
|
||||
XML_ENC_ERR_SPACE = -1,
|
||||
XML_ENC_ERR_INPUT = -2,
|
||||
XML_ENC_ERR_PARTIAL = -3,
|
||||
XML_ENC_ERR_INTERNAL = -4,
|
||||
XML_ENC_ERR_MEMORY = -5
|
||||
} xmlCharEncError;
|
||||
|
||||
/*
|
||||
* xmlCharEncoding:
|
||||
*
|
||||
* Predefined values for some standard encodings.
|
||||
* Libxml does not do beforehand translation on UTF8 and ISOLatinX.
|
||||
* It also supports ASCII, ISO-8859-1, and UTF16 (LE and BE) by default.
|
||||
*
|
||||
* Anything else would have to be translated to UTF8 before being
|
||||
* given to the parser itself. The BOM for UTF16 and the encoding
|
||||
* declaration are looked at and a converter is looked for at that
|
||||
* point. If not found the parser stops here as asked by the XML REC. A
|
||||
* converter can be registered by the user using xmlRegisterCharEncodingHandler
|
||||
* but the current form doesn't allow stateful transcoding (a serious
|
||||
* problem agreed !). If iconv has been found it will be used
|
||||
* automatically and allow stateful transcoding, the simplest is then
|
||||
* to be sure to enable iconv and to provide iconv libs for the encoding
|
||||
* support needed.
|
||||
*
|
||||
* Note that the generic "UTF-16" is not a predefined value. Instead, only
|
||||
* the specific UTF-16LE and UTF-16BE are present.
|
||||
*/
|
||||
typedef enum {
|
||||
XML_CHAR_ENCODING_ERROR= -1, /* No char encoding detected */
|
||||
XML_CHAR_ENCODING_NONE= 0, /* No char encoding detected */
|
||||
XML_CHAR_ENCODING_UTF8= 1, /* UTF-8 */
|
||||
XML_CHAR_ENCODING_UTF16LE= 2, /* UTF-16 little endian */
|
||||
XML_CHAR_ENCODING_UTF16BE= 3, /* UTF-16 big endian */
|
||||
XML_CHAR_ENCODING_UCS4LE= 4, /* UCS-4 little endian */
|
||||
XML_CHAR_ENCODING_UCS4BE= 5, /* UCS-4 big endian */
|
||||
XML_CHAR_ENCODING_EBCDIC= 6, /* EBCDIC uh! */
|
||||
XML_CHAR_ENCODING_UCS4_2143=7, /* UCS-4 unusual ordering */
|
||||
XML_CHAR_ENCODING_UCS4_3412=8, /* UCS-4 unusual ordering */
|
||||
XML_CHAR_ENCODING_UCS2= 9, /* UCS-2 */
|
||||
XML_CHAR_ENCODING_8859_1= 10,/* ISO-8859-1 ISO Latin 1 */
|
||||
XML_CHAR_ENCODING_8859_2= 11,/* ISO-8859-2 ISO Latin 2 */
|
||||
XML_CHAR_ENCODING_8859_3= 12,/* ISO-8859-3 */
|
||||
XML_CHAR_ENCODING_8859_4= 13,/* ISO-8859-4 */
|
||||
XML_CHAR_ENCODING_8859_5= 14,/* ISO-8859-5 */
|
||||
XML_CHAR_ENCODING_8859_6= 15,/* ISO-8859-6 */
|
||||
XML_CHAR_ENCODING_8859_7= 16,/* ISO-8859-7 */
|
||||
XML_CHAR_ENCODING_8859_8= 17,/* ISO-8859-8 */
|
||||
XML_CHAR_ENCODING_8859_9= 18,/* ISO-8859-9 */
|
||||
XML_CHAR_ENCODING_2022_JP= 19,/* ISO-2022-JP */
|
||||
XML_CHAR_ENCODING_SHIFT_JIS=20,/* Shift_JIS */
|
||||
XML_CHAR_ENCODING_EUC_JP= 21,/* EUC-JP */
|
||||
XML_CHAR_ENCODING_ASCII= 22 /* pure ASCII */
|
||||
} xmlCharEncoding;
|
||||
|
||||
/**
|
||||
* xmlCharEncodingInputFunc:
|
||||
* @out: a pointer to an array of bytes to store the UTF-8 result
|
||||
* @outlen: the length of @out
|
||||
* @in: a pointer to an array of chars in the original encoding
|
||||
* @inlen: the length of @in
|
||||
*
|
||||
* Take a block of chars in the original encoding and try to convert
|
||||
* it to an UTF-8 block of chars out.
|
||||
*
|
||||
* Returns the number of bytes written, -1 if lack of space, or -2
|
||||
* if the transcoding failed.
|
||||
* The value of @inlen after return is the number of octets consumed
|
||||
* if the return value is positive, else unpredictiable.
|
||||
* The value of @outlen after return is the number of octets consumed.
|
||||
*/
|
||||
typedef int (* xmlCharEncodingInputFunc)(unsigned char *out, int *outlen,
|
||||
const unsigned char *in, int *inlen);
|
||||
|
||||
|
||||
/**
|
||||
* xmlCharEncodingOutputFunc:
|
||||
* @out: a pointer to an array of bytes to store the result
|
||||
* @outlen: the length of @out
|
||||
* @in: a pointer to an array of UTF-8 chars
|
||||
* @inlen: the length of @in
|
||||
*
|
||||
* Take a block of UTF-8 chars in and try to convert it to another
|
||||
* encoding.
|
||||
* Note: a first call designed to produce heading info is called with
|
||||
* in = NULL. If stateful this should also initialize the encoder state.
|
||||
*
|
||||
* Returns the number of bytes written, -1 if lack of space, or -2
|
||||
* if the transcoding failed.
|
||||
* The value of @inlen after return is the number of octets consumed
|
||||
* if the return value is positive, else unpredictiable.
|
||||
* The value of @outlen after return is the number of octets produced.
|
||||
*/
|
||||
typedef int (* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen,
|
||||
const unsigned char *in, int *inlen);
|
||||
|
||||
|
||||
/*
|
||||
* Block defining the handlers for non UTF-8 encodings.
|
||||
* If iconv is supported, there are two extra fields.
|
||||
*/
|
||||
typedef struct _xmlCharEncodingHandler xmlCharEncodingHandler;
|
||||
typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr;
|
||||
struct _xmlCharEncodingHandler {
|
||||
char *name;
|
||||
xmlCharEncodingInputFunc input;
|
||||
xmlCharEncodingOutputFunc output;
|
||||
#ifdef LIBXML_ICONV_ENABLED
|
||||
iconv_t iconv_in;
|
||||
iconv_t iconv_out;
|
||||
#endif /* LIBXML_ICONV_ENABLED */
|
||||
#ifdef LIBXML_ICU_ENABLED
|
||||
struct _uconv_t *uconv_in;
|
||||
struct _uconv_t *uconv_out;
|
||||
#endif /* LIBXML_ICU_ENABLED */
|
||||
};
|
||||
|
||||
/*
|
||||
* Interfaces for encoding handlers.
|
||||
*/
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlInitCharEncodingHandlers (void);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlCleanupCharEncodingHandlers (void);
|
||||
XMLPUBFUN void
|
||||
xmlRegisterCharEncodingHandler (xmlCharEncodingHandlerPtr handler);
|
||||
XMLPUBFUN int
|
||||
xmlLookupCharEncodingHandler (xmlCharEncoding enc,
|
||||
xmlCharEncodingHandlerPtr *out);
|
||||
XMLPUBFUN int
|
||||
xmlOpenCharEncodingHandler (const char *name,
|
||||
int output,
|
||||
xmlCharEncodingHandlerPtr *out);
|
||||
XMLPUBFUN xmlCharEncodingHandlerPtr
|
||||
xmlGetCharEncodingHandler (xmlCharEncoding enc);
|
||||
XMLPUBFUN xmlCharEncodingHandlerPtr
|
||||
xmlFindCharEncodingHandler (const char *name);
|
||||
XMLPUBFUN xmlCharEncodingHandlerPtr
|
||||
xmlNewCharEncodingHandler (const char *name,
|
||||
xmlCharEncodingInputFunc input,
|
||||
xmlCharEncodingOutputFunc output);
|
||||
|
||||
/*
|
||||
* Interfaces for encoding names and aliases.
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlAddEncodingAlias (const char *name,
|
||||
const char *alias);
|
||||
XMLPUBFUN int
|
||||
xmlDelEncodingAlias (const char *alias);
|
||||
XMLPUBFUN const char *
|
||||
xmlGetEncodingAlias (const char *alias);
|
||||
XMLPUBFUN void
|
||||
xmlCleanupEncodingAliases (void);
|
||||
XMLPUBFUN xmlCharEncoding
|
||||
xmlParseCharEncoding (const char *name);
|
||||
XMLPUBFUN const char *
|
||||
xmlGetCharEncodingName (xmlCharEncoding enc);
|
||||
|
||||
/*
|
||||
* Interfaces directly used by the parsers.
|
||||
*/
|
||||
XMLPUBFUN xmlCharEncoding
|
||||
xmlDetectCharEncoding (const unsigned char *in,
|
||||
int len);
|
||||
|
||||
/** DOC_DISABLE */
|
||||
struct _xmlBuffer;
|
||||
/** DOC_ENABLE */
|
||||
XMLPUBFUN int
|
||||
xmlCharEncOutFunc (xmlCharEncodingHandler *handler,
|
||||
struct _xmlBuffer *out,
|
||||
struct _xmlBuffer *in);
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlCharEncInFunc (xmlCharEncodingHandler *handler,
|
||||
struct _xmlBuffer *out,
|
||||
struct _xmlBuffer *in);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlCharEncFirstLine (xmlCharEncodingHandler *handler,
|
||||
struct _xmlBuffer *out,
|
||||
struct _xmlBuffer *in);
|
||||
XMLPUBFUN int
|
||||
xmlCharEncCloseFunc (xmlCharEncodingHandler *handler);
|
||||
|
||||
/*
|
||||
* Export a few useful functions
|
||||
*/
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
XMLPUBFUN int
|
||||
UTF8Toisolat1 (unsigned char *out,
|
||||
int *outlen,
|
||||
const unsigned char *in,
|
||||
int *inlen);
|
||||
#endif /* LIBXML_OUTPUT_ENABLED */
|
||||
XMLPUBFUN int
|
||||
isolat1ToUTF8 (unsigned char *out,
|
||||
int *outlen,
|
||||
const unsigned char *in,
|
||||
int *inlen);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XML_CHAR_ENCODING_H__ */
|
||||
+166
@@ -0,0 +1,166 @@
|
||||
/*
|
||||
* Summary: interface for the XML entities handling
|
||||
* Description: this module provides some of the entity API needed
|
||||
* for the parser and applications.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_ENTITIES_H__
|
||||
#define __XML_ENTITIES_H__
|
||||
|
||||
/** DOC_DISABLE */
|
||||
#include <libxml/xmlversion.h>
|
||||
#define XML_TREE_INTERNALS
|
||||
#include <libxml/tree.h>
|
||||
#undef XML_TREE_INTERNALS
|
||||
/** DOC_ENABLE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The different valid entity types.
|
||||
*/
|
||||
typedef enum {
|
||||
XML_INTERNAL_GENERAL_ENTITY = 1,
|
||||
XML_EXTERNAL_GENERAL_PARSED_ENTITY = 2,
|
||||
XML_EXTERNAL_GENERAL_UNPARSED_ENTITY = 3,
|
||||
XML_INTERNAL_PARAMETER_ENTITY = 4,
|
||||
XML_EXTERNAL_PARAMETER_ENTITY = 5,
|
||||
XML_INTERNAL_PREDEFINED_ENTITY = 6
|
||||
} xmlEntityType;
|
||||
|
||||
/*
|
||||
* An unit of storage for an entity, contains the string, the value
|
||||
* and the linkind data needed for the linking in the hash table.
|
||||
*/
|
||||
|
||||
struct _xmlEntity {
|
||||
void *_private; /* application data */
|
||||
xmlElementType type; /* XML_ENTITY_DECL, must be second ! */
|
||||
const xmlChar *name; /* Entity name */
|
||||
struct _xmlNode *children; /* First child link */
|
||||
struct _xmlNode *last; /* Last child link */
|
||||
struct _xmlDtd *parent; /* -> DTD */
|
||||
struct _xmlNode *next; /* next sibling link */
|
||||
struct _xmlNode *prev; /* previous sibling link */
|
||||
struct _xmlDoc *doc; /* the containing document */
|
||||
|
||||
xmlChar *orig; /* content without ref substitution */
|
||||
xmlChar *content; /* content or ndata if unparsed */
|
||||
int length; /* the content length */
|
||||
xmlEntityType etype; /* The entity type */
|
||||
const xmlChar *ExternalID; /* External identifier for PUBLIC */
|
||||
const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC Entity */
|
||||
|
||||
struct _xmlEntity *nexte; /* unused */
|
||||
const xmlChar *URI; /* the full URI as computed */
|
||||
int owner; /* unused */
|
||||
int flags; /* various flags */
|
||||
unsigned long expandedSize; /* expanded size */
|
||||
};
|
||||
|
||||
/*
|
||||
* All entities are stored in an hash table.
|
||||
* There is 2 separate hash tables for global and parameter entities.
|
||||
*/
|
||||
|
||||
typedef struct _xmlHashTable xmlEntitiesTable;
|
||||
typedef xmlEntitiesTable *xmlEntitiesTablePtr;
|
||||
|
||||
/*
|
||||
* External functions:
|
||||
*/
|
||||
|
||||
#ifdef LIBXML_LEGACY_ENABLED
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlInitializePredefinedEntities (void);
|
||||
#endif /* LIBXML_LEGACY_ENABLED */
|
||||
|
||||
XMLPUBFUN xmlEntityPtr
|
||||
xmlNewEntity (xmlDocPtr doc,
|
||||
const xmlChar *name,
|
||||
int type,
|
||||
const xmlChar *ExternalID,
|
||||
const xmlChar *SystemID,
|
||||
const xmlChar *content);
|
||||
XMLPUBFUN void
|
||||
xmlFreeEntity (xmlEntityPtr entity);
|
||||
XMLPUBFUN int
|
||||
xmlAddEntity (xmlDocPtr doc,
|
||||
int extSubset,
|
||||
const xmlChar *name,
|
||||
int type,
|
||||
const xmlChar *ExternalID,
|
||||
const xmlChar *SystemID,
|
||||
const xmlChar *content,
|
||||
xmlEntityPtr *out);
|
||||
XMLPUBFUN xmlEntityPtr
|
||||
xmlAddDocEntity (xmlDocPtr doc,
|
||||
const xmlChar *name,
|
||||
int type,
|
||||
const xmlChar *ExternalID,
|
||||
const xmlChar *SystemID,
|
||||
const xmlChar *content);
|
||||
XMLPUBFUN xmlEntityPtr
|
||||
xmlAddDtdEntity (xmlDocPtr doc,
|
||||
const xmlChar *name,
|
||||
int type,
|
||||
const xmlChar *ExternalID,
|
||||
const xmlChar *SystemID,
|
||||
const xmlChar *content);
|
||||
XMLPUBFUN xmlEntityPtr
|
||||
xmlGetPredefinedEntity (const xmlChar *name);
|
||||
XMLPUBFUN xmlEntityPtr
|
||||
xmlGetDocEntity (const xmlDoc *doc,
|
||||
const xmlChar *name);
|
||||
XMLPUBFUN xmlEntityPtr
|
||||
xmlGetDtdEntity (xmlDocPtr doc,
|
||||
const xmlChar *name);
|
||||
XMLPUBFUN xmlEntityPtr
|
||||
xmlGetParameterEntity (xmlDocPtr doc,
|
||||
const xmlChar *name);
|
||||
#ifdef LIBXML_LEGACY_ENABLED
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlEncodeEntities (xmlDocPtr doc,
|
||||
const xmlChar *input);
|
||||
#endif /* LIBXML_LEGACY_ENABLED */
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlEncodeEntitiesReentrant(xmlDocPtr doc,
|
||||
const xmlChar *input);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlEncodeSpecialChars (const xmlDoc *doc,
|
||||
const xmlChar *input);
|
||||
XMLPUBFUN xmlEntitiesTablePtr
|
||||
xmlCreateEntitiesTable (void);
|
||||
#ifdef LIBXML_TREE_ENABLED
|
||||
XMLPUBFUN xmlEntitiesTablePtr
|
||||
xmlCopyEntitiesTable (xmlEntitiesTablePtr table);
|
||||
#endif /* LIBXML_TREE_ENABLED */
|
||||
XMLPUBFUN void
|
||||
xmlFreeEntitiesTable (xmlEntitiesTablePtr table);
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
XMLPUBFUN void
|
||||
xmlDumpEntitiesTable (xmlBufferPtr buf,
|
||||
xmlEntitiesTablePtr table);
|
||||
XMLPUBFUN void
|
||||
xmlDumpEntityDecl (xmlBufferPtr buf,
|
||||
xmlEntityPtr ent);
|
||||
#endif /* LIBXML_OUTPUT_ENABLED */
|
||||
#ifdef LIBXML_LEGACY_ENABLED
|
||||
XMLPUBFUN void
|
||||
xmlCleanupPredefinedEntities(void);
|
||||
#endif /* LIBXML_LEGACY_ENABLED */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
# endif /* __XML_ENTITIES_H__ */
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Summary: interface for all global variables of the library
|
||||
* Description: Deprecated, don't use
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*/
|
||||
|
||||
#ifndef __XML_GLOBALS_H
|
||||
#define __XML_GLOBALS_H
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
/*
|
||||
* This file was required to access global variables until version v2.12.0.
|
||||
*
|
||||
* These includes are for backward compatibility.
|
||||
*/
|
||||
#include <libxml/HTMLparser.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/xmlerror.h>
|
||||
#include <libxml/xmlIO.h>
|
||||
#include <libxml/xmlsave.h>
|
||||
#include <libxml/threads.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _xmlGlobalState xmlGlobalState;
|
||||
typedef xmlGlobalState *xmlGlobalStatePtr;
|
||||
|
||||
XML_DEPRECATED XMLPUBFUN void
|
||||
xmlInitializeGlobalState(xmlGlobalStatePtr gs);
|
||||
XML_DEPRECATED XMLPUBFUN
|
||||
xmlGlobalStatePtr xmlGetGlobalState(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XML_GLOBALS_H */
|
||||
@@ -0,0 +1,251 @@
|
||||
/*
|
||||
* Summary: Chained hash tables
|
||||
* Description: This module implements the hash table support used in
|
||||
* various places in the library.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Bjorn Reese <bjorn.reese@systematic.dk>
|
||||
*/
|
||||
|
||||
#ifndef __XML_HASH_H__
|
||||
#define __XML_HASH_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
#include <libxml/dict.h>
|
||||
#include <libxml/xmlstring.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The hash table.
|
||||
*/
|
||||
typedef struct _xmlHashTable xmlHashTable;
|
||||
typedef xmlHashTable *xmlHashTablePtr;
|
||||
|
||||
/*
|
||||
* Recent version of gcc produce a warning when a function pointer is assigned
|
||||
* to an object pointer, or vice versa. The following macro is a dirty hack
|
||||
* to allow suppression of the warning. If your architecture has function
|
||||
* pointers which are a different size than a void pointer, there may be some
|
||||
* serious trouble within the library.
|
||||
*/
|
||||
/**
|
||||
* XML_CAST_FPTR:
|
||||
* @fptr: pointer to a function
|
||||
*
|
||||
* Macro to do a casting from an object pointer to a
|
||||
* function pointer without encountering a warning from
|
||||
* gcc
|
||||
*
|
||||
* #define XML_CAST_FPTR(fptr) (*(void **)(&fptr))
|
||||
* This macro violated ISO C aliasing rules (gcc4 on s390 broke)
|
||||
* so it is disabled now
|
||||
*/
|
||||
|
||||
#define XML_CAST_FPTR(fptr) fptr
|
||||
|
||||
/*
|
||||
* function types:
|
||||
*/
|
||||
/**
|
||||
* xmlHashDeallocator:
|
||||
* @payload: the data in the hash
|
||||
* @name: the name associated
|
||||
*
|
||||
* Callback to free data from a hash.
|
||||
*/
|
||||
typedef void (*xmlHashDeallocator)(void *payload, const xmlChar *name);
|
||||
/**
|
||||
* xmlHashCopier:
|
||||
* @payload: the data in the hash
|
||||
* @name: the name associated
|
||||
*
|
||||
* Callback to copy data from a hash.
|
||||
*
|
||||
* Returns a copy of the data or NULL in case of error.
|
||||
*/
|
||||
typedef void *(*xmlHashCopier)(void *payload, const xmlChar *name);
|
||||
/**
|
||||
* xmlHashScanner:
|
||||
* @payload: the data in the hash
|
||||
* @data: extra scanner data
|
||||
* @name: the name associated
|
||||
*
|
||||
* Callback when scanning data in a hash with the simple scanner.
|
||||
*/
|
||||
typedef void (*xmlHashScanner)(void *payload, void *data, const xmlChar *name);
|
||||
/**
|
||||
* xmlHashScannerFull:
|
||||
* @payload: the data in the hash
|
||||
* @data: extra scanner data
|
||||
* @name: the name associated
|
||||
* @name2: the second name associated
|
||||
* @name3: the third name associated
|
||||
*
|
||||
* Callback when scanning data in a hash with the full scanner.
|
||||
*/
|
||||
typedef void (*xmlHashScannerFull)(void *payload, void *data,
|
||||
const xmlChar *name, const xmlChar *name2,
|
||||
const xmlChar *name3);
|
||||
|
||||
/*
|
||||
* Constructor and destructor.
|
||||
*/
|
||||
XMLPUBFUN xmlHashTablePtr
|
||||
xmlHashCreate (int size);
|
||||
XMLPUBFUN xmlHashTablePtr
|
||||
xmlHashCreateDict (int size,
|
||||
xmlDictPtr dict);
|
||||
XMLPUBFUN void
|
||||
xmlHashFree (xmlHashTablePtr hash,
|
||||
xmlHashDeallocator dealloc);
|
||||
XMLPUBFUN void
|
||||
xmlHashDefaultDeallocator(void *entry,
|
||||
const xmlChar *name);
|
||||
|
||||
/*
|
||||
* Add a new entry to the hash table.
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlHashAdd (xmlHashTablePtr hash,
|
||||
const xmlChar *name,
|
||||
void *userdata);
|
||||
XMLPUBFUN int
|
||||
xmlHashAddEntry (xmlHashTablePtr hash,
|
||||
const xmlChar *name,
|
||||
void *userdata);
|
||||
XMLPUBFUN int
|
||||
xmlHashUpdateEntry (xmlHashTablePtr hash,
|
||||
const xmlChar *name,
|
||||
void *userdata,
|
||||
xmlHashDeallocator dealloc);
|
||||
XMLPUBFUN int
|
||||
xmlHashAdd2 (xmlHashTablePtr hash,
|
||||
const xmlChar *name,
|
||||
const xmlChar *name2,
|
||||
void *userdata);
|
||||
XMLPUBFUN int
|
||||
xmlHashAddEntry2 (xmlHashTablePtr hash,
|
||||
const xmlChar *name,
|
||||
const xmlChar *name2,
|
||||
void *userdata);
|
||||
XMLPUBFUN int
|
||||
xmlHashUpdateEntry2 (xmlHashTablePtr hash,
|
||||
const xmlChar *name,
|
||||
const xmlChar *name2,
|
||||
void *userdata,
|
||||
xmlHashDeallocator dealloc);
|
||||
XMLPUBFUN int
|
||||
xmlHashAdd3 (xmlHashTablePtr hash,
|
||||
const xmlChar *name,
|
||||
const xmlChar *name2,
|
||||
const xmlChar *name3,
|
||||
void *userdata);
|
||||
XMLPUBFUN int
|
||||
xmlHashAddEntry3 (xmlHashTablePtr hash,
|
||||
const xmlChar *name,
|
||||
const xmlChar *name2,
|
||||
const xmlChar *name3,
|
||||
void *userdata);
|
||||
XMLPUBFUN int
|
||||
xmlHashUpdateEntry3 (xmlHashTablePtr hash,
|
||||
const xmlChar *name,
|
||||
const xmlChar *name2,
|
||||
const xmlChar *name3,
|
||||
void *userdata,
|
||||
xmlHashDeallocator dealloc);
|
||||
|
||||
/*
|
||||
* Remove an entry from the hash table.
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlHashRemoveEntry (xmlHashTablePtr hash,
|
||||
const xmlChar *name,
|
||||
xmlHashDeallocator dealloc);
|
||||
XMLPUBFUN int
|
||||
xmlHashRemoveEntry2 (xmlHashTablePtr hash,
|
||||
const xmlChar *name,
|
||||
const xmlChar *name2,
|
||||
xmlHashDeallocator dealloc);
|
||||
XMLPUBFUN int
|
||||
xmlHashRemoveEntry3 (xmlHashTablePtr hash,
|
||||
const xmlChar *name,
|
||||
const xmlChar *name2,
|
||||
const xmlChar *name3,
|
||||
xmlHashDeallocator dealloc);
|
||||
|
||||
/*
|
||||
* Retrieve the payload.
|
||||
*/
|
||||
XMLPUBFUN void *
|
||||
xmlHashLookup (xmlHashTablePtr hash,
|
||||
const xmlChar *name);
|
||||
XMLPUBFUN void *
|
||||
xmlHashLookup2 (xmlHashTablePtr hash,
|
||||
const xmlChar *name,
|
||||
const xmlChar *name2);
|
||||
XMLPUBFUN void *
|
||||
xmlHashLookup3 (xmlHashTablePtr hash,
|
||||
const xmlChar *name,
|
||||
const xmlChar *name2,
|
||||
const xmlChar *name3);
|
||||
XMLPUBFUN void *
|
||||
xmlHashQLookup (xmlHashTablePtr hash,
|
||||
const xmlChar *prefix,
|
||||
const xmlChar *name);
|
||||
XMLPUBFUN void *
|
||||
xmlHashQLookup2 (xmlHashTablePtr hash,
|
||||
const xmlChar *prefix,
|
||||
const xmlChar *name,
|
||||
const xmlChar *prefix2,
|
||||
const xmlChar *name2);
|
||||
XMLPUBFUN void *
|
||||
xmlHashQLookup3 (xmlHashTablePtr hash,
|
||||
const xmlChar *prefix,
|
||||
const xmlChar *name,
|
||||
const xmlChar *prefix2,
|
||||
const xmlChar *name2,
|
||||
const xmlChar *prefix3,
|
||||
const xmlChar *name3);
|
||||
|
||||
/*
|
||||
* Helpers.
|
||||
*/
|
||||
XMLPUBFUN xmlHashTablePtr
|
||||
xmlHashCopySafe (xmlHashTablePtr hash,
|
||||
xmlHashCopier copy,
|
||||
xmlHashDeallocator dealloc);
|
||||
XMLPUBFUN xmlHashTablePtr
|
||||
xmlHashCopy (xmlHashTablePtr hash,
|
||||
xmlHashCopier copy);
|
||||
XMLPUBFUN int
|
||||
xmlHashSize (xmlHashTablePtr hash);
|
||||
XMLPUBFUN void
|
||||
xmlHashScan (xmlHashTablePtr hash,
|
||||
xmlHashScanner scan,
|
||||
void *data);
|
||||
XMLPUBFUN void
|
||||
xmlHashScan3 (xmlHashTablePtr hash,
|
||||
const xmlChar *name,
|
||||
const xmlChar *name2,
|
||||
const xmlChar *name3,
|
||||
xmlHashScanner scan,
|
||||
void *data);
|
||||
XMLPUBFUN void
|
||||
xmlHashScanFull (xmlHashTablePtr hash,
|
||||
xmlHashScannerFull scan,
|
||||
void *data);
|
||||
XMLPUBFUN void
|
||||
xmlHashScanFull3 (xmlHashTablePtr hash,
|
||||
const xmlChar *name,
|
||||
const xmlChar *name2,
|
||||
const xmlChar *name3,
|
||||
xmlHashScannerFull scan,
|
||||
void *data);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* ! __XML_HASH_H__ */
|
||||
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* Summary: lists interfaces
|
||||
* Description: this module implement the list support used in
|
||||
* various place in the library.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Gary Pennington <Gary.Pennington@uk.sun.com>
|
||||
*/
|
||||
|
||||
#ifndef __XML_LINK_INCLUDE__
|
||||
#define __XML_LINK_INCLUDE__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _xmlLink xmlLink;
|
||||
typedef xmlLink *xmlLinkPtr;
|
||||
|
||||
typedef struct _xmlList xmlList;
|
||||
typedef xmlList *xmlListPtr;
|
||||
|
||||
/**
|
||||
* xmlListDeallocator:
|
||||
* @lk: the data to deallocate
|
||||
*
|
||||
* Callback function used to free data from a list.
|
||||
*/
|
||||
typedef void (*xmlListDeallocator) (xmlLinkPtr lk);
|
||||
/**
|
||||
* xmlListDataCompare:
|
||||
* @data0: the first data
|
||||
* @data1: the second data
|
||||
*
|
||||
* Callback function used to compare 2 data.
|
||||
*
|
||||
* Returns 0 is equality, -1 or 1 otherwise depending on the ordering.
|
||||
*/
|
||||
typedef int (*xmlListDataCompare) (const void *data0, const void *data1);
|
||||
/**
|
||||
* xmlListWalker:
|
||||
* @data: the data found in the list
|
||||
* @user: extra user provided data to the walker
|
||||
*
|
||||
* Callback function used when walking a list with xmlListWalk().
|
||||
*
|
||||
* Returns 0 to stop walking the list, 1 otherwise.
|
||||
*/
|
||||
typedef int (*xmlListWalker) (const void *data, void *user);
|
||||
|
||||
/* Creation/Deletion */
|
||||
XMLPUBFUN xmlListPtr
|
||||
xmlListCreate (xmlListDeallocator deallocator,
|
||||
xmlListDataCompare compare);
|
||||
XMLPUBFUN void
|
||||
xmlListDelete (xmlListPtr l);
|
||||
|
||||
/* Basic Operators */
|
||||
XMLPUBFUN void *
|
||||
xmlListSearch (xmlListPtr l,
|
||||
void *data);
|
||||
XMLPUBFUN void *
|
||||
xmlListReverseSearch (xmlListPtr l,
|
||||
void *data);
|
||||
XMLPUBFUN int
|
||||
xmlListInsert (xmlListPtr l,
|
||||
void *data) ;
|
||||
XMLPUBFUN int
|
||||
xmlListAppend (xmlListPtr l,
|
||||
void *data) ;
|
||||
XMLPUBFUN int
|
||||
xmlListRemoveFirst (xmlListPtr l,
|
||||
void *data);
|
||||
XMLPUBFUN int
|
||||
xmlListRemoveLast (xmlListPtr l,
|
||||
void *data);
|
||||
XMLPUBFUN int
|
||||
xmlListRemoveAll (xmlListPtr l,
|
||||
void *data);
|
||||
XMLPUBFUN void
|
||||
xmlListClear (xmlListPtr l);
|
||||
XMLPUBFUN int
|
||||
xmlListEmpty (xmlListPtr l);
|
||||
XMLPUBFUN xmlLinkPtr
|
||||
xmlListFront (xmlListPtr l);
|
||||
XMLPUBFUN xmlLinkPtr
|
||||
xmlListEnd (xmlListPtr l);
|
||||
XMLPUBFUN int
|
||||
xmlListSize (xmlListPtr l);
|
||||
|
||||
XMLPUBFUN void
|
||||
xmlListPopFront (xmlListPtr l);
|
||||
XMLPUBFUN void
|
||||
xmlListPopBack (xmlListPtr l);
|
||||
XMLPUBFUN int
|
||||
xmlListPushFront (xmlListPtr l,
|
||||
void *data);
|
||||
XMLPUBFUN int
|
||||
xmlListPushBack (xmlListPtr l,
|
||||
void *data);
|
||||
|
||||
/* Advanced Operators */
|
||||
XMLPUBFUN void
|
||||
xmlListReverse (xmlListPtr l);
|
||||
XMLPUBFUN void
|
||||
xmlListSort (xmlListPtr l);
|
||||
XMLPUBFUN void
|
||||
xmlListWalk (xmlListPtr l,
|
||||
xmlListWalker walker,
|
||||
void *user);
|
||||
XMLPUBFUN void
|
||||
xmlListReverseWalk (xmlListPtr l,
|
||||
xmlListWalker walker,
|
||||
void *user);
|
||||
XMLPUBFUN void
|
||||
xmlListMerge (xmlListPtr l1,
|
||||
xmlListPtr l2);
|
||||
XMLPUBFUN xmlListPtr
|
||||
xmlListDup (xmlListPtr old);
|
||||
XMLPUBFUN int
|
||||
xmlListCopy (xmlListPtr cur,
|
||||
xmlListPtr old);
|
||||
/* Link operators */
|
||||
XMLPUBFUN void *
|
||||
xmlLinkGetData (xmlLinkPtr lk);
|
||||
|
||||
/* xmlListUnique() */
|
||||
/* xmlListSwap */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XML_LINK_INCLUDE__ */
|
||||
+186
@@ -0,0 +1,186 @@
|
||||
/*
|
||||
* Summary: minimal FTP implementation
|
||||
* Description: minimal FTP implementation allowing to fetch resources
|
||||
* like external subset. This module is DEPRECATED, do not
|
||||
* use any of its functions.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __NANO_FTP_H__
|
||||
#define __NANO_FTP_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#if defined(LIBXML_FTP_ENABLED)
|
||||
|
||||
/* Needed for portability to Windows 64 bits */
|
||||
#if defined(_WIN32)
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
/**
|
||||
* SOCKET:
|
||||
*
|
||||
* macro used to provide portability of code to windows sockets
|
||||
*/
|
||||
#define SOCKET int
|
||||
/**
|
||||
* INVALID_SOCKET:
|
||||
*
|
||||
* macro used to provide portability of code to windows sockets
|
||||
* the value to be used when the socket is not valid
|
||||
*/
|
||||
#undef INVALID_SOCKET
|
||||
#define INVALID_SOCKET (-1)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ftpListCallback:
|
||||
* @userData: user provided data for the callback
|
||||
* @filename: the file name (including "->" when links are shown)
|
||||
* @attrib: the attribute string
|
||||
* @owner: the owner string
|
||||
* @group: the group string
|
||||
* @size: the file size
|
||||
* @links: the link count
|
||||
* @year: the year
|
||||
* @month: the month
|
||||
* @day: the day
|
||||
* @hour: the hour
|
||||
* @minute: the minute
|
||||
*
|
||||
* A callback for the xmlNanoFTPList command.
|
||||
* Note that only one of year and day:minute are specified.
|
||||
*/
|
||||
typedef void (*ftpListCallback) (void *userData,
|
||||
const char *filename, const char *attrib,
|
||||
const char *owner, const char *group,
|
||||
unsigned long size, int links, int year,
|
||||
const char *month, int day, int hour,
|
||||
int minute);
|
||||
/**
|
||||
* ftpDataCallback:
|
||||
* @userData: the user provided context
|
||||
* @data: the data received
|
||||
* @len: its size in bytes
|
||||
*
|
||||
* A callback for the xmlNanoFTPGet command.
|
||||
*/
|
||||
typedef void (*ftpDataCallback) (void *userData,
|
||||
const char *data,
|
||||
int len);
|
||||
|
||||
/*
|
||||
* Init
|
||||
*/
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlNanoFTPInit (void);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlNanoFTPCleanup (void);
|
||||
|
||||
/*
|
||||
* Creating/freeing contexts.
|
||||
*/
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void *
|
||||
xmlNanoFTPNewCtxt (const char *URL);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlNanoFTPFreeCtxt (void * ctx);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void *
|
||||
xmlNanoFTPConnectTo (const char *server,
|
||||
int port);
|
||||
/*
|
||||
* Opening/closing session connections.
|
||||
*/
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void *
|
||||
xmlNanoFTPOpen (const char *URL);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlNanoFTPConnect (void *ctx);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlNanoFTPClose (void *ctx);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlNanoFTPQuit (void *ctx);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlNanoFTPScanProxy (const char *URL);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlNanoFTPProxy (const char *host,
|
||||
int port,
|
||||
const char *user,
|
||||
const char *passwd,
|
||||
int type);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlNanoFTPUpdateURL (void *ctx,
|
||||
const char *URL);
|
||||
|
||||
/*
|
||||
* Rather internal commands.
|
||||
*/
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlNanoFTPGetResponse (void *ctx);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlNanoFTPCheckResponse (void *ctx);
|
||||
|
||||
/*
|
||||
* CD/DIR/GET handlers.
|
||||
*/
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlNanoFTPCwd (void *ctx,
|
||||
const char *directory);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlNanoFTPDele (void *ctx,
|
||||
const char *file);
|
||||
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN SOCKET
|
||||
xmlNanoFTPGetConnection (void *ctx);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlNanoFTPCloseConnection(void *ctx);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlNanoFTPList (void *ctx,
|
||||
ftpListCallback callback,
|
||||
void *userData,
|
||||
const char *filename);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN SOCKET
|
||||
xmlNanoFTPGetSocket (void *ctx,
|
||||
const char *filename);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlNanoFTPGet (void *ctx,
|
||||
ftpDataCallback callback,
|
||||
void *userData,
|
||||
const char *filename);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlNanoFTPRead (void *ctx,
|
||||
void *dest,
|
||||
int len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* defined(LIBXML_FTP_ENABLED) || defined(LIBXML_LEGACY_ENABLED) */
|
||||
#endif /* __NANO_FTP_H__ */
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Summary: minimal HTTP implementation
|
||||
* Description: minimal HTTP implementation allowing to fetch resources
|
||||
* like external subset.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __NANO_HTTP_H__
|
||||
#define __NANO_HTTP_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#ifdef LIBXML_HTTP_ENABLED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlNanoHTTPInit (void);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlNanoHTTPCleanup (void);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlNanoHTTPScanProxy (const char *URL);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlNanoHTTPFetch (const char *URL,
|
||||
const char *filename,
|
||||
char **contentType);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void *
|
||||
xmlNanoHTTPMethod (const char *URL,
|
||||
const char *method,
|
||||
const char *input,
|
||||
char **contentType,
|
||||
const char *headers,
|
||||
int ilen);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void *
|
||||
xmlNanoHTTPMethodRedir (const char *URL,
|
||||
const char *method,
|
||||
const char *input,
|
||||
char **contentType,
|
||||
char **redir,
|
||||
const char *headers,
|
||||
int ilen);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void *
|
||||
xmlNanoHTTPOpen (const char *URL,
|
||||
char **contentType);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void *
|
||||
xmlNanoHTTPOpenRedir (const char *URL,
|
||||
char **contentType,
|
||||
char **redir);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlNanoHTTPReturnCode (void *ctx);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN const char *
|
||||
xmlNanoHTTPAuthHeader (void *ctx);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN const char *
|
||||
xmlNanoHTTPRedir (void *ctx);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlNanoHTTPContentLength( void * ctx );
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN const char *
|
||||
xmlNanoHTTPEncoding (void *ctx);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN const char *
|
||||
xmlNanoHTTPMimeType (void *ctx);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlNanoHTTPRead (void *ctx,
|
||||
void *dest,
|
||||
int len);
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlNanoHTTPSave (void *ctxt,
|
||||
const char *filename);
|
||||
#endif /* LIBXML_OUTPUT_ENABLED */
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlNanoHTTPClose (void *ctx);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_HTTP_ENABLED */
|
||||
#endif /* __NANO_HTTP_H__ */
|
||||
+1390
File diff suppressed because it is too large
Load Diff
+671
@@ -0,0 +1,671 @@
|
||||
/*
|
||||
* Summary: internals routines and limits exported by the parser.
|
||||
* Description: this module exports a number of internal parsing routines
|
||||
* they are not really all intended for applications but
|
||||
* can prove useful doing low level processing.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_PARSER_INTERNALS_H__
|
||||
#define __XML_PARSER_INTERNALS_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/HTMLparser.h>
|
||||
#include <libxml/chvalid.h>
|
||||
#include <libxml/SAX2.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* xmlParserMaxDepth:
|
||||
*
|
||||
* DEPRECATED: has no effect
|
||||
*
|
||||
* arbitrary depth limit for the XML documents that we allow to
|
||||
* process. This is not a limitation of the parser but a safety
|
||||
* boundary feature, use XML_PARSE_HUGE option to override it.
|
||||
*/
|
||||
XML_DEPRECATED
|
||||
XMLPUBVAR const unsigned int xmlParserMaxDepth;
|
||||
|
||||
/**
|
||||
* XML_MAX_TEXT_LENGTH:
|
||||
*
|
||||
* Maximum size allowed for a single text node when building a tree.
|
||||
* This is not a limitation of the parser but a safety boundary feature,
|
||||
* use XML_PARSE_HUGE option to override it.
|
||||
* Introduced in 2.9.0
|
||||
*/
|
||||
#define XML_MAX_TEXT_LENGTH 10000000
|
||||
|
||||
/**
|
||||
* XML_MAX_HUGE_LENGTH:
|
||||
*
|
||||
* Maximum size allowed when XML_PARSE_HUGE is set.
|
||||
*/
|
||||
#define XML_MAX_HUGE_LENGTH 1000000000
|
||||
|
||||
/**
|
||||
* XML_MAX_NAME_LENGTH:
|
||||
*
|
||||
* Maximum size allowed for a markup identifier.
|
||||
* This is not a limitation of the parser but a safety boundary feature,
|
||||
* use XML_PARSE_HUGE option to override it.
|
||||
* Note that with the use of parsing dictionaries overriding the limit
|
||||
* may result in more runtime memory usage in face of "unfriendly' content
|
||||
* Introduced in 2.9.0
|
||||
*/
|
||||
#define XML_MAX_NAME_LENGTH 50000
|
||||
|
||||
/**
|
||||
* XML_MAX_DICTIONARY_LIMIT:
|
||||
*
|
||||
* Maximum size allowed by the parser for a dictionary by default
|
||||
* This is not a limitation of the parser but a safety boundary feature,
|
||||
* use XML_PARSE_HUGE option to override it.
|
||||
* Introduced in 2.9.0
|
||||
*/
|
||||
#define XML_MAX_DICTIONARY_LIMIT 10000000
|
||||
|
||||
/**
|
||||
* XML_MAX_LOOKUP_LIMIT:
|
||||
*
|
||||
* Maximum size allowed by the parser for ahead lookup
|
||||
* This is an upper boundary enforced by the parser to avoid bad
|
||||
* behaviour on "unfriendly' content
|
||||
* Introduced in 2.9.0
|
||||
*/
|
||||
#define XML_MAX_LOOKUP_LIMIT 10000000
|
||||
|
||||
/**
|
||||
* XML_MAX_NAMELEN:
|
||||
*
|
||||
* Identifiers can be longer, but this will be more costly
|
||||
* at runtime.
|
||||
*/
|
||||
#define XML_MAX_NAMELEN 100
|
||||
|
||||
/**
|
||||
* INPUT_CHUNK:
|
||||
*
|
||||
* The parser tries to always have that amount of input ready.
|
||||
* One of the point is providing context when reporting errors.
|
||||
*/
|
||||
#define INPUT_CHUNK 250
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* UNICODE version of the macros. *
|
||||
* *
|
||||
************************************************************************/
|
||||
/**
|
||||
* IS_BYTE_CHAR:
|
||||
* @c: an byte value (int)
|
||||
*
|
||||
* Macro to check the following production in the XML spec:
|
||||
*
|
||||
* [2] Char ::= #x9 | #xA | #xD | [#x20...]
|
||||
* any byte character in the accepted range
|
||||
*/
|
||||
#define IS_BYTE_CHAR(c) xmlIsChar_ch(c)
|
||||
|
||||
/**
|
||||
* IS_CHAR:
|
||||
* @c: an UNICODE value (int)
|
||||
*
|
||||
* Macro to check the following production in the XML spec:
|
||||
*
|
||||
* [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD]
|
||||
* | [#x10000-#x10FFFF]
|
||||
* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
|
||||
*/
|
||||
#define IS_CHAR(c) xmlIsCharQ(c)
|
||||
|
||||
/**
|
||||
* IS_CHAR_CH:
|
||||
* @c: an xmlChar (usually an unsigned char)
|
||||
*
|
||||
* Behaves like IS_CHAR on single-byte value
|
||||
*/
|
||||
#define IS_CHAR_CH(c) xmlIsChar_ch(c)
|
||||
|
||||
/**
|
||||
* IS_BLANK:
|
||||
* @c: an UNICODE value (int)
|
||||
*
|
||||
* Macro to check the following production in the XML spec:
|
||||
*
|
||||
* [3] S ::= (#x20 | #x9 | #xD | #xA)+
|
||||
*/
|
||||
#define IS_BLANK(c) xmlIsBlankQ(c)
|
||||
|
||||
/**
|
||||
* IS_BLANK_CH:
|
||||
* @c: an xmlChar value (normally unsigned char)
|
||||
*
|
||||
* Behaviour same as IS_BLANK
|
||||
*/
|
||||
#define IS_BLANK_CH(c) xmlIsBlank_ch(c)
|
||||
|
||||
/**
|
||||
* IS_BASECHAR:
|
||||
* @c: an UNICODE value (int)
|
||||
*
|
||||
* Macro to check the following production in the XML spec:
|
||||
*
|
||||
* [85] BaseChar ::= ... long list see REC ...
|
||||
*/
|
||||
#define IS_BASECHAR(c) xmlIsBaseCharQ(c)
|
||||
|
||||
/**
|
||||
* IS_DIGIT:
|
||||
* @c: an UNICODE value (int)
|
||||
*
|
||||
* Macro to check the following production in the XML spec:
|
||||
*
|
||||
* [88] Digit ::= ... long list see REC ...
|
||||
*/
|
||||
#define IS_DIGIT(c) xmlIsDigitQ(c)
|
||||
|
||||
/**
|
||||
* IS_DIGIT_CH:
|
||||
* @c: an xmlChar value (usually an unsigned char)
|
||||
*
|
||||
* Behaves like IS_DIGIT but with a single byte argument
|
||||
*/
|
||||
#define IS_DIGIT_CH(c) xmlIsDigit_ch(c)
|
||||
|
||||
/**
|
||||
* IS_COMBINING:
|
||||
* @c: an UNICODE value (int)
|
||||
*
|
||||
* Macro to check the following production in the XML spec:
|
||||
*
|
||||
* [87] CombiningChar ::= ... long list see REC ...
|
||||
*/
|
||||
#define IS_COMBINING(c) xmlIsCombiningQ(c)
|
||||
|
||||
/**
|
||||
* IS_COMBINING_CH:
|
||||
* @c: an xmlChar (usually an unsigned char)
|
||||
*
|
||||
* Always false (all combining chars > 0xff)
|
||||
*/
|
||||
#define IS_COMBINING_CH(c) 0
|
||||
|
||||
/**
|
||||
* IS_EXTENDER:
|
||||
* @c: an UNICODE value (int)
|
||||
*
|
||||
* Macro to check the following production in the XML spec:
|
||||
*
|
||||
*
|
||||
* [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 |
|
||||
* #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] |
|
||||
* [#x309D-#x309E] | [#x30FC-#x30FE]
|
||||
*/
|
||||
#define IS_EXTENDER(c) xmlIsExtenderQ(c)
|
||||
|
||||
/**
|
||||
* IS_EXTENDER_CH:
|
||||
* @c: an xmlChar value (usually an unsigned char)
|
||||
*
|
||||
* Behaves like IS_EXTENDER but with a single-byte argument
|
||||
*/
|
||||
#define IS_EXTENDER_CH(c) xmlIsExtender_ch(c)
|
||||
|
||||
/**
|
||||
* IS_IDEOGRAPHIC:
|
||||
* @c: an UNICODE value (int)
|
||||
*
|
||||
* Macro to check the following production in the XML spec:
|
||||
*
|
||||
*
|
||||
* [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029]
|
||||
*/
|
||||
#define IS_IDEOGRAPHIC(c) xmlIsIdeographicQ(c)
|
||||
|
||||
/**
|
||||
* IS_LETTER:
|
||||
* @c: an UNICODE value (int)
|
||||
*
|
||||
* Macro to check the following production in the XML spec:
|
||||
*
|
||||
*
|
||||
* [84] Letter ::= BaseChar | Ideographic
|
||||
*/
|
||||
#define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c))
|
||||
|
||||
/**
|
||||
* IS_LETTER_CH:
|
||||
* @c: an xmlChar value (normally unsigned char)
|
||||
*
|
||||
* Macro behaves like IS_LETTER, but only check base chars
|
||||
*
|
||||
*/
|
||||
#define IS_LETTER_CH(c) xmlIsBaseChar_ch(c)
|
||||
|
||||
/**
|
||||
* IS_ASCII_LETTER:
|
||||
* @c: an xmlChar value
|
||||
*
|
||||
* Macro to check [a-zA-Z]
|
||||
*
|
||||
*/
|
||||
#define IS_ASCII_LETTER(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \
|
||||
((0x61 <= (c)) && ((c) <= 0x7a)))
|
||||
|
||||
/**
|
||||
* IS_ASCII_DIGIT:
|
||||
* @c: an xmlChar value
|
||||
*
|
||||
* Macro to check [0-9]
|
||||
*
|
||||
*/
|
||||
#define IS_ASCII_DIGIT(c) ((0x30 <= (c)) && ((c) <= 0x39))
|
||||
|
||||
/**
|
||||
* IS_PUBIDCHAR:
|
||||
* @c: an UNICODE value (int)
|
||||
*
|
||||
* Macro to check the following production in the XML spec:
|
||||
*
|
||||
*
|
||||
* [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
|
||||
*/
|
||||
#define IS_PUBIDCHAR(c) xmlIsPubidCharQ(c)
|
||||
|
||||
/**
|
||||
* IS_PUBIDCHAR_CH:
|
||||
* @c: an xmlChar value (normally unsigned char)
|
||||
*
|
||||
* Same as IS_PUBIDCHAR but for single-byte value
|
||||
*/
|
||||
#define IS_PUBIDCHAR_CH(c) xmlIsPubidChar_ch(c)
|
||||
|
||||
/**
|
||||
* Global variables used for predefined strings.
|
||||
*/
|
||||
XMLPUBVAR const xmlChar xmlStringText[];
|
||||
XMLPUBVAR const xmlChar xmlStringTextNoenc[];
|
||||
XMLPUBVAR const xmlChar xmlStringComment[];
|
||||
|
||||
/*
|
||||
* Function to finish the work of the macros where needed.
|
||||
*/
|
||||
XMLPUBFUN int xmlIsLetter (int c);
|
||||
|
||||
/**
|
||||
* Parser context.
|
||||
*/
|
||||
XMLPUBFUN xmlParserCtxtPtr
|
||||
xmlCreateFileParserCtxt (const char *filename);
|
||||
XMLPUBFUN xmlParserCtxtPtr
|
||||
xmlCreateURLParserCtxt (const char *filename,
|
||||
int options);
|
||||
XMLPUBFUN xmlParserCtxtPtr
|
||||
xmlCreateMemoryParserCtxt(const char *buffer,
|
||||
int size);
|
||||
XMLPUBFUN xmlParserCtxtPtr
|
||||
xmlCreateEntityParserCtxt(const xmlChar *URL,
|
||||
const xmlChar *ID,
|
||||
const xmlChar *base);
|
||||
XMLPUBFUN void
|
||||
xmlCtxtErrMemory (xmlParserCtxtPtr ctxt);
|
||||
XMLPUBFUN int
|
||||
xmlSwitchEncoding (xmlParserCtxtPtr ctxt,
|
||||
xmlCharEncoding enc);
|
||||
XMLPUBFUN int
|
||||
xmlSwitchEncodingName (xmlParserCtxtPtr ctxt,
|
||||
const char *encoding);
|
||||
XMLPUBFUN int
|
||||
xmlSwitchToEncoding (xmlParserCtxtPtr ctxt,
|
||||
xmlCharEncodingHandlerPtr handler);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlSwitchInputEncoding (xmlParserCtxtPtr ctxt,
|
||||
xmlParserInputPtr input,
|
||||
xmlCharEncodingHandlerPtr handler);
|
||||
|
||||
/**
|
||||
* Input Streams.
|
||||
*/
|
||||
XMLPUBFUN xmlParserInputPtr
|
||||
xmlNewStringInputStream (xmlParserCtxtPtr ctxt,
|
||||
const xmlChar *buffer);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlParserInputPtr
|
||||
xmlNewEntityInputStream (xmlParserCtxtPtr ctxt,
|
||||
xmlEntityPtr entity);
|
||||
XMLPUBFUN int
|
||||
xmlPushInput (xmlParserCtxtPtr ctxt,
|
||||
xmlParserInputPtr input);
|
||||
XMLPUBFUN xmlChar
|
||||
xmlPopInput (xmlParserCtxtPtr ctxt);
|
||||
XMLPUBFUN void
|
||||
xmlFreeInputStream (xmlParserInputPtr input);
|
||||
XMLPUBFUN xmlParserInputPtr
|
||||
xmlNewInputFromFile (xmlParserCtxtPtr ctxt,
|
||||
const char *filename);
|
||||
XMLPUBFUN xmlParserInputPtr
|
||||
xmlNewInputStream (xmlParserCtxtPtr ctxt);
|
||||
|
||||
/**
|
||||
* Namespaces.
|
||||
*/
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlSplitQName (xmlParserCtxtPtr ctxt,
|
||||
const xmlChar *name,
|
||||
xmlChar **prefix);
|
||||
|
||||
/**
|
||||
* Generic production rules.
|
||||
*/
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlParseName (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlParseNmtoken (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlParseEntityValue (xmlParserCtxtPtr ctxt,
|
||||
xmlChar **orig);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlParseAttValue (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlParseSystemLiteral (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlParsePubidLiteral (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlParseCharData (xmlParserCtxtPtr ctxt,
|
||||
int cdata);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlParseExternalID (xmlParserCtxtPtr ctxt,
|
||||
xmlChar **publicID,
|
||||
int strict);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlParseComment (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlParsePITarget (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlParsePI (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlParseNotationDecl (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlParseEntityDecl (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlParseDefaultDecl (xmlParserCtxtPtr ctxt,
|
||||
xmlChar **value);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlEnumerationPtr
|
||||
xmlParseNotationType (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlEnumerationPtr
|
||||
xmlParseEnumerationType (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlParseEnumeratedType (xmlParserCtxtPtr ctxt,
|
||||
xmlEnumerationPtr *tree);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlParseAttributeType (xmlParserCtxtPtr ctxt,
|
||||
xmlEnumerationPtr *tree);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlElementContentPtr
|
||||
xmlParseElementMixedContentDecl
|
||||
(xmlParserCtxtPtr ctxt,
|
||||
int inputchk);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlElementContentPtr
|
||||
xmlParseElementChildrenContentDecl
|
||||
(xmlParserCtxtPtr ctxt,
|
||||
int inputchk);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlParseElementContentDecl(xmlParserCtxtPtr ctxt,
|
||||
const xmlChar *name,
|
||||
xmlElementContentPtr *result);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlParseElementDecl (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlParseMarkupDecl (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlParseCharRef (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlEntityPtr
|
||||
xmlParseEntityRef (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlParseReference (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlParsePEReference (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt);
|
||||
#ifdef LIBXML_SAX1_ENABLED
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlParseAttribute (xmlParserCtxtPtr ctxt,
|
||||
xmlChar **value);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlParseStartTag (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlParseEndTag (xmlParserCtxtPtr ctxt);
|
||||
#endif /* LIBXML_SAX1_ENABLED */
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlParseCDSect (xmlParserCtxtPtr ctxt);
|
||||
XMLPUBFUN void
|
||||
xmlParseContent (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlParseElement (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlParseVersionNum (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlParseVersionInfo (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlParseEncName (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlParseEncodingDecl (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlParseSDDecl (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlParseXMLDecl (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlParseTextDecl (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlParseMisc (xmlParserCtxtPtr ctxt);
|
||||
XMLPUBFUN void
|
||||
xmlParseExternalSubset (xmlParserCtxtPtr ctxt,
|
||||
const xmlChar *ExternalID,
|
||||
const xmlChar *SystemID);
|
||||
/**
|
||||
* XML_SUBSTITUTE_NONE:
|
||||
*
|
||||
* If no entities need to be substituted.
|
||||
*/
|
||||
#define XML_SUBSTITUTE_NONE 0
|
||||
/**
|
||||
* XML_SUBSTITUTE_REF:
|
||||
*
|
||||
* Whether general entities need to be substituted.
|
||||
*/
|
||||
#define XML_SUBSTITUTE_REF 1
|
||||
/**
|
||||
* XML_SUBSTITUTE_PEREF:
|
||||
*
|
||||
* Whether parameter entities need to be substituted.
|
||||
*/
|
||||
#define XML_SUBSTITUTE_PEREF 2
|
||||
/**
|
||||
* XML_SUBSTITUTE_BOTH:
|
||||
*
|
||||
* Both general and parameter entities need to be substituted.
|
||||
*/
|
||||
#define XML_SUBSTITUTE_BOTH 3
|
||||
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlStringDecodeEntities (xmlParserCtxtPtr ctxt,
|
||||
const xmlChar *str,
|
||||
int what,
|
||||
xmlChar end,
|
||||
xmlChar end2,
|
||||
xmlChar end3);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlStringLenDecodeEntities (xmlParserCtxtPtr ctxt,
|
||||
const xmlChar *str,
|
||||
int len,
|
||||
int what,
|
||||
xmlChar end,
|
||||
xmlChar end2,
|
||||
xmlChar end3);
|
||||
|
||||
/*
|
||||
* Generated by MACROS on top of parser.c c.f. PUSH_AND_POP.
|
||||
*/
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int nodePush (xmlParserCtxtPtr ctxt,
|
||||
xmlNodePtr value);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlNodePtr nodePop (xmlParserCtxtPtr ctxt);
|
||||
XMLPUBFUN int inputPush (xmlParserCtxtPtr ctxt,
|
||||
xmlParserInputPtr value);
|
||||
XMLPUBFUN xmlParserInputPtr inputPop (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN const xmlChar * namePop (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int namePush (xmlParserCtxtPtr ctxt,
|
||||
const xmlChar *value);
|
||||
|
||||
/*
|
||||
* other commodities shared between parser.c and parserInternals.
|
||||
*/
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlSkipBlankChars (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlStringCurrentChar (xmlParserCtxtPtr ctxt,
|
||||
const xmlChar *cur,
|
||||
int *len);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void xmlParserHandlePEReference(xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlCheckLanguageID (const xmlChar *lang);
|
||||
|
||||
/*
|
||||
* Really core function shared with HTML parser.
|
||||
*/
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlCurrentChar (xmlParserCtxtPtr ctxt,
|
||||
int *len);
|
||||
XMLPUBFUN int xmlCopyCharMultiByte (xmlChar *out,
|
||||
int val);
|
||||
XMLPUBFUN int xmlCopyChar (int len,
|
||||
xmlChar *out,
|
||||
int val);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void xmlNextChar (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void xmlParserInputShrink (xmlParserInputPtr in);
|
||||
|
||||
/*
|
||||
* Specific function to keep track of entities references
|
||||
* and used by the XSLT debugger.
|
||||
*/
|
||||
#ifdef LIBXML_LEGACY_ENABLED
|
||||
/**
|
||||
* xmlEntityReferenceFunc:
|
||||
* @ent: the entity
|
||||
* @firstNode: the fist node in the chunk
|
||||
* @lastNode: the last nod in the chunk
|
||||
*
|
||||
* Callback function used when one needs to be able to track back the
|
||||
* provenance of a chunk of nodes inherited from an entity replacement.
|
||||
*/
|
||||
typedef void (*xmlEntityReferenceFunc) (xmlEntityPtr ent,
|
||||
xmlNodePtr firstNode,
|
||||
xmlNodePtr lastNode);
|
||||
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void xmlSetEntityReferenceFunc (xmlEntityReferenceFunc func);
|
||||
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlParseQuotedString (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlParseNamespace (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlNamespaceParseNSDef (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlScanName (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlNamespaceParseNCName (xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void xmlParserHandleReference(xmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlNamespaceParseQName (xmlParserCtxtPtr ctxt,
|
||||
xmlChar **prefix);
|
||||
/**
|
||||
* Entities
|
||||
*/
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlDecodeEntities (xmlParserCtxtPtr ctxt,
|
||||
int len,
|
||||
int what,
|
||||
xmlChar end,
|
||||
xmlChar end2,
|
||||
xmlChar end3);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlHandleEntity (xmlParserCtxtPtr ctxt,
|
||||
xmlEntityPtr entity);
|
||||
|
||||
#endif /* LIBXML_LEGACY_ENABLED */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __XML_PARSER_INTERNALS_H__ */
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Summary: pattern expression handling
|
||||
* Description: allows to compile and test pattern expressions for nodes
|
||||
* either in a tree or based on a parser state.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_PATTERN_H__
|
||||
#define __XML_PATTERN_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/dict.h>
|
||||
|
||||
#ifdef LIBXML_PATTERN_ENABLED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* xmlPattern:
|
||||
*
|
||||
* A compiled (XPath based) pattern to select nodes
|
||||
*/
|
||||
typedef struct _xmlPattern xmlPattern;
|
||||
typedef xmlPattern *xmlPatternPtr;
|
||||
|
||||
/**
|
||||
* xmlPatternFlags:
|
||||
*
|
||||
* This is the set of options affecting the behaviour of pattern
|
||||
* matching with this module
|
||||
*
|
||||
*/
|
||||
typedef enum {
|
||||
XML_PATTERN_DEFAULT = 0, /* simple pattern match */
|
||||
XML_PATTERN_XPATH = 1<<0, /* standard XPath pattern */
|
||||
XML_PATTERN_XSSEL = 1<<1, /* XPath subset for schema selector */
|
||||
XML_PATTERN_XSFIELD = 1<<2 /* XPath subset for schema field */
|
||||
} xmlPatternFlags;
|
||||
|
||||
XMLPUBFUN void
|
||||
xmlFreePattern (xmlPatternPtr comp);
|
||||
|
||||
XMLPUBFUN void
|
||||
xmlFreePatternList (xmlPatternPtr comp);
|
||||
|
||||
XMLPUBFUN xmlPatternPtr
|
||||
xmlPatterncompile (const xmlChar *pattern,
|
||||
xmlDict *dict,
|
||||
int flags,
|
||||
const xmlChar **namespaces);
|
||||
XMLPUBFUN int
|
||||
xmlPatternCompileSafe (const xmlChar *pattern,
|
||||
xmlDict *dict,
|
||||
int flags,
|
||||
const xmlChar **namespaces,
|
||||
xmlPatternPtr *patternOut);
|
||||
XMLPUBFUN int
|
||||
xmlPatternMatch (xmlPatternPtr comp,
|
||||
xmlNodePtr node);
|
||||
|
||||
/* streaming interfaces */
|
||||
typedef struct _xmlStreamCtxt xmlStreamCtxt;
|
||||
typedef xmlStreamCtxt *xmlStreamCtxtPtr;
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlPatternStreamable (xmlPatternPtr comp);
|
||||
XMLPUBFUN int
|
||||
xmlPatternMaxDepth (xmlPatternPtr comp);
|
||||
XMLPUBFUN int
|
||||
xmlPatternMinDepth (xmlPatternPtr comp);
|
||||
XMLPUBFUN int
|
||||
xmlPatternFromRoot (xmlPatternPtr comp);
|
||||
XMLPUBFUN xmlStreamCtxtPtr
|
||||
xmlPatternGetStreamCtxt (xmlPatternPtr comp);
|
||||
XMLPUBFUN void
|
||||
xmlFreeStreamCtxt (xmlStreamCtxtPtr stream);
|
||||
XMLPUBFUN int
|
||||
xmlStreamPushNode (xmlStreamCtxtPtr stream,
|
||||
const xmlChar *name,
|
||||
const xmlChar *ns,
|
||||
int nodeType);
|
||||
XMLPUBFUN int
|
||||
xmlStreamPush (xmlStreamCtxtPtr stream,
|
||||
const xmlChar *name,
|
||||
const xmlChar *ns);
|
||||
XMLPUBFUN int
|
||||
xmlStreamPushAttr (xmlStreamCtxtPtr stream,
|
||||
const xmlChar *name,
|
||||
const xmlChar *ns);
|
||||
XMLPUBFUN int
|
||||
xmlStreamPop (xmlStreamCtxtPtr stream);
|
||||
XMLPUBFUN int
|
||||
xmlStreamWantsAnyNode (xmlStreamCtxtPtr stream);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_PATTERN_ENABLED */
|
||||
|
||||
#endif /* __XML_PATTERN_H__ */
|
||||
+219
@@ -0,0 +1,219 @@
|
||||
/*
|
||||
* Summary: implementation of the Relax-NG validation
|
||||
* Description: implementation of the Relax-NG validation
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_RELAX_NG__
|
||||
#define __XML_RELAX_NG__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
#include <libxml/xmlerror.h>
|
||||
#include <libxml/xmlstring.h>
|
||||
#include <libxml/tree.h>
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _xmlRelaxNG xmlRelaxNG;
|
||||
typedef xmlRelaxNG *xmlRelaxNGPtr;
|
||||
|
||||
|
||||
/**
|
||||
* xmlRelaxNGValidityErrorFunc:
|
||||
* @ctx: the validation context
|
||||
* @msg: the message
|
||||
* @...: extra arguments
|
||||
*
|
||||
* Signature of an error callback from a Relax-NG validation
|
||||
*/
|
||||
typedef void (*xmlRelaxNGValidityErrorFunc) (void *ctx,
|
||||
const char *msg,
|
||||
...) LIBXML_ATTR_FORMAT(2,3);
|
||||
|
||||
/**
|
||||
* xmlRelaxNGValidityWarningFunc:
|
||||
* @ctx: the validation context
|
||||
* @msg: the message
|
||||
* @...: extra arguments
|
||||
*
|
||||
* Signature of a warning callback from a Relax-NG validation
|
||||
*/
|
||||
typedef void (*xmlRelaxNGValidityWarningFunc) (void *ctx,
|
||||
const char *msg,
|
||||
...) LIBXML_ATTR_FORMAT(2,3);
|
||||
|
||||
/**
|
||||
* A schemas validation context
|
||||
*/
|
||||
typedef struct _xmlRelaxNGParserCtxt xmlRelaxNGParserCtxt;
|
||||
typedef xmlRelaxNGParserCtxt *xmlRelaxNGParserCtxtPtr;
|
||||
|
||||
typedef struct _xmlRelaxNGValidCtxt xmlRelaxNGValidCtxt;
|
||||
typedef xmlRelaxNGValidCtxt *xmlRelaxNGValidCtxtPtr;
|
||||
|
||||
/*
|
||||
* xmlRelaxNGValidErr:
|
||||
*
|
||||
* List of possible Relax NG validation errors
|
||||
*/
|
||||
typedef enum {
|
||||
XML_RELAXNG_OK = 0,
|
||||
XML_RELAXNG_ERR_MEMORY,
|
||||
XML_RELAXNG_ERR_TYPE,
|
||||
XML_RELAXNG_ERR_TYPEVAL,
|
||||
XML_RELAXNG_ERR_DUPID,
|
||||
XML_RELAXNG_ERR_TYPECMP,
|
||||
XML_RELAXNG_ERR_NOSTATE,
|
||||
XML_RELAXNG_ERR_NODEFINE,
|
||||
XML_RELAXNG_ERR_LISTEXTRA,
|
||||
XML_RELAXNG_ERR_LISTEMPTY,
|
||||
XML_RELAXNG_ERR_INTERNODATA,
|
||||
XML_RELAXNG_ERR_INTERSEQ,
|
||||
XML_RELAXNG_ERR_INTEREXTRA,
|
||||
XML_RELAXNG_ERR_ELEMNAME,
|
||||
XML_RELAXNG_ERR_ATTRNAME,
|
||||
XML_RELAXNG_ERR_ELEMNONS,
|
||||
XML_RELAXNG_ERR_ATTRNONS,
|
||||
XML_RELAXNG_ERR_ELEMWRONGNS,
|
||||
XML_RELAXNG_ERR_ATTRWRONGNS,
|
||||
XML_RELAXNG_ERR_ELEMEXTRANS,
|
||||
XML_RELAXNG_ERR_ATTREXTRANS,
|
||||
XML_RELAXNG_ERR_ELEMNOTEMPTY,
|
||||
XML_RELAXNG_ERR_NOELEM,
|
||||
XML_RELAXNG_ERR_NOTELEM,
|
||||
XML_RELAXNG_ERR_ATTRVALID,
|
||||
XML_RELAXNG_ERR_CONTENTVALID,
|
||||
XML_RELAXNG_ERR_EXTRACONTENT,
|
||||
XML_RELAXNG_ERR_INVALIDATTR,
|
||||
XML_RELAXNG_ERR_DATAELEM,
|
||||
XML_RELAXNG_ERR_VALELEM,
|
||||
XML_RELAXNG_ERR_LISTELEM,
|
||||
XML_RELAXNG_ERR_DATATYPE,
|
||||
XML_RELAXNG_ERR_VALUE,
|
||||
XML_RELAXNG_ERR_LIST,
|
||||
XML_RELAXNG_ERR_NOGRAMMAR,
|
||||
XML_RELAXNG_ERR_EXTRADATA,
|
||||
XML_RELAXNG_ERR_LACKDATA,
|
||||
XML_RELAXNG_ERR_INTERNAL,
|
||||
XML_RELAXNG_ERR_ELEMWRONG,
|
||||
XML_RELAXNG_ERR_TEXTWRONG
|
||||
} xmlRelaxNGValidErr;
|
||||
|
||||
/*
|
||||
* xmlRelaxNGParserFlags:
|
||||
*
|
||||
* List of possible Relax NG Parser flags
|
||||
*/
|
||||
typedef enum {
|
||||
XML_RELAXNGP_NONE = 0,
|
||||
XML_RELAXNGP_FREE_DOC = 1,
|
||||
XML_RELAXNGP_CRNG = 2
|
||||
} xmlRelaxNGParserFlag;
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlRelaxNGInitTypes (void);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlRelaxNGCleanupTypes (void);
|
||||
|
||||
/*
|
||||
* Interfaces for parsing.
|
||||
*/
|
||||
XMLPUBFUN xmlRelaxNGParserCtxtPtr
|
||||
xmlRelaxNGNewParserCtxt (const char *URL);
|
||||
XMLPUBFUN xmlRelaxNGParserCtxtPtr
|
||||
xmlRelaxNGNewMemParserCtxt (const char *buffer,
|
||||
int size);
|
||||
XMLPUBFUN xmlRelaxNGParserCtxtPtr
|
||||
xmlRelaxNGNewDocParserCtxt (xmlDocPtr doc);
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlRelaxParserSetFlag (xmlRelaxNGParserCtxtPtr ctxt,
|
||||
int flag);
|
||||
|
||||
XMLPUBFUN void
|
||||
xmlRelaxNGFreeParserCtxt (xmlRelaxNGParserCtxtPtr ctxt);
|
||||
XMLPUBFUN void
|
||||
xmlRelaxNGSetParserErrors(xmlRelaxNGParserCtxtPtr ctxt,
|
||||
xmlRelaxNGValidityErrorFunc err,
|
||||
xmlRelaxNGValidityWarningFunc warn,
|
||||
void *ctx);
|
||||
XMLPUBFUN int
|
||||
xmlRelaxNGGetParserErrors(xmlRelaxNGParserCtxtPtr ctxt,
|
||||
xmlRelaxNGValidityErrorFunc *err,
|
||||
xmlRelaxNGValidityWarningFunc *warn,
|
||||
void **ctx);
|
||||
XMLPUBFUN void
|
||||
xmlRelaxNGSetParserStructuredErrors(
|
||||
xmlRelaxNGParserCtxtPtr ctxt,
|
||||
xmlStructuredErrorFunc serror,
|
||||
void *ctx);
|
||||
XMLPUBFUN xmlRelaxNGPtr
|
||||
xmlRelaxNGParse (xmlRelaxNGParserCtxtPtr ctxt);
|
||||
XMLPUBFUN void
|
||||
xmlRelaxNGFree (xmlRelaxNGPtr schema);
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
XMLPUBFUN void
|
||||
xmlRelaxNGDump (FILE *output,
|
||||
xmlRelaxNGPtr schema);
|
||||
XMLPUBFUN void
|
||||
xmlRelaxNGDumpTree (FILE * output,
|
||||
xmlRelaxNGPtr schema);
|
||||
#endif /* LIBXML_OUTPUT_ENABLED */
|
||||
/*
|
||||
* Interfaces for validating
|
||||
*/
|
||||
XMLPUBFUN void
|
||||
xmlRelaxNGSetValidErrors(xmlRelaxNGValidCtxtPtr ctxt,
|
||||
xmlRelaxNGValidityErrorFunc err,
|
||||
xmlRelaxNGValidityWarningFunc warn,
|
||||
void *ctx);
|
||||
XMLPUBFUN int
|
||||
xmlRelaxNGGetValidErrors(xmlRelaxNGValidCtxtPtr ctxt,
|
||||
xmlRelaxNGValidityErrorFunc *err,
|
||||
xmlRelaxNGValidityWarningFunc *warn,
|
||||
void **ctx);
|
||||
XMLPUBFUN void
|
||||
xmlRelaxNGSetValidStructuredErrors(xmlRelaxNGValidCtxtPtr ctxt,
|
||||
xmlStructuredErrorFunc serror, void *ctx);
|
||||
XMLPUBFUN xmlRelaxNGValidCtxtPtr
|
||||
xmlRelaxNGNewValidCtxt (xmlRelaxNGPtr schema);
|
||||
XMLPUBFUN void
|
||||
xmlRelaxNGFreeValidCtxt (xmlRelaxNGValidCtxtPtr ctxt);
|
||||
XMLPUBFUN int
|
||||
xmlRelaxNGValidateDoc (xmlRelaxNGValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc);
|
||||
/*
|
||||
* Interfaces for progressive validation when possible
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlRelaxNGValidatePushElement (xmlRelaxNGValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr elem);
|
||||
XMLPUBFUN int
|
||||
xmlRelaxNGValidatePushCData (xmlRelaxNGValidCtxtPtr ctxt,
|
||||
const xmlChar *data,
|
||||
int len);
|
||||
XMLPUBFUN int
|
||||
xmlRelaxNGValidatePopElement (xmlRelaxNGValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr elem);
|
||||
XMLPUBFUN int
|
||||
xmlRelaxNGValidateFullElement (xmlRelaxNGValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr elem);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_SCHEMAS_ENABLED */
|
||||
|
||||
#endif /* __XML_RELAX_NG__ */
|
||||
+959
@@ -0,0 +1,959 @@
|
||||
/*
|
||||
* Summary: internal interfaces for XML Schemas
|
||||
* Description: internal interfaces for the XML Schemas handling
|
||||
* and schema validity checking
|
||||
* The Schemas development is a Work In Progress.
|
||||
* Some of those interfaces are not guaranteed to be API or ABI stable !
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __XML_SCHEMA_INTERNALS_H__
|
||||
#define __XML_SCHEMA_INTERNALS_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
|
||||
#include <libxml/xmlregexp.h>
|
||||
#include <libxml/hash.h>
|
||||
#include <libxml/dict.h>
|
||||
#include <libxml/tree.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
XML_SCHEMAS_UNKNOWN = 0,
|
||||
XML_SCHEMAS_STRING = 1,
|
||||
XML_SCHEMAS_NORMSTRING = 2,
|
||||
XML_SCHEMAS_DECIMAL = 3,
|
||||
XML_SCHEMAS_TIME = 4,
|
||||
XML_SCHEMAS_GDAY = 5,
|
||||
XML_SCHEMAS_GMONTH = 6,
|
||||
XML_SCHEMAS_GMONTHDAY = 7,
|
||||
XML_SCHEMAS_GYEAR = 8,
|
||||
XML_SCHEMAS_GYEARMONTH = 9,
|
||||
XML_SCHEMAS_DATE = 10,
|
||||
XML_SCHEMAS_DATETIME = 11,
|
||||
XML_SCHEMAS_DURATION = 12,
|
||||
XML_SCHEMAS_FLOAT = 13,
|
||||
XML_SCHEMAS_DOUBLE = 14,
|
||||
XML_SCHEMAS_BOOLEAN = 15,
|
||||
XML_SCHEMAS_TOKEN = 16,
|
||||
XML_SCHEMAS_LANGUAGE = 17,
|
||||
XML_SCHEMAS_NMTOKEN = 18,
|
||||
XML_SCHEMAS_NMTOKENS = 19,
|
||||
XML_SCHEMAS_NAME = 20,
|
||||
XML_SCHEMAS_QNAME = 21,
|
||||
XML_SCHEMAS_NCNAME = 22,
|
||||
XML_SCHEMAS_ID = 23,
|
||||
XML_SCHEMAS_IDREF = 24,
|
||||
XML_SCHEMAS_IDREFS = 25,
|
||||
XML_SCHEMAS_ENTITY = 26,
|
||||
XML_SCHEMAS_ENTITIES = 27,
|
||||
XML_SCHEMAS_NOTATION = 28,
|
||||
XML_SCHEMAS_ANYURI = 29,
|
||||
XML_SCHEMAS_INTEGER = 30,
|
||||
XML_SCHEMAS_NPINTEGER = 31,
|
||||
XML_SCHEMAS_NINTEGER = 32,
|
||||
XML_SCHEMAS_NNINTEGER = 33,
|
||||
XML_SCHEMAS_PINTEGER = 34,
|
||||
XML_SCHEMAS_INT = 35,
|
||||
XML_SCHEMAS_UINT = 36,
|
||||
XML_SCHEMAS_LONG = 37,
|
||||
XML_SCHEMAS_ULONG = 38,
|
||||
XML_SCHEMAS_SHORT = 39,
|
||||
XML_SCHEMAS_USHORT = 40,
|
||||
XML_SCHEMAS_BYTE = 41,
|
||||
XML_SCHEMAS_UBYTE = 42,
|
||||
XML_SCHEMAS_HEXBINARY = 43,
|
||||
XML_SCHEMAS_BASE64BINARY = 44,
|
||||
XML_SCHEMAS_ANYTYPE = 45,
|
||||
XML_SCHEMAS_ANYSIMPLETYPE = 46
|
||||
} xmlSchemaValType;
|
||||
|
||||
/*
|
||||
* XML Schemas defines multiple type of types.
|
||||
*/
|
||||
typedef enum {
|
||||
XML_SCHEMA_TYPE_BASIC = 1, /* A built-in datatype */
|
||||
XML_SCHEMA_TYPE_ANY,
|
||||
XML_SCHEMA_TYPE_FACET,
|
||||
XML_SCHEMA_TYPE_SIMPLE,
|
||||
XML_SCHEMA_TYPE_COMPLEX,
|
||||
XML_SCHEMA_TYPE_SEQUENCE = 6,
|
||||
XML_SCHEMA_TYPE_CHOICE,
|
||||
XML_SCHEMA_TYPE_ALL,
|
||||
XML_SCHEMA_TYPE_SIMPLE_CONTENT,
|
||||
XML_SCHEMA_TYPE_COMPLEX_CONTENT,
|
||||
XML_SCHEMA_TYPE_UR,
|
||||
XML_SCHEMA_TYPE_RESTRICTION,
|
||||
XML_SCHEMA_TYPE_EXTENSION,
|
||||
XML_SCHEMA_TYPE_ELEMENT,
|
||||
XML_SCHEMA_TYPE_ATTRIBUTE,
|
||||
XML_SCHEMA_TYPE_ATTRIBUTEGROUP,
|
||||
XML_SCHEMA_TYPE_GROUP,
|
||||
XML_SCHEMA_TYPE_NOTATION,
|
||||
XML_SCHEMA_TYPE_LIST,
|
||||
XML_SCHEMA_TYPE_UNION,
|
||||
XML_SCHEMA_TYPE_ANY_ATTRIBUTE,
|
||||
XML_SCHEMA_TYPE_IDC_UNIQUE,
|
||||
XML_SCHEMA_TYPE_IDC_KEY,
|
||||
XML_SCHEMA_TYPE_IDC_KEYREF,
|
||||
XML_SCHEMA_TYPE_PARTICLE = 25,
|
||||
XML_SCHEMA_TYPE_ATTRIBUTE_USE,
|
||||
XML_SCHEMA_FACET_MININCLUSIVE = 1000,
|
||||
XML_SCHEMA_FACET_MINEXCLUSIVE,
|
||||
XML_SCHEMA_FACET_MAXINCLUSIVE,
|
||||
XML_SCHEMA_FACET_MAXEXCLUSIVE,
|
||||
XML_SCHEMA_FACET_TOTALDIGITS,
|
||||
XML_SCHEMA_FACET_FRACTIONDIGITS,
|
||||
XML_SCHEMA_FACET_PATTERN,
|
||||
XML_SCHEMA_FACET_ENUMERATION,
|
||||
XML_SCHEMA_FACET_WHITESPACE,
|
||||
XML_SCHEMA_FACET_LENGTH,
|
||||
XML_SCHEMA_FACET_MAXLENGTH,
|
||||
XML_SCHEMA_FACET_MINLENGTH,
|
||||
XML_SCHEMA_EXTRA_QNAMEREF = 2000,
|
||||
XML_SCHEMA_EXTRA_ATTR_USE_PROHIB
|
||||
} xmlSchemaTypeType;
|
||||
|
||||
typedef enum {
|
||||
XML_SCHEMA_CONTENT_UNKNOWN = 0,
|
||||
XML_SCHEMA_CONTENT_EMPTY = 1,
|
||||
XML_SCHEMA_CONTENT_ELEMENTS,
|
||||
XML_SCHEMA_CONTENT_MIXED,
|
||||
XML_SCHEMA_CONTENT_SIMPLE,
|
||||
XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS, /* Obsolete */
|
||||
XML_SCHEMA_CONTENT_BASIC,
|
||||
XML_SCHEMA_CONTENT_ANY
|
||||
} xmlSchemaContentType;
|
||||
|
||||
typedef struct _xmlSchemaVal xmlSchemaVal;
|
||||
typedef xmlSchemaVal *xmlSchemaValPtr;
|
||||
|
||||
typedef struct _xmlSchemaType xmlSchemaType;
|
||||
typedef xmlSchemaType *xmlSchemaTypePtr;
|
||||
|
||||
typedef struct _xmlSchemaFacet xmlSchemaFacet;
|
||||
typedef xmlSchemaFacet *xmlSchemaFacetPtr;
|
||||
|
||||
/**
|
||||
* Annotation
|
||||
*/
|
||||
typedef struct _xmlSchemaAnnot xmlSchemaAnnot;
|
||||
typedef xmlSchemaAnnot *xmlSchemaAnnotPtr;
|
||||
struct _xmlSchemaAnnot {
|
||||
struct _xmlSchemaAnnot *next;
|
||||
xmlNodePtr content; /* the annotation */
|
||||
};
|
||||
|
||||
/**
|
||||
* XML_SCHEMAS_ANYATTR_SKIP:
|
||||
*
|
||||
* Skip unknown attribute from validation
|
||||
* Obsolete, not used anymore.
|
||||
*/
|
||||
#define XML_SCHEMAS_ANYATTR_SKIP 1
|
||||
/**
|
||||
* XML_SCHEMAS_ANYATTR_LAX:
|
||||
*
|
||||
* Ignore validation non definition on attributes
|
||||
* Obsolete, not used anymore.
|
||||
*/
|
||||
#define XML_SCHEMAS_ANYATTR_LAX 2
|
||||
/**
|
||||
* XML_SCHEMAS_ANYATTR_STRICT:
|
||||
*
|
||||
* Apply strict validation rules on attributes
|
||||
* Obsolete, not used anymore.
|
||||
*/
|
||||
#define XML_SCHEMAS_ANYATTR_STRICT 3
|
||||
/**
|
||||
* XML_SCHEMAS_ANY_SKIP:
|
||||
*
|
||||
* Skip unknown attribute from validation
|
||||
*/
|
||||
#define XML_SCHEMAS_ANY_SKIP 1
|
||||
/**
|
||||
* XML_SCHEMAS_ANY_LAX:
|
||||
*
|
||||
* Used by wildcards.
|
||||
* Validate if type found, don't worry if not found
|
||||
*/
|
||||
#define XML_SCHEMAS_ANY_LAX 2
|
||||
/**
|
||||
* XML_SCHEMAS_ANY_STRICT:
|
||||
*
|
||||
* Used by wildcards.
|
||||
* Apply strict validation rules
|
||||
*/
|
||||
#define XML_SCHEMAS_ANY_STRICT 3
|
||||
/**
|
||||
* XML_SCHEMAS_ATTR_USE_PROHIBITED:
|
||||
*
|
||||
* Used by wildcards.
|
||||
* The attribute is prohibited.
|
||||
*/
|
||||
#define XML_SCHEMAS_ATTR_USE_PROHIBITED 0
|
||||
/**
|
||||
* XML_SCHEMAS_ATTR_USE_REQUIRED:
|
||||
*
|
||||
* The attribute is required.
|
||||
*/
|
||||
#define XML_SCHEMAS_ATTR_USE_REQUIRED 1
|
||||
/**
|
||||
* XML_SCHEMAS_ATTR_USE_OPTIONAL:
|
||||
*
|
||||
* The attribute is optional.
|
||||
*/
|
||||
#define XML_SCHEMAS_ATTR_USE_OPTIONAL 2
|
||||
/**
|
||||
* XML_SCHEMAS_ATTR_GLOBAL:
|
||||
*
|
||||
* allow elements in no namespace
|
||||
*/
|
||||
#define XML_SCHEMAS_ATTR_GLOBAL 1 << 0
|
||||
/**
|
||||
* XML_SCHEMAS_ATTR_NSDEFAULT:
|
||||
*
|
||||
* allow elements in no namespace
|
||||
*/
|
||||
#define XML_SCHEMAS_ATTR_NSDEFAULT 1 << 7
|
||||
/**
|
||||
* XML_SCHEMAS_ATTR_INTERNAL_RESOLVED:
|
||||
*
|
||||
* this is set when the "type" and "ref" references
|
||||
* have been resolved.
|
||||
*/
|
||||
#define XML_SCHEMAS_ATTR_INTERNAL_RESOLVED 1 << 8
|
||||
/**
|
||||
* XML_SCHEMAS_ATTR_FIXED:
|
||||
*
|
||||
* the attribute has a fixed value
|
||||
*/
|
||||
#define XML_SCHEMAS_ATTR_FIXED 1 << 9
|
||||
|
||||
/**
|
||||
* xmlSchemaAttribute:
|
||||
* An attribute definition.
|
||||
*/
|
||||
|
||||
typedef struct _xmlSchemaAttribute xmlSchemaAttribute;
|
||||
typedef xmlSchemaAttribute *xmlSchemaAttributePtr;
|
||||
struct _xmlSchemaAttribute {
|
||||
xmlSchemaTypeType type;
|
||||
struct _xmlSchemaAttribute *next; /* the next attribute (not used?) */
|
||||
const xmlChar *name; /* the name of the declaration */
|
||||
const xmlChar *id; /* Deprecated; not used */
|
||||
const xmlChar *ref; /* Deprecated; not used */
|
||||
const xmlChar *refNs; /* Deprecated; not used */
|
||||
const xmlChar *typeName; /* the local name of the type definition */
|
||||
const xmlChar *typeNs; /* the ns URI of the type definition */
|
||||
xmlSchemaAnnotPtr annot;
|
||||
|
||||
xmlSchemaTypePtr base; /* Deprecated; not used */
|
||||
int occurs; /* Deprecated; not used */
|
||||
const xmlChar *defValue; /* The initial value of the value constraint */
|
||||
xmlSchemaTypePtr subtypes; /* the type definition */
|
||||
xmlNodePtr node;
|
||||
const xmlChar *targetNamespace;
|
||||
int flags;
|
||||
const xmlChar *refPrefix; /* Deprecated; not used */
|
||||
xmlSchemaValPtr defVal; /* The compiled value constraint */
|
||||
xmlSchemaAttributePtr refDecl; /* Deprecated; not used */
|
||||
};
|
||||
|
||||
/**
|
||||
* xmlSchemaAttributeLink:
|
||||
* Used to build a list of attribute uses on complexType definitions.
|
||||
* WARNING: Deprecated; not used.
|
||||
*/
|
||||
typedef struct _xmlSchemaAttributeLink xmlSchemaAttributeLink;
|
||||
typedef xmlSchemaAttributeLink *xmlSchemaAttributeLinkPtr;
|
||||
struct _xmlSchemaAttributeLink {
|
||||
struct _xmlSchemaAttributeLink *next;/* the next attribute link ... */
|
||||
struct _xmlSchemaAttribute *attr;/* the linked attribute */
|
||||
};
|
||||
|
||||
/**
|
||||
* XML_SCHEMAS_WILDCARD_COMPLETE:
|
||||
*
|
||||
* If the wildcard is complete.
|
||||
*/
|
||||
#define XML_SCHEMAS_WILDCARD_COMPLETE 1 << 0
|
||||
|
||||
/**
|
||||
* xmlSchemaCharValueLink:
|
||||
* Used to build a list of namespaces on wildcards.
|
||||
*/
|
||||
typedef struct _xmlSchemaWildcardNs xmlSchemaWildcardNs;
|
||||
typedef xmlSchemaWildcardNs *xmlSchemaWildcardNsPtr;
|
||||
struct _xmlSchemaWildcardNs {
|
||||
struct _xmlSchemaWildcardNs *next;/* the next constraint link ... */
|
||||
const xmlChar *value;/* the value */
|
||||
};
|
||||
|
||||
/**
|
||||
* xmlSchemaWildcard.
|
||||
* A wildcard.
|
||||
*/
|
||||
typedef struct _xmlSchemaWildcard xmlSchemaWildcard;
|
||||
typedef xmlSchemaWildcard *xmlSchemaWildcardPtr;
|
||||
struct _xmlSchemaWildcard {
|
||||
xmlSchemaTypeType type; /* The kind of type */
|
||||
const xmlChar *id; /* Deprecated; not used */
|
||||
xmlSchemaAnnotPtr annot;
|
||||
xmlNodePtr node;
|
||||
int minOccurs; /* Deprecated; not used */
|
||||
int maxOccurs; /* Deprecated; not used */
|
||||
int processContents;
|
||||
int any; /* Indicates if the ns constraint is of ##any */
|
||||
xmlSchemaWildcardNsPtr nsSet; /* The list of allowed namespaces */
|
||||
xmlSchemaWildcardNsPtr negNsSet; /* The negated namespace */
|
||||
int flags;
|
||||
};
|
||||
|
||||
/**
|
||||
* XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED:
|
||||
*
|
||||
* The attribute wildcard has been built.
|
||||
*/
|
||||
#define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED 1 << 0
|
||||
/**
|
||||
* XML_SCHEMAS_ATTRGROUP_GLOBAL:
|
||||
*
|
||||
* The attribute group has been defined.
|
||||
*/
|
||||
#define XML_SCHEMAS_ATTRGROUP_GLOBAL 1 << 1
|
||||
/**
|
||||
* XML_SCHEMAS_ATTRGROUP_MARKED:
|
||||
*
|
||||
* Marks the attr group as marked; used for circular checks.
|
||||
*/
|
||||
#define XML_SCHEMAS_ATTRGROUP_MARKED 1 << 2
|
||||
|
||||
/**
|
||||
* XML_SCHEMAS_ATTRGROUP_REDEFINED:
|
||||
*
|
||||
* The attr group was redefined.
|
||||
*/
|
||||
#define XML_SCHEMAS_ATTRGROUP_REDEFINED 1 << 3
|
||||
/**
|
||||
* XML_SCHEMAS_ATTRGROUP_HAS_REFS:
|
||||
*
|
||||
* Whether this attr. group contains attr. group references.
|
||||
*/
|
||||
#define XML_SCHEMAS_ATTRGROUP_HAS_REFS 1 << 4
|
||||
|
||||
/**
|
||||
* An attribute group definition.
|
||||
*
|
||||
* xmlSchemaAttribute and xmlSchemaAttributeGroup start of structures
|
||||
* must be kept similar
|
||||
*/
|
||||
typedef struct _xmlSchemaAttributeGroup xmlSchemaAttributeGroup;
|
||||
typedef xmlSchemaAttributeGroup *xmlSchemaAttributeGroupPtr;
|
||||
struct _xmlSchemaAttributeGroup {
|
||||
xmlSchemaTypeType type; /* The kind of type */
|
||||
struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */
|
||||
const xmlChar *name;
|
||||
const xmlChar *id;
|
||||
const xmlChar *ref; /* Deprecated; not used */
|
||||
const xmlChar *refNs; /* Deprecated; not used */
|
||||
xmlSchemaAnnotPtr annot;
|
||||
|
||||
xmlSchemaAttributePtr attributes; /* Deprecated; not used */
|
||||
xmlNodePtr node;
|
||||
int flags;
|
||||
xmlSchemaWildcardPtr attributeWildcard;
|
||||
const xmlChar *refPrefix; /* Deprecated; not used */
|
||||
xmlSchemaAttributeGroupPtr refItem; /* Deprecated; not used */
|
||||
const xmlChar *targetNamespace;
|
||||
void *attrUses;
|
||||
};
|
||||
|
||||
/**
|
||||
* xmlSchemaTypeLink:
|
||||
* Used to build a list of types (e.g. member types of
|
||||
* simpleType with variety "union").
|
||||
*/
|
||||
typedef struct _xmlSchemaTypeLink xmlSchemaTypeLink;
|
||||
typedef xmlSchemaTypeLink *xmlSchemaTypeLinkPtr;
|
||||
struct _xmlSchemaTypeLink {
|
||||
struct _xmlSchemaTypeLink *next;/* the next type link ... */
|
||||
xmlSchemaTypePtr type;/* the linked type */
|
||||
};
|
||||
|
||||
/**
|
||||
* xmlSchemaFacetLink:
|
||||
* Used to build a list of facets.
|
||||
*/
|
||||
typedef struct _xmlSchemaFacetLink xmlSchemaFacetLink;
|
||||
typedef xmlSchemaFacetLink *xmlSchemaFacetLinkPtr;
|
||||
struct _xmlSchemaFacetLink {
|
||||
struct _xmlSchemaFacetLink *next;/* the next facet link ... */
|
||||
xmlSchemaFacetPtr facet;/* the linked facet */
|
||||
};
|
||||
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_MIXED:
|
||||
*
|
||||
* the element content type is mixed
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_MIXED 1 << 0
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION:
|
||||
*
|
||||
* the simple or complex type has a derivation method of "extension".
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION 1 << 1
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION:
|
||||
*
|
||||
* the simple or complex type has a derivation method of "restriction".
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION 1 << 2
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_GLOBAL:
|
||||
*
|
||||
* the type is global
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_GLOBAL 1 << 3
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD:
|
||||
*
|
||||
* the complexType owns an attribute wildcard, i.e.
|
||||
* it can be freed by the complexType
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD 1 << 4 /* Obsolete. */
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_VARIETY_ABSENT:
|
||||
*
|
||||
* the simpleType has a variety of "absent".
|
||||
* TODO: Actually not necessary :-/, since if
|
||||
* none of the variety flags occur then it's
|
||||
* automatically absent.
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_VARIETY_ABSENT 1 << 5
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_VARIETY_LIST:
|
||||
*
|
||||
* the simpleType has a variety of "list".
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_VARIETY_LIST 1 << 6
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_VARIETY_UNION:
|
||||
*
|
||||
* the simpleType has a variety of "union".
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_VARIETY_UNION 1 << 7
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_VARIETY_ATOMIC:
|
||||
*
|
||||
* the simpleType has a variety of "union".
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_VARIETY_ATOMIC 1 << 8
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_FINAL_EXTENSION:
|
||||
*
|
||||
* the complexType has a final of "extension".
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_FINAL_EXTENSION 1 << 9
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_FINAL_RESTRICTION:
|
||||
*
|
||||
* the simpleType/complexType has a final of "restriction".
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_FINAL_RESTRICTION 1 << 10
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_FINAL_LIST:
|
||||
*
|
||||
* the simpleType has a final of "list".
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_FINAL_LIST 1 << 11
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_FINAL_UNION:
|
||||
*
|
||||
* the simpleType has a final of "union".
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_FINAL_UNION 1 << 12
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_FINAL_DEFAULT:
|
||||
*
|
||||
* the simpleType has a final of "default".
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_FINAL_DEFAULT 1 << 13
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE:
|
||||
*
|
||||
* Marks the item as a builtin primitive.
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE 1 << 14
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_MARKED:
|
||||
*
|
||||
* Marks the item as marked; used for circular checks.
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_MARKED 1 << 16
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_BLOCK_DEFAULT:
|
||||
*
|
||||
* the complexType did not specify 'block' so use the default of the
|
||||
* <schema> item.
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_BLOCK_DEFAULT 1 << 17
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_BLOCK_EXTENSION:
|
||||
*
|
||||
* the complexType has a 'block' of "extension".
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_BLOCK_EXTENSION 1 << 18
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_BLOCK_RESTRICTION:
|
||||
*
|
||||
* the complexType has a 'block' of "restriction".
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_BLOCK_RESTRICTION 1 << 19
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_ABSTRACT:
|
||||
*
|
||||
* the simple/complexType is abstract.
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_ABSTRACT 1 << 20
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_FACETSNEEDVALUE:
|
||||
*
|
||||
* indicates if the facets need a computed value
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_FACETSNEEDVALUE 1 << 21
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_INTERNAL_RESOLVED:
|
||||
*
|
||||
* indicates that the type was typefixed
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_INTERNAL_RESOLVED 1 << 22
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_INTERNAL_INVALID:
|
||||
*
|
||||
* indicates that the type is invalid
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_INTERNAL_INVALID 1 << 23
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE:
|
||||
*
|
||||
* a whitespace-facet value of "preserve"
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE 1 << 24
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_WHITESPACE_REPLACE:
|
||||
*
|
||||
* a whitespace-facet value of "replace"
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_WHITESPACE_REPLACE 1 << 25
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE:
|
||||
*
|
||||
* a whitespace-facet value of "collapse"
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE 1 << 26
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_HAS_FACETS:
|
||||
*
|
||||
* has facets
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_HAS_FACETS 1 << 27
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_NORMVALUENEEDED:
|
||||
*
|
||||
* indicates if the facets (pattern) need a normalized value
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_NORMVALUENEEDED 1 << 28
|
||||
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_FIXUP_1:
|
||||
*
|
||||
* First stage of fixup was done.
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_FIXUP_1 1 << 29
|
||||
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_REDEFINED:
|
||||
*
|
||||
* The type was redefined.
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_REDEFINED 1 << 30
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_REDEFINING:
|
||||
*
|
||||
* The type redefines an other type.
|
||||
*/
|
||||
/* #define XML_SCHEMAS_TYPE_REDEFINING 1 << 31 */
|
||||
|
||||
/**
|
||||
* _xmlSchemaType:
|
||||
*
|
||||
* Schemas type definition.
|
||||
*/
|
||||
struct _xmlSchemaType {
|
||||
xmlSchemaTypeType type; /* The kind of type */
|
||||
struct _xmlSchemaType *next; /* the next type if in a sequence ... */
|
||||
const xmlChar *name;
|
||||
const xmlChar *id ; /* Deprecated; not used */
|
||||
const xmlChar *ref; /* Deprecated; not used */
|
||||
const xmlChar *refNs; /* Deprecated; not used */
|
||||
xmlSchemaAnnotPtr annot;
|
||||
xmlSchemaTypePtr subtypes;
|
||||
xmlSchemaAttributePtr attributes; /* Deprecated; not used */
|
||||
xmlNodePtr node;
|
||||
int minOccurs; /* Deprecated; not used */
|
||||
int maxOccurs; /* Deprecated; not used */
|
||||
|
||||
int flags;
|
||||
xmlSchemaContentType contentType;
|
||||
const xmlChar *base; /* Base type's local name */
|
||||
const xmlChar *baseNs; /* Base type's target namespace */
|
||||
xmlSchemaTypePtr baseType; /* The base type component */
|
||||
xmlSchemaFacetPtr facets; /* Local facets */
|
||||
struct _xmlSchemaType *redef; /* Deprecated; not used */
|
||||
int recurse; /* Obsolete */
|
||||
xmlSchemaAttributeLinkPtr *attributeUses; /* Deprecated; not used */
|
||||
xmlSchemaWildcardPtr attributeWildcard;
|
||||
int builtInType; /* Type of built-in types. */
|
||||
xmlSchemaTypeLinkPtr memberTypes; /* member-types if a union type. */
|
||||
xmlSchemaFacetLinkPtr facetSet; /* All facets (incl. inherited) */
|
||||
const xmlChar *refPrefix; /* Deprecated; not used */
|
||||
xmlSchemaTypePtr contentTypeDef; /* Used for the simple content of complex types.
|
||||
Could we use @subtypes for this? */
|
||||
xmlRegexpPtr contModel; /* Holds the automaton of the content model */
|
||||
const xmlChar *targetNamespace;
|
||||
void *attrUses;
|
||||
};
|
||||
|
||||
/*
|
||||
* xmlSchemaElement:
|
||||
* An element definition.
|
||||
*
|
||||
* xmlSchemaType, xmlSchemaFacet and xmlSchemaElement start of
|
||||
* structures must be kept similar
|
||||
*/
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_NILLABLE:
|
||||
*
|
||||
* the element is nillable
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_NILLABLE 1 << 0
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_GLOBAL:
|
||||
*
|
||||
* the element is global
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_GLOBAL 1 << 1
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_DEFAULT:
|
||||
*
|
||||
* the element has a default value
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_DEFAULT 1 << 2
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_FIXED:
|
||||
*
|
||||
* the element has a fixed value
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_FIXED 1 << 3
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_ABSTRACT:
|
||||
*
|
||||
* the element is abstract
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_ABSTRACT 1 << 4
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_TOPLEVEL:
|
||||
*
|
||||
* the element is top level
|
||||
* obsolete: use XML_SCHEMAS_ELEM_GLOBAL instead
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_TOPLEVEL 1 << 5
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_REF:
|
||||
*
|
||||
* the element is a reference to a type
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_REF 1 << 6
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_NSDEFAULT:
|
||||
*
|
||||
* allow elements in no namespace
|
||||
* Obsolete, not used anymore.
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_NSDEFAULT 1 << 7
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_INTERNAL_RESOLVED:
|
||||
*
|
||||
* this is set when "type", "ref", "substitutionGroup"
|
||||
* references have been resolved.
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_INTERNAL_RESOLVED 1 << 8
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_CIRCULAR:
|
||||
*
|
||||
* a helper flag for the search of circular references.
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_CIRCULAR 1 << 9
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_BLOCK_ABSENT:
|
||||
*
|
||||
* the "block" attribute is absent
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_BLOCK_ABSENT 1 << 10
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_BLOCK_EXTENSION:
|
||||
*
|
||||
* disallowed substitutions are absent
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_BLOCK_EXTENSION 1 << 11
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_BLOCK_RESTRICTION:
|
||||
*
|
||||
* disallowed substitutions: "restriction"
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_BLOCK_RESTRICTION 1 << 12
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION:
|
||||
*
|
||||
* disallowed substitutions: "substitution"
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION 1 << 13
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_FINAL_ABSENT:
|
||||
*
|
||||
* substitution group exclusions are absent
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_FINAL_ABSENT 1 << 14
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_FINAL_EXTENSION:
|
||||
*
|
||||
* substitution group exclusions: "extension"
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_FINAL_EXTENSION 1 << 15
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_FINAL_RESTRICTION:
|
||||
*
|
||||
* substitution group exclusions: "restriction"
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_FINAL_RESTRICTION 1 << 16
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD:
|
||||
*
|
||||
* the declaration is a substitution group head
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD 1 << 17
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_INTERNAL_CHECKED:
|
||||
*
|
||||
* this is set when the elem decl has been checked against
|
||||
* all constraints
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_INTERNAL_CHECKED 1 << 18
|
||||
|
||||
typedef struct _xmlSchemaElement xmlSchemaElement;
|
||||
typedef xmlSchemaElement *xmlSchemaElementPtr;
|
||||
struct _xmlSchemaElement {
|
||||
xmlSchemaTypeType type; /* The kind of type */
|
||||
struct _xmlSchemaType *next; /* Not used? */
|
||||
const xmlChar *name;
|
||||
const xmlChar *id; /* Deprecated; not used */
|
||||
const xmlChar *ref; /* Deprecated; not used */
|
||||
const xmlChar *refNs; /* Deprecated; not used */
|
||||
xmlSchemaAnnotPtr annot;
|
||||
xmlSchemaTypePtr subtypes; /* the type definition */
|
||||
xmlSchemaAttributePtr attributes;
|
||||
xmlNodePtr node;
|
||||
int minOccurs; /* Deprecated; not used */
|
||||
int maxOccurs; /* Deprecated; not used */
|
||||
|
||||
int flags;
|
||||
const xmlChar *targetNamespace;
|
||||
const xmlChar *namedType;
|
||||
const xmlChar *namedTypeNs;
|
||||
const xmlChar *substGroup;
|
||||
const xmlChar *substGroupNs;
|
||||
const xmlChar *scope;
|
||||
const xmlChar *value; /* The original value of the value constraint. */
|
||||
struct _xmlSchemaElement *refDecl; /* This will now be used for the
|
||||
substitution group affiliation */
|
||||
xmlRegexpPtr contModel; /* Obsolete for WXS, maybe used for RelaxNG */
|
||||
xmlSchemaContentType contentType;
|
||||
const xmlChar *refPrefix; /* Deprecated; not used */
|
||||
xmlSchemaValPtr defVal; /* The compiled value constraint. */
|
||||
void *idcs; /* The identity-constraint defs */
|
||||
};
|
||||
|
||||
/*
|
||||
* XML_SCHEMAS_FACET_UNKNOWN:
|
||||
*
|
||||
* unknown facet handling
|
||||
*/
|
||||
#define XML_SCHEMAS_FACET_UNKNOWN 0
|
||||
/*
|
||||
* XML_SCHEMAS_FACET_PRESERVE:
|
||||
*
|
||||
* preserve the type of the facet
|
||||
*/
|
||||
#define XML_SCHEMAS_FACET_PRESERVE 1
|
||||
/*
|
||||
* XML_SCHEMAS_FACET_REPLACE:
|
||||
*
|
||||
* replace the type of the facet
|
||||
*/
|
||||
#define XML_SCHEMAS_FACET_REPLACE 2
|
||||
/*
|
||||
* XML_SCHEMAS_FACET_COLLAPSE:
|
||||
*
|
||||
* collapse the types of the facet
|
||||
*/
|
||||
#define XML_SCHEMAS_FACET_COLLAPSE 3
|
||||
/**
|
||||
* A facet definition.
|
||||
*/
|
||||
struct _xmlSchemaFacet {
|
||||
xmlSchemaTypeType type; /* The kind of type */
|
||||
struct _xmlSchemaFacet *next;/* the next type if in a sequence ... */
|
||||
const xmlChar *value; /* The original value */
|
||||
const xmlChar *id; /* Obsolete */
|
||||
xmlSchemaAnnotPtr annot;
|
||||
xmlNodePtr node;
|
||||
int fixed; /* XML_SCHEMAS_FACET_PRESERVE, etc. */
|
||||
int whitespace;
|
||||
xmlSchemaValPtr val; /* The compiled value */
|
||||
xmlRegexpPtr regexp; /* The regex for patterns */
|
||||
};
|
||||
|
||||
/**
|
||||
* A notation definition.
|
||||
*/
|
||||
typedef struct _xmlSchemaNotation xmlSchemaNotation;
|
||||
typedef xmlSchemaNotation *xmlSchemaNotationPtr;
|
||||
struct _xmlSchemaNotation {
|
||||
xmlSchemaTypeType type; /* The kind of type */
|
||||
const xmlChar *name;
|
||||
xmlSchemaAnnotPtr annot;
|
||||
const xmlChar *identifier;
|
||||
const xmlChar *targetNamespace;
|
||||
};
|
||||
|
||||
/*
|
||||
* TODO: Actually all those flags used for the schema should sit
|
||||
* on the schema parser context, since they are used only
|
||||
* during parsing an XML schema document, and not available
|
||||
* on the component level as per spec.
|
||||
*/
|
||||
/**
|
||||
* XML_SCHEMAS_QUALIF_ELEM:
|
||||
*
|
||||
* Reflects elementFormDefault == qualified in
|
||||
* an XML schema document.
|
||||
*/
|
||||
#define XML_SCHEMAS_QUALIF_ELEM 1 << 0
|
||||
/**
|
||||
* XML_SCHEMAS_QUALIF_ATTR:
|
||||
*
|
||||
* Reflects attributeFormDefault == qualified in
|
||||
* an XML schema document.
|
||||
*/
|
||||
#define XML_SCHEMAS_QUALIF_ATTR 1 << 1
|
||||
/**
|
||||
* XML_SCHEMAS_FINAL_DEFAULT_EXTENSION:
|
||||
*
|
||||
* the schema has "extension" in the set of finalDefault.
|
||||
*/
|
||||
#define XML_SCHEMAS_FINAL_DEFAULT_EXTENSION 1 << 2
|
||||
/**
|
||||
* XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION:
|
||||
*
|
||||
* the schema has "restriction" in the set of finalDefault.
|
||||
*/
|
||||
#define XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION 1 << 3
|
||||
/**
|
||||
* XML_SCHEMAS_FINAL_DEFAULT_LIST:
|
||||
*
|
||||
* the schema has "list" in the set of finalDefault.
|
||||
*/
|
||||
#define XML_SCHEMAS_FINAL_DEFAULT_LIST 1 << 4
|
||||
/**
|
||||
* XML_SCHEMAS_FINAL_DEFAULT_UNION:
|
||||
*
|
||||
* the schema has "union" in the set of finalDefault.
|
||||
*/
|
||||
#define XML_SCHEMAS_FINAL_DEFAULT_UNION 1 << 5
|
||||
/**
|
||||
* XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION:
|
||||
*
|
||||
* the schema has "extension" in the set of blockDefault.
|
||||
*/
|
||||
#define XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION 1 << 6
|
||||
/**
|
||||
* XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION:
|
||||
*
|
||||
* the schema has "restriction" in the set of blockDefault.
|
||||
*/
|
||||
#define XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION 1 << 7
|
||||
/**
|
||||
* XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION:
|
||||
*
|
||||
* the schema has "substitution" in the set of blockDefault.
|
||||
*/
|
||||
#define XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION 1 << 8
|
||||
/**
|
||||
* XML_SCHEMAS_INCLUDING_CONVERT_NS:
|
||||
*
|
||||
* the schema is currently including an other schema with
|
||||
* no target namespace.
|
||||
*/
|
||||
#define XML_SCHEMAS_INCLUDING_CONVERT_NS 1 << 9
|
||||
/**
|
||||
* _xmlSchema:
|
||||
*
|
||||
* A Schemas definition
|
||||
*/
|
||||
struct _xmlSchema {
|
||||
const xmlChar *name; /* schema name */
|
||||
const xmlChar *targetNamespace; /* the target namespace */
|
||||
const xmlChar *version;
|
||||
const xmlChar *id; /* Obsolete */
|
||||
xmlDocPtr doc;
|
||||
xmlSchemaAnnotPtr annot;
|
||||
int flags;
|
||||
|
||||
xmlHashTablePtr typeDecl;
|
||||
xmlHashTablePtr attrDecl;
|
||||
xmlHashTablePtr attrgrpDecl;
|
||||
xmlHashTablePtr elemDecl;
|
||||
xmlHashTablePtr notaDecl;
|
||||
|
||||
xmlHashTablePtr schemasImports;
|
||||
|
||||
void *_private; /* unused by the library for users or bindings */
|
||||
xmlHashTablePtr groupDecl;
|
||||
xmlDictPtr dict;
|
||||
void *includes; /* the includes, this is opaque for now */
|
||||
int preserve; /* whether to free the document */
|
||||
int counter; /* used to give anonymous components unique names */
|
||||
xmlHashTablePtr idcDef; /* All identity-constraint defs. */
|
||||
void *volatiles; /* Obsolete */
|
||||
};
|
||||
|
||||
XMLPUBFUN void xmlSchemaFreeType (xmlSchemaTypePtr type);
|
||||
XMLPUBFUN void xmlSchemaFreeWildcard(xmlSchemaWildcardPtr wildcard);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_SCHEMAS_ENABLED */
|
||||
#endif /* __XML_SCHEMA_INTERNALS_H__ */
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Summary: XML Schematron implementation
|
||||
* Description: interface to the XML Schematron validity checking.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __XML_SCHEMATRON_H__
|
||||
#define __XML_SCHEMATRON_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#ifdef LIBXML_SCHEMATRON_ENABLED
|
||||
|
||||
#include <libxml/xmlerror.h>
|
||||
#include <libxml/tree.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
XML_SCHEMATRON_OUT_QUIET = 1 << 0, /* quiet no report */
|
||||
XML_SCHEMATRON_OUT_TEXT = 1 << 1, /* build a textual report */
|
||||
XML_SCHEMATRON_OUT_XML = 1 << 2, /* output SVRL */
|
||||
XML_SCHEMATRON_OUT_ERROR = 1 << 3, /* output via xmlStructuredErrorFunc */
|
||||
XML_SCHEMATRON_OUT_FILE = 1 << 8, /* output to a file descriptor */
|
||||
XML_SCHEMATRON_OUT_BUFFER = 1 << 9, /* output to a buffer */
|
||||
XML_SCHEMATRON_OUT_IO = 1 << 10 /* output to I/O mechanism */
|
||||
} xmlSchematronValidOptions;
|
||||
|
||||
/**
|
||||
* The schemas related types are kept internal
|
||||
*/
|
||||
typedef struct _xmlSchematron xmlSchematron;
|
||||
typedef xmlSchematron *xmlSchematronPtr;
|
||||
|
||||
/**
|
||||
* xmlSchematronValidityErrorFunc:
|
||||
* @ctx: the validation context
|
||||
* @msg: the message
|
||||
* @...: extra arguments
|
||||
*
|
||||
* Signature of an error callback from a Schematron validation
|
||||
*/
|
||||
typedef void (*xmlSchematronValidityErrorFunc) (void *ctx, const char *msg, ...);
|
||||
|
||||
/**
|
||||
* xmlSchematronValidityWarningFunc:
|
||||
* @ctx: the validation context
|
||||
* @msg: the message
|
||||
* @...: extra arguments
|
||||
*
|
||||
* Signature of a warning callback from a Schematron validation
|
||||
*/
|
||||
typedef void (*xmlSchematronValidityWarningFunc) (void *ctx, const char *msg, ...);
|
||||
|
||||
/**
|
||||
* A schemas validation context
|
||||
*/
|
||||
typedef struct _xmlSchematronParserCtxt xmlSchematronParserCtxt;
|
||||
typedef xmlSchematronParserCtxt *xmlSchematronParserCtxtPtr;
|
||||
|
||||
typedef struct _xmlSchematronValidCtxt xmlSchematronValidCtxt;
|
||||
typedef xmlSchematronValidCtxt *xmlSchematronValidCtxtPtr;
|
||||
|
||||
/*
|
||||
* Interfaces for parsing.
|
||||
*/
|
||||
XMLPUBFUN xmlSchematronParserCtxtPtr
|
||||
xmlSchematronNewParserCtxt (const char *URL);
|
||||
XMLPUBFUN xmlSchematronParserCtxtPtr
|
||||
xmlSchematronNewMemParserCtxt(const char *buffer,
|
||||
int size);
|
||||
XMLPUBFUN xmlSchematronParserCtxtPtr
|
||||
xmlSchematronNewDocParserCtxt(xmlDocPtr doc);
|
||||
XMLPUBFUN void
|
||||
xmlSchematronFreeParserCtxt (xmlSchematronParserCtxtPtr ctxt);
|
||||
/*****
|
||||
XMLPUBFUN void
|
||||
xmlSchematronSetParserErrors(xmlSchematronParserCtxtPtr ctxt,
|
||||
xmlSchematronValidityErrorFunc err,
|
||||
xmlSchematronValidityWarningFunc warn,
|
||||
void *ctx);
|
||||
XMLPUBFUN int
|
||||
xmlSchematronGetParserErrors(xmlSchematronParserCtxtPtr ctxt,
|
||||
xmlSchematronValidityErrorFunc * err,
|
||||
xmlSchematronValidityWarningFunc * warn,
|
||||
void **ctx);
|
||||
XMLPUBFUN int
|
||||
xmlSchematronIsValid (xmlSchematronValidCtxtPtr ctxt);
|
||||
*****/
|
||||
XMLPUBFUN xmlSchematronPtr
|
||||
xmlSchematronParse (xmlSchematronParserCtxtPtr ctxt);
|
||||
XMLPUBFUN void
|
||||
xmlSchematronFree (xmlSchematronPtr schema);
|
||||
/*
|
||||
* Interfaces for validating
|
||||
*/
|
||||
XMLPUBFUN void
|
||||
xmlSchematronSetValidStructuredErrors(
|
||||
xmlSchematronValidCtxtPtr ctxt,
|
||||
xmlStructuredErrorFunc serror,
|
||||
void *ctx);
|
||||
/******
|
||||
XMLPUBFUN void
|
||||
xmlSchematronSetValidErrors (xmlSchematronValidCtxtPtr ctxt,
|
||||
xmlSchematronValidityErrorFunc err,
|
||||
xmlSchematronValidityWarningFunc warn,
|
||||
void *ctx);
|
||||
XMLPUBFUN int
|
||||
xmlSchematronGetValidErrors (xmlSchematronValidCtxtPtr ctxt,
|
||||
xmlSchematronValidityErrorFunc *err,
|
||||
xmlSchematronValidityWarningFunc *warn,
|
||||
void **ctx);
|
||||
XMLPUBFUN int
|
||||
xmlSchematronSetValidOptions(xmlSchematronValidCtxtPtr ctxt,
|
||||
int options);
|
||||
XMLPUBFUN int
|
||||
xmlSchematronValidCtxtGetOptions(xmlSchematronValidCtxtPtr ctxt);
|
||||
XMLPUBFUN int
|
||||
xmlSchematronValidateOneElement (xmlSchematronValidCtxtPtr ctxt,
|
||||
xmlNodePtr elem);
|
||||
*******/
|
||||
|
||||
XMLPUBFUN xmlSchematronValidCtxtPtr
|
||||
xmlSchematronNewValidCtxt (xmlSchematronPtr schema,
|
||||
int options);
|
||||
XMLPUBFUN void
|
||||
xmlSchematronFreeValidCtxt (xmlSchematronValidCtxtPtr ctxt);
|
||||
XMLPUBFUN int
|
||||
xmlSchematronValidateDoc (xmlSchematronValidCtxtPtr ctxt,
|
||||
xmlDocPtr instance);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_SCHEMATRON_ENABLED */
|
||||
#endif /* __XML_SCHEMATRON_H__ */
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* Summary: interfaces for thread handling
|
||||
* Description: set of generic threading related routines
|
||||
* should work with pthreads, Windows native or TLS threads
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_THREADS_H__
|
||||
#define __XML_THREADS_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* xmlMutex are a simple mutual exception locks.
|
||||
*/
|
||||
typedef struct _xmlMutex xmlMutex;
|
||||
typedef xmlMutex *xmlMutexPtr;
|
||||
|
||||
/*
|
||||
* xmlRMutex are reentrant mutual exception locks.
|
||||
*/
|
||||
typedef struct _xmlRMutex xmlRMutex;
|
||||
typedef xmlRMutex *xmlRMutexPtr;
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlCheckThreadLocalStorage(void);
|
||||
|
||||
XMLPUBFUN xmlMutexPtr
|
||||
xmlNewMutex (void);
|
||||
XMLPUBFUN void
|
||||
xmlMutexLock (xmlMutexPtr tok);
|
||||
XMLPUBFUN void
|
||||
xmlMutexUnlock (xmlMutexPtr tok);
|
||||
XMLPUBFUN void
|
||||
xmlFreeMutex (xmlMutexPtr tok);
|
||||
|
||||
XMLPUBFUN xmlRMutexPtr
|
||||
xmlNewRMutex (void);
|
||||
XMLPUBFUN void
|
||||
xmlRMutexLock (xmlRMutexPtr tok);
|
||||
XMLPUBFUN void
|
||||
xmlRMutexUnlock (xmlRMutexPtr tok);
|
||||
XMLPUBFUN void
|
||||
xmlFreeRMutex (xmlRMutexPtr tok);
|
||||
|
||||
/*
|
||||
* Library wide APIs.
|
||||
*/
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlInitThreads (void);
|
||||
XMLPUBFUN void
|
||||
xmlLockLibrary (void);
|
||||
XMLPUBFUN void
|
||||
xmlUnlockLibrary(void);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlGetThreadId (void);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlIsMainThread (void);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlCleanupThreads(void);
|
||||
|
||||
/** DOC_DISABLE */
|
||||
#if defined(LIBXML_THREAD_ENABLED) && defined(_WIN32) && \
|
||||
defined(LIBXML_STATIC_FOR_DLL)
|
||||
int
|
||||
xmlDllMain(void *hinstDLL, unsigned long fdwReason,
|
||||
void *lpvReserved);
|
||||
#endif
|
||||
/** DOC_ENABLE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __XML_THREADS_H__ */
|
||||
+1382
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,106 @@
|
||||
/**
|
||||
* Summary: library of generic URI related routines
|
||||
* Description: library of generic URI related routines
|
||||
* Implements RFC 2396
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_URI_H__
|
||||
#define __XML_URI_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <libxml/xmlversion.h>
|
||||
#include <libxml/xmlstring.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* xmlURI:
|
||||
*
|
||||
* A parsed URI reference. This is a struct containing the various fields
|
||||
* as described in RFC 2396 but separated for further processing.
|
||||
*
|
||||
* Note: query is a deprecated field which is incorrectly unescaped.
|
||||
* query_raw takes precedence over query if the former is set.
|
||||
* See: http://mail.gnome.org/archives/xml/2007-April/thread.html#00127
|
||||
*/
|
||||
typedef struct _xmlURI xmlURI;
|
||||
typedef xmlURI *xmlURIPtr;
|
||||
struct _xmlURI {
|
||||
char *scheme; /* the URI scheme */
|
||||
char *opaque; /* opaque part */
|
||||
char *authority; /* the authority part */
|
||||
char *server; /* the server part */
|
||||
char *user; /* the user part */
|
||||
int port; /* the port number */
|
||||
char *path; /* the path string */
|
||||
char *query; /* the query string (deprecated - use with caution) */
|
||||
char *fragment; /* the fragment identifier */
|
||||
int cleanup; /* parsing potentially unclean URI */
|
||||
char *query_raw; /* the query string (as it appears in the URI) */
|
||||
};
|
||||
|
||||
/*
|
||||
* This function is in tree.h:
|
||||
* xmlChar * xmlNodeGetBase (xmlDocPtr doc,
|
||||
* xmlNodePtr cur);
|
||||
*/
|
||||
XMLPUBFUN xmlURIPtr
|
||||
xmlCreateURI (void);
|
||||
XMLPUBFUN int
|
||||
xmlBuildURISafe (const xmlChar *URI,
|
||||
const xmlChar *base,
|
||||
xmlChar **out);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlBuildURI (const xmlChar *URI,
|
||||
const xmlChar *base);
|
||||
XMLPUBFUN int
|
||||
xmlBuildRelativeURISafe (const xmlChar *URI,
|
||||
const xmlChar *base,
|
||||
xmlChar **out);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlBuildRelativeURI (const xmlChar *URI,
|
||||
const xmlChar *base);
|
||||
XMLPUBFUN xmlURIPtr
|
||||
xmlParseURI (const char *str);
|
||||
XMLPUBFUN int
|
||||
xmlParseURISafe (const char *str,
|
||||
xmlURIPtr *uri);
|
||||
XMLPUBFUN xmlURIPtr
|
||||
xmlParseURIRaw (const char *str,
|
||||
int raw);
|
||||
XMLPUBFUN int
|
||||
xmlParseURIReference (xmlURIPtr uri,
|
||||
const char *str);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlSaveUri (xmlURIPtr uri);
|
||||
XMLPUBFUN void
|
||||
xmlPrintURI (FILE *stream,
|
||||
xmlURIPtr uri);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlURIEscapeStr (const xmlChar *str,
|
||||
const xmlChar *list);
|
||||
XMLPUBFUN char *
|
||||
xmlURIUnescapeString (const char *str,
|
||||
int len,
|
||||
char *target);
|
||||
XMLPUBFUN int
|
||||
xmlNormalizeURIPath (char *path);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlURIEscape (const xmlChar *str);
|
||||
XMLPUBFUN void
|
||||
xmlFreeURI (xmlURIPtr uri);
|
||||
XMLPUBFUN xmlChar*
|
||||
xmlCanonicPath (const xmlChar *path);
|
||||
XMLPUBFUN xmlChar*
|
||||
xmlPathToURI (const xmlChar *path);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __XML_URI_H__ */
|
||||
+477
@@ -0,0 +1,477 @@
|
||||
/*
|
||||
* Summary: The DTD validation
|
||||
* Description: API for the DTD handling and the validity checking
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __XML_VALID_H__
|
||||
#define __XML_VALID_H__
|
||||
|
||||
/** DOC_DISABLE */
|
||||
#include <libxml/xmlversion.h>
|
||||
#include <libxml/xmlerror.h>
|
||||
#define XML_TREE_INTERNALS
|
||||
#include <libxml/tree.h>
|
||||
#undef XML_TREE_INTERNALS
|
||||
#include <libxml/list.h>
|
||||
#include <libxml/xmlautomata.h>
|
||||
#include <libxml/xmlregexp.h>
|
||||
/** DOC_ENABLE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Validation state added for non-determinist content model.
|
||||
*/
|
||||
typedef struct _xmlValidState xmlValidState;
|
||||
typedef xmlValidState *xmlValidStatePtr;
|
||||
|
||||
/**
|
||||
* xmlValidityErrorFunc:
|
||||
* @ctx: usually an xmlValidCtxtPtr to a validity error context,
|
||||
* but comes from ctxt->userData (which normally contains such
|
||||
* a pointer); ctxt->userData can be changed by the user.
|
||||
* @msg: the string to format *printf like vararg
|
||||
* @...: remaining arguments to the format
|
||||
*
|
||||
* Callback called when a validity error is found. This is a message
|
||||
* oriented function similar to an *printf function.
|
||||
*/
|
||||
typedef void (*xmlValidityErrorFunc) (void *ctx,
|
||||
const char *msg,
|
||||
...) LIBXML_ATTR_FORMAT(2,3);
|
||||
|
||||
/**
|
||||
* xmlValidityWarningFunc:
|
||||
* @ctx: usually an xmlValidCtxtPtr to a validity error context,
|
||||
* but comes from ctxt->userData (which normally contains such
|
||||
* a pointer); ctxt->userData can be changed by the user.
|
||||
* @msg: the string to format *printf like vararg
|
||||
* @...: remaining arguments to the format
|
||||
*
|
||||
* Callback called when a validity warning is found. This is a message
|
||||
* oriented function similar to an *printf function.
|
||||
*/
|
||||
typedef void (*xmlValidityWarningFunc) (void *ctx,
|
||||
const char *msg,
|
||||
...) LIBXML_ATTR_FORMAT(2,3);
|
||||
|
||||
/*
|
||||
* xmlValidCtxt:
|
||||
* An xmlValidCtxt is used for error reporting when validating.
|
||||
*/
|
||||
typedef struct _xmlValidCtxt xmlValidCtxt;
|
||||
typedef xmlValidCtxt *xmlValidCtxtPtr;
|
||||
struct _xmlValidCtxt {
|
||||
void *userData; /* user specific data block */
|
||||
xmlValidityErrorFunc error; /* the callback in case of errors */
|
||||
xmlValidityWarningFunc warning; /* the callback in case of warning */
|
||||
|
||||
/* Node analysis stack used when validating within entities */
|
||||
xmlNodePtr node; /* Current parsed Node */
|
||||
int nodeNr; /* Depth of the parsing stack */
|
||||
int nodeMax; /* Max depth of the parsing stack */
|
||||
xmlNodePtr *nodeTab; /* array of nodes */
|
||||
|
||||
unsigned int flags; /* internal flags */
|
||||
xmlDocPtr doc; /* the document */
|
||||
int valid; /* temporary validity check result */
|
||||
|
||||
/* state state used for non-determinist content validation */
|
||||
xmlValidState *vstate; /* current state */
|
||||
int vstateNr; /* Depth of the validation stack */
|
||||
int vstateMax; /* Max depth of the validation stack */
|
||||
xmlValidState *vstateTab; /* array of validation states */
|
||||
|
||||
#ifdef LIBXML_REGEXP_ENABLED
|
||||
xmlAutomataPtr am; /* the automata */
|
||||
xmlAutomataStatePtr state; /* used to build the automata */
|
||||
#else
|
||||
void *am;
|
||||
void *state;
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
* ALL notation declarations are stored in a table.
|
||||
* There is one table per DTD.
|
||||
*/
|
||||
|
||||
typedef struct _xmlHashTable xmlNotationTable;
|
||||
typedef xmlNotationTable *xmlNotationTablePtr;
|
||||
|
||||
/*
|
||||
* ALL element declarations are stored in a table.
|
||||
* There is one table per DTD.
|
||||
*/
|
||||
|
||||
typedef struct _xmlHashTable xmlElementTable;
|
||||
typedef xmlElementTable *xmlElementTablePtr;
|
||||
|
||||
/*
|
||||
* ALL attribute declarations are stored in a table.
|
||||
* There is one table per DTD.
|
||||
*/
|
||||
|
||||
typedef struct _xmlHashTable xmlAttributeTable;
|
||||
typedef xmlAttributeTable *xmlAttributeTablePtr;
|
||||
|
||||
/*
|
||||
* ALL IDs attributes are stored in a table.
|
||||
* There is one table per document.
|
||||
*/
|
||||
|
||||
typedef struct _xmlHashTable xmlIDTable;
|
||||
typedef xmlIDTable *xmlIDTablePtr;
|
||||
|
||||
/*
|
||||
* ALL Refs attributes are stored in a table.
|
||||
* There is one table per document.
|
||||
*/
|
||||
|
||||
typedef struct _xmlHashTable xmlRefTable;
|
||||
typedef xmlRefTable *xmlRefTablePtr;
|
||||
|
||||
/* Notation */
|
||||
XMLPUBFUN xmlNotationPtr
|
||||
xmlAddNotationDecl (xmlValidCtxtPtr ctxt,
|
||||
xmlDtdPtr dtd,
|
||||
const xmlChar *name,
|
||||
const xmlChar *PublicID,
|
||||
const xmlChar *SystemID);
|
||||
#ifdef LIBXML_TREE_ENABLED
|
||||
XMLPUBFUN xmlNotationTablePtr
|
||||
xmlCopyNotationTable (xmlNotationTablePtr table);
|
||||
#endif /* LIBXML_TREE_ENABLED */
|
||||
XMLPUBFUN void
|
||||
xmlFreeNotationTable (xmlNotationTablePtr table);
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlDumpNotationDecl (xmlBufferPtr buf,
|
||||
xmlNotationPtr nota);
|
||||
/* XML_DEPRECATED, still used in lxml */
|
||||
XMLPUBFUN void
|
||||
xmlDumpNotationTable (xmlBufferPtr buf,
|
||||
xmlNotationTablePtr table);
|
||||
#endif /* LIBXML_OUTPUT_ENABLED */
|
||||
|
||||
/* Element Content */
|
||||
/* the non Doc version are being deprecated */
|
||||
XMLPUBFUN xmlElementContentPtr
|
||||
xmlNewElementContent (const xmlChar *name,
|
||||
xmlElementContentType type);
|
||||
XMLPUBFUN xmlElementContentPtr
|
||||
xmlCopyElementContent (xmlElementContentPtr content);
|
||||
XMLPUBFUN void
|
||||
xmlFreeElementContent (xmlElementContentPtr cur);
|
||||
/* the new versions with doc argument */
|
||||
XMLPUBFUN xmlElementContentPtr
|
||||
xmlNewDocElementContent (xmlDocPtr doc,
|
||||
const xmlChar *name,
|
||||
xmlElementContentType type);
|
||||
XMLPUBFUN xmlElementContentPtr
|
||||
xmlCopyDocElementContent(xmlDocPtr doc,
|
||||
xmlElementContentPtr content);
|
||||
XMLPUBFUN void
|
||||
xmlFreeDocElementContent(xmlDocPtr doc,
|
||||
xmlElementContentPtr cur);
|
||||
XMLPUBFUN void
|
||||
xmlSnprintfElementContent(char *buf,
|
||||
int size,
|
||||
xmlElementContentPtr content,
|
||||
int englob);
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlSprintfElementContent(char *buf,
|
||||
xmlElementContentPtr content,
|
||||
int englob);
|
||||
#endif /* LIBXML_OUTPUT_ENABLED */
|
||||
|
||||
/* Element */
|
||||
XMLPUBFUN xmlElementPtr
|
||||
xmlAddElementDecl (xmlValidCtxtPtr ctxt,
|
||||
xmlDtdPtr dtd,
|
||||
const xmlChar *name,
|
||||
xmlElementTypeVal type,
|
||||
xmlElementContentPtr content);
|
||||
#ifdef LIBXML_TREE_ENABLED
|
||||
XMLPUBFUN xmlElementTablePtr
|
||||
xmlCopyElementTable (xmlElementTablePtr table);
|
||||
#endif /* LIBXML_TREE_ENABLED */
|
||||
XMLPUBFUN void
|
||||
xmlFreeElementTable (xmlElementTablePtr table);
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlDumpElementTable (xmlBufferPtr buf,
|
||||
xmlElementTablePtr table);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlDumpElementDecl (xmlBufferPtr buf,
|
||||
xmlElementPtr elem);
|
||||
#endif /* LIBXML_OUTPUT_ENABLED */
|
||||
|
||||
/* Enumeration */
|
||||
XMLPUBFUN xmlEnumerationPtr
|
||||
xmlCreateEnumeration (const xmlChar *name);
|
||||
XMLPUBFUN void
|
||||
xmlFreeEnumeration (xmlEnumerationPtr cur);
|
||||
#ifdef LIBXML_TREE_ENABLED
|
||||
XMLPUBFUN xmlEnumerationPtr
|
||||
xmlCopyEnumeration (xmlEnumerationPtr cur);
|
||||
#endif /* LIBXML_TREE_ENABLED */
|
||||
|
||||
/* Attribute */
|
||||
XMLPUBFUN xmlAttributePtr
|
||||
xmlAddAttributeDecl (xmlValidCtxtPtr ctxt,
|
||||
xmlDtdPtr dtd,
|
||||
const xmlChar *elem,
|
||||
const xmlChar *name,
|
||||
const xmlChar *ns,
|
||||
xmlAttributeType type,
|
||||
xmlAttributeDefault def,
|
||||
const xmlChar *defaultValue,
|
||||
xmlEnumerationPtr tree);
|
||||
#ifdef LIBXML_TREE_ENABLED
|
||||
XMLPUBFUN xmlAttributeTablePtr
|
||||
xmlCopyAttributeTable (xmlAttributeTablePtr table);
|
||||
#endif /* LIBXML_TREE_ENABLED */
|
||||
XMLPUBFUN void
|
||||
xmlFreeAttributeTable (xmlAttributeTablePtr table);
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlDumpAttributeTable (xmlBufferPtr buf,
|
||||
xmlAttributeTablePtr table);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlDumpAttributeDecl (xmlBufferPtr buf,
|
||||
xmlAttributePtr attr);
|
||||
#endif /* LIBXML_OUTPUT_ENABLED */
|
||||
|
||||
/* IDs */
|
||||
XMLPUBFUN int
|
||||
xmlAddIDSafe (xmlAttrPtr attr,
|
||||
const xmlChar *value);
|
||||
XMLPUBFUN xmlIDPtr
|
||||
xmlAddID (xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
const xmlChar *value,
|
||||
xmlAttrPtr attr);
|
||||
XMLPUBFUN void
|
||||
xmlFreeIDTable (xmlIDTablePtr table);
|
||||
XMLPUBFUN xmlAttrPtr
|
||||
xmlGetID (xmlDocPtr doc,
|
||||
const xmlChar *ID);
|
||||
XMLPUBFUN int
|
||||
xmlIsID (xmlDocPtr doc,
|
||||
xmlNodePtr elem,
|
||||
xmlAttrPtr attr);
|
||||
XMLPUBFUN int
|
||||
xmlRemoveID (xmlDocPtr doc,
|
||||
xmlAttrPtr attr);
|
||||
|
||||
/* IDREFs */
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlRefPtr
|
||||
xmlAddRef (xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
const xmlChar *value,
|
||||
xmlAttrPtr attr);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlFreeRefTable (xmlRefTablePtr table);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlIsRef (xmlDocPtr doc,
|
||||
xmlNodePtr elem,
|
||||
xmlAttrPtr attr);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlRemoveRef (xmlDocPtr doc,
|
||||
xmlAttrPtr attr);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlListPtr
|
||||
xmlGetRefs (xmlDocPtr doc,
|
||||
const xmlChar *ID);
|
||||
|
||||
/**
|
||||
* The public function calls related to validity checking.
|
||||
*/
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
/* Allocate/Release Validation Contexts */
|
||||
XMLPUBFUN xmlValidCtxtPtr
|
||||
xmlNewValidCtxt(void);
|
||||
XMLPUBFUN void
|
||||
xmlFreeValidCtxt(xmlValidCtxtPtr);
|
||||
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlValidateRoot (xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlValidateElementDecl (xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
xmlElementPtr elem);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlValidNormalizeAttributeValue(xmlDocPtr doc,
|
||||
xmlNodePtr elem,
|
||||
const xmlChar *name,
|
||||
const xmlChar *value);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr elem,
|
||||
const xmlChar *name,
|
||||
const xmlChar *value);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
xmlAttributePtr attr);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlValidateAttributeValue(xmlAttributeType type,
|
||||
const xmlChar *value);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlValidateNotationDecl (xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
xmlNotationPtr nota);
|
||||
XMLPUBFUN int
|
||||
xmlValidateDtd (xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
xmlDtdPtr dtd);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlValidateDtdFinal (xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc);
|
||||
XMLPUBFUN int
|
||||
xmlValidateDocument (xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc);
|
||||
XMLPUBFUN int
|
||||
xmlValidateElement (xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr elem);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlValidateOneElement (xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr elem);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlValidateOneAttribute (xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr elem,
|
||||
xmlAttrPtr attr,
|
||||
const xmlChar *value);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlValidateOneNamespace (xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr elem,
|
||||
const xmlChar *prefix,
|
||||
xmlNsPtr ns,
|
||||
const xmlChar *value);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc);
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlValidateNotationUse (xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
const xmlChar *notationName);
|
||||
#endif /* LIBXML_VALID_ENABLED or LIBXML_SCHEMAS_ENABLED */
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlIsMixedElement (xmlDocPtr doc,
|
||||
const xmlChar *name);
|
||||
XMLPUBFUN xmlAttributePtr
|
||||
xmlGetDtdAttrDesc (xmlDtdPtr dtd,
|
||||
const xmlChar *elem,
|
||||
const xmlChar *name);
|
||||
XMLPUBFUN xmlAttributePtr
|
||||
xmlGetDtdQAttrDesc (xmlDtdPtr dtd,
|
||||
const xmlChar *elem,
|
||||
const xmlChar *name,
|
||||
const xmlChar *prefix);
|
||||
XMLPUBFUN xmlNotationPtr
|
||||
xmlGetDtdNotationDesc (xmlDtdPtr dtd,
|
||||
const xmlChar *name);
|
||||
XMLPUBFUN xmlElementPtr
|
||||
xmlGetDtdQElementDesc (xmlDtdPtr dtd,
|
||||
const xmlChar *name,
|
||||
const xmlChar *prefix);
|
||||
XMLPUBFUN xmlElementPtr
|
||||
xmlGetDtdElementDesc (xmlDtdPtr dtd,
|
||||
const xmlChar *name);
|
||||
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlValidGetPotentialChildren(xmlElementContent *ctree,
|
||||
const xmlChar **names,
|
||||
int *len,
|
||||
int max);
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlValidGetValidElements(xmlNode *prev,
|
||||
xmlNode *next,
|
||||
const xmlChar **names,
|
||||
int max);
|
||||
XMLPUBFUN int
|
||||
xmlValidateNameValue (const xmlChar *value);
|
||||
XMLPUBFUN int
|
||||
xmlValidateNamesValue (const xmlChar *value);
|
||||
XMLPUBFUN int
|
||||
xmlValidateNmtokenValue (const xmlChar *value);
|
||||
XMLPUBFUN int
|
||||
xmlValidateNmtokensValue(const xmlChar *value);
|
||||
|
||||
#ifdef LIBXML_REGEXP_ENABLED
|
||||
/*
|
||||
* Validation based on the regexp support
|
||||
*/
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlValidBuildContentModel(xmlValidCtxtPtr ctxt,
|
||||
xmlElementPtr elem);
|
||||
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlValidatePushElement (xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr elem,
|
||||
const xmlChar *qname);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlValidatePushCData (xmlValidCtxtPtr ctxt,
|
||||
const xmlChar *data,
|
||||
int len);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlValidatePopElement (xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr elem,
|
||||
const xmlChar *qname);
|
||||
#endif /* LIBXML_REGEXP_ENABLED */
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __XML_VALID_H__ */
|
||||
+136
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* Summary: implementation of XInclude
|
||||
* Description: API to handle XInclude processing,
|
||||
* implements the
|
||||
* World Wide Web Consortium Last Call Working Draft 10 November 2003
|
||||
* http://www.w3.org/TR/2003/WD-xinclude-20031110
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_XINCLUDE_H__
|
||||
#define __XML_XINCLUDE_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
#include <libxml/xmlerror.h>
|
||||
#include <libxml/tree.h>
|
||||
|
||||
#ifdef LIBXML_XINCLUDE_ENABLED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* XINCLUDE_NS:
|
||||
*
|
||||
* Macro defining the Xinclude namespace: http://www.w3.org/2003/XInclude
|
||||
*/
|
||||
#define XINCLUDE_NS (const xmlChar *) "http://www.w3.org/2003/XInclude"
|
||||
/**
|
||||
* XINCLUDE_OLD_NS:
|
||||
*
|
||||
* Macro defining the draft Xinclude namespace: http://www.w3.org/2001/XInclude
|
||||
*/
|
||||
#define XINCLUDE_OLD_NS (const xmlChar *) "http://www.w3.org/2001/XInclude"
|
||||
/**
|
||||
* XINCLUDE_NODE:
|
||||
*
|
||||
* Macro defining "include"
|
||||
*/
|
||||
#define XINCLUDE_NODE (const xmlChar *) "include"
|
||||
/**
|
||||
* XINCLUDE_FALLBACK:
|
||||
*
|
||||
* Macro defining "fallback"
|
||||
*/
|
||||
#define XINCLUDE_FALLBACK (const xmlChar *) "fallback"
|
||||
/**
|
||||
* XINCLUDE_HREF:
|
||||
*
|
||||
* Macro defining "href"
|
||||
*/
|
||||
#define XINCLUDE_HREF (const xmlChar *) "href"
|
||||
/**
|
||||
* XINCLUDE_PARSE:
|
||||
*
|
||||
* Macro defining "parse"
|
||||
*/
|
||||
#define XINCLUDE_PARSE (const xmlChar *) "parse"
|
||||
/**
|
||||
* XINCLUDE_PARSE_XML:
|
||||
*
|
||||
* Macro defining "xml"
|
||||
*/
|
||||
#define XINCLUDE_PARSE_XML (const xmlChar *) "xml"
|
||||
/**
|
||||
* XINCLUDE_PARSE_TEXT:
|
||||
*
|
||||
* Macro defining "text"
|
||||
*/
|
||||
#define XINCLUDE_PARSE_TEXT (const xmlChar *) "text"
|
||||
/**
|
||||
* XINCLUDE_PARSE_ENCODING:
|
||||
*
|
||||
* Macro defining "encoding"
|
||||
*/
|
||||
#define XINCLUDE_PARSE_ENCODING (const xmlChar *) "encoding"
|
||||
/**
|
||||
* XINCLUDE_PARSE_XPOINTER:
|
||||
*
|
||||
* Macro defining "xpointer"
|
||||
*/
|
||||
#define XINCLUDE_PARSE_XPOINTER (const xmlChar *) "xpointer"
|
||||
|
||||
typedef struct _xmlXIncludeCtxt xmlXIncludeCtxt;
|
||||
typedef xmlXIncludeCtxt *xmlXIncludeCtxtPtr;
|
||||
|
||||
/*
|
||||
* standalone processing
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlXIncludeProcess (xmlDocPtr doc);
|
||||
XMLPUBFUN int
|
||||
xmlXIncludeProcessFlags (xmlDocPtr doc,
|
||||
int flags);
|
||||
XMLPUBFUN int
|
||||
xmlXIncludeProcessFlagsData(xmlDocPtr doc,
|
||||
int flags,
|
||||
void *data);
|
||||
XMLPUBFUN int
|
||||
xmlXIncludeProcessTreeFlagsData(xmlNodePtr tree,
|
||||
int flags,
|
||||
void *data);
|
||||
XMLPUBFUN int
|
||||
xmlXIncludeProcessTree (xmlNodePtr tree);
|
||||
XMLPUBFUN int
|
||||
xmlXIncludeProcessTreeFlags(xmlNodePtr tree,
|
||||
int flags);
|
||||
/*
|
||||
* contextual processing
|
||||
*/
|
||||
XMLPUBFUN xmlXIncludeCtxtPtr
|
||||
xmlXIncludeNewContext (xmlDocPtr doc);
|
||||
XMLPUBFUN int
|
||||
xmlXIncludeSetFlags (xmlXIncludeCtxtPtr ctxt,
|
||||
int flags);
|
||||
XMLPUBFUN void
|
||||
xmlXIncludeSetErrorHandler(xmlXIncludeCtxtPtr ctxt,
|
||||
xmlStructuredErrorFunc handler,
|
||||
void *data);
|
||||
XMLPUBFUN int
|
||||
xmlXIncludeGetLastError (xmlXIncludeCtxtPtr ctxt);
|
||||
XMLPUBFUN void
|
||||
xmlXIncludeFreeContext (xmlXIncludeCtxtPtr ctxt);
|
||||
XMLPUBFUN int
|
||||
xmlXIncludeProcessNode (xmlXIncludeCtxtPtr ctxt,
|
||||
xmlNodePtr tree);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_XINCLUDE_ENABLED */
|
||||
|
||||
#endif /* __XML_XINCLUDE_H__ */
|
||||
+189
@@ -0,0 +1,189 @@
|
||||
/*
|
||||
* Summary: unfinished XLink detection module
|
||||
* Description: unfinished XLink detection module
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_XLINK_H__
|
||||
#define __XML_XLINK_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
#include <libxml/tree.h>
|
||||
|
||||
#ifdef LIBXML_XPTR_ENABLED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Various defines for the various Link properties.
|
||||
*
|
||||
* NOTE: the link detection layer will try to resolve QName expansion
|
||||
* of namespaces. If "foo" is the prefix for "http://foo.com/"
|
||||
* then the link detection layer will expand role="foo:myrole"
|
||||
* to "http://foo.com/:myrole".
|
||||
* NOTE: the link detection layer will expand URI-References found on
|
||||
* href attributes by using the base mechanism if found.
|
||||
*/
|
||||
typedef xmlChar *xlinkHRef;
|
||||
typedef xmlChar *xlinkRole;
|
||||
typedef xmlChar *xlinkTitle;
|
||||
|
||||
typedef enum {
|
||||
XLINK_TYPE_NONE = 0,
|
||||
XLINK_TYPE_SIMPLE,
|
||||
XLINK_TYPE_EXTENDED,
|
||||
XLINK_TYPE_EXTENDED_SET
|
||||
} xlinkType;
|
||||
|
||||
typedef enum {
|
||||
XLINK_SHOW_NONE = 0,
|
||||
XLINK_SHOW_NEW,
|
||||
XLINK_SHOW_EMBED,
|
||||
XLINK_SHOW_REPLACE
|
||||
} xlinkShow;
|
||||
|
||||
typedef enum {
|
||||
XLINK_ACTUATE_NONE = 0,
|
||||
XLINK_ACTUATE_AUTO,
|
||||
XLINK_ACTUATE_ONREQUEST
|
||||
} xlinkActuate;
|
||||
|
||||
/**
|
||||
* xlinkNodeDetectFunc:
|
||||
* @ctx: user data pointer
|
||||
* @node: the node to check
|
||||
*
|
||||
* This is the prototype for the link detection routine.
|
||||
* It calls the default link detection callbacks upon link detection.
|
||||
*/
|
||||
typedef void (*xlinkNodeDetectFunc) (void *ctx, xmlNodePtr node);
|
||||
|
||||
/*
|
||||
* The link detection module interact with the upper layers using
|
||||
* a set of callback registered at parsing time.
|
||||
*/
|
||||
|
||||
/**
|
||||
* xlinkSimpleLinkFunk:
|
||||
* @ctx: user data pointer
|
||||
* @node: the node carrying the link
|
||||
* @href: the target of the link
|
||||
* @role: the role string
|
||||
* @title: the link title
|
||||
*
|
||||
* This is the prototype for a simple link detection callback.
|
||||
*/
|
||||
typedef void
|
||||
(*xlinkSimpleLinkFunk) (void *ctx,
|
||||
xmlNodePtr node,
|
||||
const xlinkHRef href,
|
||||
const xlinkRole role,
|
||||
const xlinkTitle title);
|
||||
|
||||
/**
|
||||
* xlinkExtendedLinkFunk:
|
||||
* @ctx: user data pointer
|
||||
* @node: the node carrying the link
|
||||
* @nbLocators: the number of locators detected on the link
|
||||
* @hrefs: pointer to the array of locator hrefs
|
||||
* @roles: pointer to the array of locator roles
|
||||
* @nbArcs: the number of arcs detected on the link
|
||||
* @from: pointer to the array of source roles found on the arcs
|
||||
* @to: pointer to the array of target roles found on the arcs
|
||||
* @show: array of values for the show attributes found on the arcs
|
||||
* @actuate: array of values for the actuate attributes found on the arcs
|
||||
* @nbTitles: the number of titles detected on the link
|
||||
* @title: array of titles detected on the link
|
||||
* @langs: array of xml:lang values for the titles
|
||||
*
|
||||
* This is the prototype for a extended link detection callback.
|
||||
*/
|
||||
typedef void
|
||||
(*xlinkExtendedLinkFunk)(void *ctx,
|
||||
xmlNodePtr node,
|
||||
int nbLocators,
|
||||
const xlinkHRef *hrefs,
|
||||
const xlinkRole *roles,
|
||||
int nbArcs,
|
||||
const xlinkRole *from,
|
||||
const xlinkRole *to,
|
||||
xlinkShow *show,
|
||||
xlinkActuate *actuate,
|
||||
int nbTitles,
|
||||
const xlinkTitle *titles,
|
||||
const xmlChar **langs);
|
||||
|
||||
/**
|
||||
* xlinkExtendedLinkSetFunk:
|
||||
* @ctx: user data pointer
|
||||
* @node: the node carrying the link
|
||||
* @nbLocators: the number of locators detected on the link
|
||||
* @hrefs: pointer to the array of locator hrefs
|
||||
* @roles: pointer to the array of locator roles
|
||||
* @nbTitles: the number of titles detected on the link
|
||||
* @title: array of titles detected on the link
|
||||
* @langs: array of xml:lang values for the titles
|
||||
*
|
||||
* This is the prototype for a extended link set detection callback.
|
||||
*/
|
||||
typedef void
|
||||
(*xlinkExtendedLinkSetFunk) (void *ctx,
|
||||
xmlNodePtr node,
|
||||
int nbLocators,
|
||||
const xlinkHRef *hrefs,
|
||||
const xlinkRole *roles,
|
||||
int nbTitles,
|
||||
const xlinkTitle *titles,
|
||||
const xmlChar **langs);
|
||||
|
||||
/**
|
||||
* This is the structure containing a set of Links detection callbacks.
|
||||
*
|
||||
* There is no default xlink callbacks, if one want to get link
|
||||
* recognition activated, those call backs must be provided before parsing.
|
||||
*/
|
||||
typedef struct _xlinkHandler xlinkHandler;
|
||||
typedef xlinkHandler *xlinkHandlerPtr;
|
||||
struct _xlinkHandler {
|
||||
xlinkSimpleLinkFunk simple;
|
||||
xlinkExtendedLinkFunk extended;
|
||||
xlinkExtendedLinkSetFunk set;
|
||||
};
|
||||
|
||||
/*
|
||||
* The default detection routine, can be overridden, they call the default
|
||||
* detection callbacks.
|
||||
*/
|
||||
|
||||
XMLPUBFUN xlinkNodeDetectFunc
|
||||
xlinkGetDefaultDetect (void);
|
||||
XMLPUBFUN void
|
||||
xlinkSetDefaultDetect (xlinkNodeDetectFunc func);
|
||||
|
||||
/*
|
||||
* Routines to set/get the default handlers.
|
||||
*/
|
||||
XMLPUBFUN xlinkHandlerPtr
|
||||
xlinkGetDefaultHandler (void);
|
||||
XMLPUBFUN void
|
||||
xlinkSetDefaultHandler (xlinkHandlerPtr handler);
|
||||
|
||||
/*
|
||||
* Link detection module itself.
|
||||
*/
|
||||
XMLPUBFUN xlinkType
|
||||
xlinkIsLink (xmlDocPtr doc,
|
||||
xmlNodePtr node);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_XPTR_ENABLED */
|
||||
|
||||
#endif /* __XML_XLINK_H__ */
|
||||
+438
@@ -0,0 +1,438 @@
|
||||
/*
|
||||
* Summary: interface for the I/O interfaces used by the parser
|
||||
* Description: interface for the I/O interfaces used by the parser
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_IO_H__
|
||||
#define __XML_IO_H__
|
||||
|
||||
/** DOC_DISABLE */
|
||||
#include <stdio.h>
|
||||
#include <libxml/xmlversion.h>
|
||||
#include <libxml/encoding.h>
|
||||
#define XML_TREE_INTERNALS
|
||||
#include <libxml/tree.h>
|
||||
#undef XML_TREE_INTERNALS
|
||||
/** DOC_ENABLE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Those are the functions and datatypes for the parser input
|
||||
* I/O structures.
|
||||
*/
|
||||
|
||||
/**
|
||||
* xmlInputMatchCallback:
|
||||
* @filename: the filename or URI
|
||||
*
|
||||
* Callback used in the I/O Input API to detect if the current handler
|
||||
* can provide input functionality for this resource.
|
||||
*
|
||||
* Returns 1 if yes and 0 if another Input module should be used
|
||||
*/
|
||||
typedef int (*xmlInputMatchCallback) (char const *filename);
|
||||
/**
|
||||
* xmlInputOpenCallback:
|
||||
* @filename: the filename or URI
|
||||
*
|
||||
* Callback used in the I/O Input API to open the resource
|
||||
*
|
||||
* Returns an Input context or NULL in case or error
|
||||
*/
|
||||
typedef void * (*xmlInputOpenCallback) (char const *filename);
|
||||
/**
|
||||
* xmlInputReadCallback:
|
||||
* @context: an Input context
|
||||
* @buffer: the buffer to store data read
|
||||
* @len: the length of the buffer in bytes
|
||||
*
|
||||
* Callback used in the I/O Input API to read the resource
|
||||
*
|
||||
* Returns the number of bytes read or -1 in case of error
|
||||
*/
|
||||
typedef int (*xmlInputReadCallback) (void * context, char * buffer, int len);
|
||||
/**
|
||||
* xmlInputCloseCallback:
|
||||
* @context: an Input context
|
||||
*
|
||||
* Callback used in the I/O Input API to close the resource
|
||||
*
|
||||
* Returns 0 or -1 in case of error
|
||||
*/
|
||||
typedef int (*xmlInputCloseCallback) (void * context);
|
||||
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
/*
|
||||
* Those are the functions and datatypes for the library output
|
||||
* I/O structures.
|
||||
*/
|
||||
|
||||
/**
|
||||
* xmlOutputMatchCallback:
|
||||
* @filename: the filename or URI
|
||||
*
|
||||
* Callback used in the I/O Output API to detect if the current handler
|
||||
* can provide output functionality for this resource.
|
||||
*
|
||||
* Returns 1 if yes and 0 if another Output module should be used
|
||||
*/
|
||||
typedef int (*xmlOutputMatchCallback) (char const *filename);
|
||||
/**
|
||||
* xmlOutputOpenCallback:
|
||||
* @filename: the filename or URI
|
||||
*
|
||||
* Callback used in the I/O Output API to open the resource
|
||||
*
|
||||
* Returns an Output context or NULL in case or error
|
||||
*/
|
||||
typedef void * (*xmlOutputOpenCallback) (char const *filename);
|
||||
/**
|
||||
* xmlOutputWriteCallback:
|
||||
* @context: an Output context
|
||||
* @buffer: the buffer of data to write
|
||||
* @len: the length of the buffer in bytes
|
||||
*
|
||||
* Callback used in the I/O Output API to write to the resource
|
||||
*
|
||||
* Returns the number of bytes written or -1 in case of error
|
||||
*/
|
||||
typedef int (*xmlOutputWriteCallback) (void * context, const char * buffer,
|
||||
int len);
|
||||
/**
|
||||
* xmlOutputCloseCallback:
|
||||
* @context: an Output context
|
||||
*
|
||||
* Callback used in the I/O Output API to close the resource
|
||||
*
|
||||
* Returns 0 or -1 in case of error
|
||||
*/
|
||||
typedef int (*xmlOutputCloseCallback) (void * context);
|
||||
#endif /* LIBXML_OUTPUT_ENABLED */
|
||||
|
||||
/**
|
||||
* xmlParserInputBufferCreateFilenameFunc:
|
||||
* @URI: the URI to read from
|
||||
* @enc: the requested source encoding
|
||||
*
|
||||
* Signature for the function doing the lookup for a suitable input method
|
||||
* corresponding to an URI.
|
||||
*
|
||||
* Returns the new xmlParserInputBufferPtr in case of success or NULL if no
|
||||
* method was found.
|
||||
*/
|
||||
typedef xmlParserInputBufferPtr
|
||||
(*xmlParserInputBufferCreateFilenameFunc)(const char *URI, xmlCharEncoding enc);
|
||||
|
||||
/**
|
||||
* xmlOutputBufferCreateFilenameFunc:
|
||||
* @URI: the URI to write to
|
||||
* @enc: the requested target encoding
|
||||
*
|
||||
* Signature for the function doing the lookup for a suitable output method
|
||||
* corresponding to an URI.
|
||||
*
|
||||
* Returns the new xmlOutputBufferPtr in case of success or NULL if no
|
||||
* method was found.
|
||||
*/
|
||||
typedef xmlOutputBufferPtr
|
||||
(*xmlOutputBufferCreateFilenameFunc)(const char *URI,
|
||||
xmlCharEncodingHandlerPtr encoder, int compression);
|
||||
|
||||
struct _xmlParserInputBuffer {
|
||||
void* context;
|
||||
xmlInputReadCallback readcallback;
|
||||
xmlInputCloseCallback closecallback;
|
||||
|
||||
xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */
|
||||
|
||||
xmlBufPtr buffer; /* Local buffer encoded in UTF-8 */
|
||||
xmlBufPtr raw; /* if encoder != NULL buffer for raw input */
|
||||
int compressed; /* -1=unknown, 0=not compressed, 1=compressed */
|
||||
int error;
|
||||
unsigned long rawconsumed;/* amount consumed from raw */
|
||||
};
|
||||
|
||||
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
struct _xmlOutputBuffer {
|
||||
void* context;
|
||||
xmlOutputWriteCallback writecallback;
|
||||
xmlOutputCloseCallback closecallback;
|
||||
|
||||
xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */
|
||||
|
||||
xmlBufPtr buffer; /* Local buffer encoded in UTF-8 or ISOLatin */
|
||||
xmlBufPtr conv; /* if encoder != NULL buffer for output */
|
||||
int written; /* total number of byte written */
|
||||
int error;
|
||||
};
|
||||
#endif /* LIBXML_OUTPUT_ENABLED */
|
||||
|
||||
/** DOC_DISABLE */
|
||||
#define XML_GLOBALS_IO \
|
||||
XML_OP(xmlParserInputBufferCreateFilenameValue, \
|
||||
xmlParserInputBufferCreateFilenameFunc, XML_DEPRECATED) \
|
||||
XML_OP(xmlOutputBufferCreateFilenameValue, \
|
||||
xmlOutputBufferCreateFilenameFunc, XML_DEPRECATED)
|
||||
|
||||
#define XML_OP XML_DECLARE_GLOBAL
|
||||
XML_GLOBALS_IO
|
||||
#undef XML_OP
|
||||
|
||||
#if defined(LIBXML_THREAD_ENABLED) && !defined(XML_GLOBALS_NO_REDEFINITION)
|
||||
#define xmlParserInputBufferCreateFilenameValue \
|
||||
XML_GLOBAL_MACRO(xmlParserInputBufferCreateFilenameValue)
|
||||
#define xmlOutputBufferCreateFilenameValue \
|
||||
XML_GLOBAL_MACRO(xmlOutputBufferCreateFilenameValue)
|
||||
#endif
|
||||
/** DOC_ENABLE */
|
||||
|
||||
/*
|
||||
* Interfaces for input
|
||||
*/
|
||||
XMLPUBFUN void
|
||||
xmlCleanupInputCallbacks (void);
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlPopInputCallbacks (void);
|
||||
|
||||
XMLPUBFUN void
|
||||
xmlRegisterDefaultInputCallbacks (void);
|
||||
XMLPUBFUN xmlParserInputBufferPtr
|
||||
xmlAllocParserInputBuffer (xmlCharEncoding enc);
|
||||
|
||||
XMLPUBFUN xmlParserInputBufferPtr
|
||||
xmlParserInputBufferCreateFilename (const char *URI,
|
||||
xmlCharEncoding enc);
|
||||
XMLPUBFUN xmlParserInputBufferPtr
|
||||
xmlParserInputBufferCreateFile (FILE *file,
|
||||
xmlCharEncoding enc);
|
||||
XMLPUBFUN xmlParserInputBufferPtr
|
||||
xmlParserInputBufferCreateFd (int fd,
|
||||
xmlCharEncoding enc);
|
||||
XMLPUBFUN xmlParserInputBufferPtr
|
||||
xmlParserInputBufferCreateMem (const char *mem, int size,
|
||||
xmlCharEncoding enc);
|
||||
XMLPUBFUN xmlParserInputBufferPtr
|
||||
xmlParserInputBufferCreateStatic (const char *mem, int size,
|
||||
xmlCharEncoding enc);
|
||||
XMLPUBFUN xmlParserInputBufferPtr
|
||||
xmlParserInputBufferCreateIO (xmlInputReadCallback ioread,
|
||||
xmlInputCloseCallback ioclose,
|
||||
void *ioctx,
|
||||
xmlCharEncoding enc);
|
||||
XMLPUBFUN int
|
||||
xmlParserInputBufferRead (xmlParserInputBufferPtr in,
|
||||
int len);
|
||||
XMLPUBFUN int
|
||||
xmlParserInputBufferGrow (xmlParserInputBufferPtr in,
|
||||
int len);
|
||||
XMLPUBFUN int
|
||||
xmlParserInputBufferPush (xmlParserInputBufferPtr in,
|
||||
int len,
|
||||
const char *buf);
|
||||
XMLPUBFUN void
|
||||
xmlFreeParserInputBuffer (xmlParserInputBufferPtr in);
|
||||
XMLPUBFUN char *
|
||||
xmlParserGetDirectory (const char *filename);
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc,
|
||||
xmlInputOpenCallback openFunc,
|
||||
xmlInputReadCallback readFunc,
|
||||
xmlInputCloseCallback closeFunc);
|
||||
|
||||
xmlParserInputBufferPtr
|
||||
__xmlParserInputBufferCreateFilename(const char *URI,
|
||||
xmlCharEncoding enc);
|
||||
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
/*
|
||||
* Interfaces for output
|
||||
*/
|
||||
XMLPUBFUN void
|
||||
xmlCleanupOutputCallbacks (void);
|
||||
XMLPUBFUN int
|
||||
xmlPopOutputCallbacks (void);
|
||||
XMLPUBFUN void
|
||||
xmlRegisterDefaultOutputCallbacks(void);
|
||||
XMLPUBFUN xmlOutputBufferPtr
|
||||
xmlAllocOutputBuffer (xmlCharEncodingHandlerPtr encoder);
|
||||
|
||||
XMLPUBFUN xmlOutputBufferPtr
|
||||
xmlOutputBufferCreateFilename (const char *URI,
|
||||
xmlCharEncodingHandlerPtr encoder,
|
||||
int compression);
|
||||
|
||||
XMLPUBFUN xmlOutputBufferPtr
|
||||
xmlOutputBufferCreateFile (FILE *file,
|
||||
xmlCharEncodingHandlerPtr encoder);
|
||||
|
||||
XMLPUBFUN xmlOutputBufferPtr
|
||||
xmlOutputBufferCreateBuffer (xmlBufferPtr buffer,
|
||||
xmlCharEncodingHandlerPtr encoder);
|
||||
|
||||
XMLPUBFUN xmlOutputBufferPtr
|
||||
xmlOutputBufferCreateFd (int fd,
|
||||
xmlCharEncodingHandlerPtr encoder);
|
||||
|
||||
XMLPUBFUN xmlOutputBufferPtr
|
||||
xmlOutputBufferCreateIO (xmlOutputWriteCallback iowrite,
|
||||
xmlOutputCloseCallback ioclose,
|
||||
void *ioctx,
|
||||
xmlCharEncodingHandlerPtr encoder);
|
||||
|
||||
/* Couple of APIs to get the output without digging into the buffers */
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlOutputBufferGetContent (xmlOutputBufferPtr out);
|
||||
XMLPUBFUN size_t
|
||||
xmlOutputBufferGetSize (xmlOutputBufferPtr out);
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlOutputBufferWrite (xmlOutputBufferPtr out,
|
||||
int len,
|
||||
const char *buf);
|
||||
XMLPUBFUN int
|
||||
xmlOutputBufferWriteString (xmlOutputBufferPtr out,
|
||||
const char *str);
|
||||
XMLPUBFUN int
|
||||
xmlOutputBufferWriteEscape (xmlOutputBufferPtr out,
|
||||
const xmlChar *str,
|
||||
xmlCharEncodingOutputFunc escaping);
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlOutputBufferFlush (xmlOutputBufferPtr out);
|
||||
XMLPUBFUN int
|
||||
xmlOutputBufferClose (xmlOutputBufferPtr out);
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlRegisterOutputCallbacks (xmlOutputMatchCallback matchFunc,
|
||||
xmlOutputOpenCallback openFunc,
|
||||
xmlOutputWriteCallback writeFunc,
|
||||
xmlOutputCloseCallback closeFunc);
|
||||
|
||||
xmlOutputBufferPtr
|
||||
__xmlOutputBufferCreateFilename(const char *URI,
|
||||
xmlCharEncodingHandlerPtr encoder,
|
||||
int compression);
|
||||
|
||||
#ifdef LIBXML_HTTP_ENABLED
|
||||
/* This function only exists if HTTP support built into the library */
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlRegisterHTTPPostCallbacks (void );
|
||||
#endif /* LIBXML_HTTP_ENABLED */
|
||||
|
||||
#endif /* LIBXML_OUTPUT_ENABLED */
|
||||
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlParserInputPtr
|
||||
xmlCheckHTTPInput (xmlParserCtxtPtr ctxt,
|
||||
xmlParserInputPtr ret);
|
||||
|
||||
/*
|
||||
* A predefined entity loader disabling network accesses
|
||||
*/
|
||||
XMLPUBFUN xmlParserInputPtr
|
||||
xmlNoNetExternalEntityLoader (const char *URL,
|
||||
const char *ID,
|
||||
xmlParserCtxtPtr ctxt);
|
||||
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlNormalizeWindowsPath (const xmlChar *path);
|
||||
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlCheckFilename (const char *path);
|
||||
/**
|
||||
* Default 'file://' protocol callbacks
|
||||
*/
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlFileMatch (const char *filename);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void *
|
||||
xmlFileOpen (const char *filename);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlFileRead (void * context,
|
||||
char * buffer,
|
||||
int len);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlFileClose (void * context);
|
||||
|
||||
/**
|
||||
* Default 'http://' protocol callbacks
|
||||
*/
|
||||
#ifdef LIBXML_HTTP_ENABLED
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlIOHTTPMatch (const char *filename);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void *
|
||||
xmlIOHTTPOpen (const char *filename);
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void *
|
||||
xmlIOHTTPOpenW (const char * post_uri,
|
||||
int compression );
|
||||
#endif /* LIBXML_OUTPUT_ENABLED */
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlIOHTTPRead (void * context,
|
||||
char * buffer,
|
||||
int len);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlIOHTTPClose (void * context);
|
||||
#endif /* LIBXML_HTTP_ENABLED */
|
||||
|
||||
/**
|
||||
* Default 'ftp://' protocol callbacks
|
||||
*/
|
||||
#if defined(LIBXML_FTP_ENABLED)
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlIOFTPMatch (const char *filename);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void *
|
||||
xmlIOFTPOpen (const char *filename);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlIOFTPRead (void * context,
|
||||
char * buffer,
|
||||
int len);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlIOFTPClose (void * context);
|
||||
#endif /* defined(LIBXML_FTP_ENABLED) */
|
||||
|
||||
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc
|
||||
xmlParserInputBufferCreateFilenameDefault(
|
||||
xmlParserInputBufferCreateFilenameFunc func);
|
||||
XMLPUBFUN xmlOutputBufferCreateFilenameFunc
|
||||
xmlOutputBufferCreateFilenameDefault(
|
||||
xmlOutputBufferCreateFilenameFunc func);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlOutputBufferCreateFilenameFunc
|
||||
xmlThrDefOutputBufferCreateFilenameDefault(
|
||||
xmlOutputBufferCreateFilenameFunc func);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc
|
||||
xmlThrDefParserInputBufferCreateFilenameDefault(
|
||||
xmlParserInputBufferCreateFilenameFunc func);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XML_IO_H__ */
|
||||
+146
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* Summary: API to build regexp automata
|
||||
* Description: the API to build regexp automata
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_AUTOMATA_H__
|
||||
#define __XML_AUTOMATA_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#ifdef LIBXML_REGEXP_ENABLED
|
||||
#ifdef LIBXML_AUTOMATA_ENABLED
|
||||
|
||||
#include <libxml/xmlstring.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* xmlAutomataPtr:
|
||||
*
|
||||
* A libxml automata description, It can be compiled into a regexp
|
||||
*/
|
||||
typedef struct _xmlAutomata xmlAutomata;
|
||||
typedef xmlAutomata *xmlAutomataPtr;
|
||||
|
||||
/**
|
||||
* xmlAutomataStatePtr:
|
||||
*
|
||||
* A state int the automata description,
|
||||
*/
|
||||
typedef struct _xmlAutomataState xmlAutomataState;
|
||||
typedef xmlAutomataState *xmlAutomataStatePtr;
|
||||
|
||||
/*
|
||||
* Building API
|
||||
*/
|
||||
XMLPUBFUN xmlAutomataPtr
|
||||
xmlNewAutomata (void);
|
||||
XMLPUBFUN void
|
||||
xmlFreeAutomata (xmlAutomataPtr am);
|
||||
|
||||
XMLPUBFUN xmlAutomataStatePtr
|
||||
xmlAutomataGetInitState (xmlAutomataPtr am);
|
||||
XMLPUBFUN int
|
||||
xmlAutomataSetFinalState (xmlAutomataPtr am,
|
||||
xmlAutomataStatePtr state);
|
||||
XMLPUBFUN xmlAutomataStatePtr
|
||||
xmlAutomataNewState (xmlAutomataPtr am);
|
||||
XMLPUBFUN xmlAutomataStatePtr
|
||||
xmlAutomataNewTransition (xmlAutomataPtr am,
|
||||
xmlAutomataStatePtr from,
|
||||
xmlAutomataStatePtr to,
|
||||
const xmlChar *token,
|
||||
void *data);
|
||||
XMLPUBFUN xmlAutomataStatePtr
|
||||
xmlAutomataNewTransition2 (xmlAutomataPtr am,
|
||||
xmlAutomataStatePtr from,
|
||||
xmlAutomataStatePtr to,
|
||||
const xmlChar *token,
|
||||
const xmlChar *token2,
|
||||
void *data);
|
||||
XMLPUBFUN xmlAutomataStatePtr
|
||||
xmlAutomataNewNegTrans (xmlAutomataPtr am,
|
||||
xmlAutomataStatePtr from,
|
||||
xmlAutomataStatePtr to,
|
||||
const xmlChar *token,
|
||||
const xmlChar *token2,
|
||||
void *data);
|
||||
|
||||
XMLPUBFUN xmlAutomataStatePtr
|
||||
xmlAutomataNewCountTrans (xmlAutomataPtr am,
|
||||
xmlAutomataStatePtr from,
|
||||
xmlAutomataStatePtr to,
|
||||
const xmlChar *token,
|
||||
int min,
|
||||
int max,
|
||||
void *data);
|
||||
XMLPUBFUN xmlAutomataStatePtr
|
||||
xmlAutomataNewCountTrans2 (xmlAutomataPtr am,
|
||||
xmlAutomataStatePtr from,
|
||||
xmlAutomataStatePtr to,
|
||||
const xmlChar *token,
|
||||
const xmlChar *token2,
|
||||
int min,
|
||||
int max,
|
||||
void *data);
|
||||
XMLPUBFUN xmlAutomataStatePtr
|
||||
xmlAutomataNewOnceTrans (xmlAutomataPtr am,
|
||||
xmlAutomataStatePtr from,
|
||||
xmlAutomataStatePtr to,
|
||||
const xmlChar *token,
|
||||
int min,
|
||||
int max,
|
||||
void *data);
|
||||
XMLPUBFUN xmlAutomataStatePtr
|
||||
xmlAutomataNewOnceTrans2 (xmlAutomataPtr am,
|
||||
xmlAutomataStatePtr from,
|
||||
xmlAutomataStatePtr to,
|
||||
const xmlChar *token,
|
||||
const xmlChar *token2,
|
||||
int min,
|
||||
int max,
|
||||
void *data);
|
||||
XMLPUBFUN xmlAutomataStatePtr
|
||||
xmlAutomataNewAllTrans (xmlAutomataPtr am,
|
||||
xmlAutomataStatePtr from,
|
||||
xmlAutomataStatePtr to,
|
||||
int lax);
|
||||
XMLPUBFUN xmlAutomataStatePtr
|
||||
xmlAutomataNewEpsilon (xmlAutomataPtr am,
|
||||
xmlAutomataStatePtr from,
|
||||
xmlAutomataStatePtr to);
|
||||
XMLPUBFUN xmlAutomataStatePtr
|
||||
xmlAutomataNewCountedTrans (xmlAutomataPtr am,
|
||||
xmlAutomataStatePtr from,
|
||||
xmlAutomataStatePtr to,
|
||||
int counter);
|
||||
XMLPUBFUN xmlAutomataStatePtr
|
||||
xmlAutomataNewCounterTrans (xmlAutomataPtr am,
|
||||
xmlAutomataStatePtr from,
|
||||
xmlAutomataStatePtr to,
|
||||
int counter);
|
||||
XMLPUBFUN int
|
||||
xmlAutomataNewCounter (xmlAutomataPtr am,
|
||||
int min,
|
||||
int max);
|
||||
|
||||
XMLPUBFUN struct _xmlRegexp *
|
||||
xmlAutomataCompile (xmlAutomataPtr am);
|
||||
XMLPUBFUN int
|
||||
xmlAutomataIsDeterminist (xmlAutomataPtr am);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_AUTOMATA_ENABLED */
|
||||
#endif /* LIBXML_REGEXP_ENABLED */
|
||||
|
||||
#endif /* __XML_AUTOMATA_H__ */
|
||||
+962
@@ -0,0 +1,962 @@
|
||||
/*
|
||||
* Summary: error handling
|
||||
* Description: the API used to report errors
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_ERROR_H__
|
||||
#define __XML_ERROR_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* xmlErrorLevel:
|
||||
*
|
||||
* Indicates the level of an error
|
||||
*/
|
||||
typedef enum {
|
||||
XML_ERR_NONE = 0,
|
||||
XML_ERR_WARNING = 1, /* A simple warning */
|
||||
XML_ERR_ERROR = 2, /* A recoverable error */
|
||||
XML_ERR_FATAL = 3 /* A fatal error */
|
||||
} xmlErrorLevel;
|
||||
|
||||
/**
|
||||
* xmlErrorDomain:
|
||||
*
|
||||
* Indicates where an error may have come from
|
||||
*/
|
||||
typedef enum {
|
||||
XML_FROM_NONE = 0,
|
||||
XML_FROM_PARSER, /* The XML parser */
|
||||
XML_FROM_TREE, /* The tree module */
|
||||
XML_FROM_NAMESPACE, /* The XML Namespace module */
|
||||
XML_FROM_DTD, /* The XML DTD validation with parser context*/
|
||||
XML_FROM_HTML, /* The HTML parser */
|
||||
XML_FROM_MEMORY, /* The memory allocator */
|
||||
XML_FROM_OUTPUT, /* The serialization code */
|
||||
XML_FROM_IO, /* The Input/Output stack */
|
||||
XML_FROM_FTP, /* The FTP module */
|
||||
XML_FROM_HTTP, /* The HTTP module */
|
||||
XML_FROM_XINCLUDE, /* The XInclude processing */
|
||||
XML_FROM_XPATH, /* The XPath module */
|
||||
XML_FROM_XPOINTER, /* The XPointer module */
|
||||
XML_FROM_REGEXP, /* The regular expressions module */
|
||||
XML_FROM_DATATYPE, /* The W3C XML Schemas Datatype module */
|
||||
XML_FROM_SCHEMASP, /* The W3C XML Schemas parser module */
|
||||
XML_FROM_SCHEMASV, /* The W3C XML Schemas validation module */
|
||||
XML_FROM_RELAXNGP, /* The Relax-NG parser module */
|
||||
XML_FROM_RELAXNGV, /* The Relax-NG validator module */
|
||||
XML_FROM_CATALOG, /* The Catalog module */
|
||||
XML_FROM_C14N, /* The Canonicalization module */
|
||||
XML_FROM_XSLT, /* The XSLT engine from libxslt */
|
||||
XML_FROM_VALID, /* The XML DTD validation with valid context */
|
||||
XML_FROM_CHECK, /* The error checking module */
|
||||
XML_FROM_WRITER, /* The xmlwriter module */
|
||||
XML_FROM_MODULE, /* The dynamically loaded module module*/
|
||||
XML_FROM_I18N, /* The module handling character conversion */
|
||||
XML_FROM_SCHEMATRONV,/* The Schematron validator module */
|
||||
XML_FROM_BUFFER, /* The buffers module */
|
||||
XML_FROM_URI /* The URI module */
|
||||
} xmlErrorDomain;
|
||||
|
||||
/**
|
||||
* xmlError:
|
||||
*
|
||||
* An XML Error instance.
|
||||
*/
|
||||
|
||||
typedef struct _xmlError xmlError;
|
||||
typedef xmlError *xmlErrorPtr;
|
||||
struct _xmlError {
|
||||
int domain; /* What part of the library raised this error */
|
||||
int code; /* The error code, e.g. an xmlParserError */
|
||||
char *message;/* human-readable informative error message */
|
||||
xmlErrorLevel level;/* how consequent is the error */
|
||||
char *file; /* the filename */
|
||||
int line; /* the line number if available */
|
||||
char *str1; /* extra string information */
|
||||
char *str2; /* extra string information */
|
||||
char *str3; /* extra string information */
|
||||
int int1; /* extra number information */
|
||||
int int2; /* error column # or 0 if N/A (todo: rename field when we would brk ABI) */
|
||||
void *ctxt; /* the parser context if available */
|
||||
void *node; /* the node in the tree */
|
||||
};
|
||||
|
||||
/**
|
||||
* xmlParserError:
|
||||
*
|
||||
* This is an error that the XML (or HTML) parser can generate
|
||||
*/
|
||||
typedef enum {
|
||||
XML_ERR_OK = 0,
|
||||
XML_ERR_INTERNAL_ERROR, /* 1 */
|
||||
XML_ERR_NO_MEMORY, /* 2 */
|
||||
XML_ERR_DOCUMENT_START, /* 3 */
|
||||
XML_ERR_DOCUMENT_EMPTY, /* 4 */
|
||||
XML_ERR_DOCUMENT_END, /* 5 */
|
||||
XML_ERR_INVALID_HEX_CHARREF, /* 6 */
|
||||
XML_ERR_INVALID_DEC_CHARREF, /* 7 */
|
||||
XML_ERR_INVALID_CHARREF, /* 8 */
|
||||
XML_ERR_INVALID_CHAR, /* 9 */
|
||||
XML_ERR_CHARREF_AT_EOF, /* 10 */
|
||||
XML_ERR_CHARREF_IN_PROLOG, /* 11 */
|
||||
XML_ERR_CHARREF_IN_EPILOG, /* 12 */
|
||||
XML_ERR_CHARREF_IN_DTD, /* 13 */
|
||||
XML_ERR_ENTITYREF_AT_EOF, /* 14 */
|
||||
XML_ERR_ENTITYREF_IN_PROLOG, /* 15 */
|
||||
XML_ERR_ENTITYREF_IN_EPILOG, /* 16 */
|
||||
XML_ERR_ENTITYREF_IN_DTD, /* 17 */
|
||||
XML_ERR_PEREF_AT_EOF, /* 18 */
|
||||
XML_ERR_PEREF_IN_PROLOG, /* 19 */
|
||||
XML_ERR_PEREF_IN_EPILOG, /* 20 */
|
||||
XML_ERR_PEREF_IN_INT_SUBSET, /* 21 */
|
||||
XML_ERR_ENTITYREF_NO_NAME, /* 22 */
|
||||
XML_ERR_ENTITYREF_SEMICOL_MISSING, /* 23 */
|
||||
XML_ERR_PEREF_NO_NAME, /* 24 */
|
||||
XML_ERR_PEREF_SEMICOL_MISSING, /* 25 */
|
||||
XML_ERR_UNDECLARED_ENTITY, /* 26 */
|
||||
XML_WAR_UNDECLARED_ENTITY, /* 27 */
|
||||
XML_ERR_UNPARSED_ENTITY, /* 28 */
|
||||
XML_ERR_ENTITY_IS_EXTERNAL, /* 29 */
|
||||
XML_ERR_ENTITY_IS_PARAMETER, /* 30 */
|
||||
XML_ERR_UNKNOWN_ENCODING, /* 31 */
|
||||
XML_ERR_UNSUPPORTED_ENCODING, /* 32 */
|
||||
XML_ERR_STRING_NOT_STARTED, /* 33 */
|
||||
XML_ERR_STRING_NOT_CLOSED, /* 34 */
|
||||
XML_ERR_NS_DECL_ERROR, /* 35 */
|
||||
XML_ERR_ENTITY_NOT_STARTED, /* 36 */
|
||||
XML_ERR_ENTITY_NOT_FINISHED, /* 37 */
|
||||
XML_ERR_LT_IN_ATTRIBUTE, /* 38 */
|
||||
XML_ERR_ATTRIBUTE_NOT_STARTED, /* 39 */
|
||||
XML_ERR_ATTRIBUTE_NOT_FINISHED, /* 40 */
|
||||
XML_ERR_ATTRIBUTE_WITHOUT_VALUE, /* 41 */
|
||||
XML_ERR_ATTRIBUTE_REDEFINED, /* 42 */
|
||||
XML_ERR_LITERAL_NOT_STARTED, /* 43 */
|
||||
XML_ERR_LITERAL_NOT_FINISHED, /* 44 */
|
||||
XML_ERR_COMMENT_NOT_FINISHED, /* 45 */
|
||||
XML_ERR_PI_NOT_STARTED, /* 46 */
|
||||
XML_ERR_PI_NOT_FINISHED, /* 47 */
|
||||
XML_ERR_NOTATION_NOT_STARTED, /* 48 */
|
||||
XML_ERR_NOTATION_NOT_FINISHED, /* 49 */
|
||||
XML_ERR_ATTLIST_NOT_STARTED, /* 50 */
|
||||
XML_ERR_ATTLIST_NOT_FINISHED, /* 51 */
|
||||
XML_ERR_MIXED_NOT_STARTED, /* 52 */
|
||||
XML_ERR_MIXED_NOT_FINISHED, /* 53 */
|
||||
XML_ERR_ELEMCONTENT_NOT_STARTED, /* 54 */
|
||||
XML_ERR_ELEMCONTENT_NOT_FINISHED, /* 55 */
|
||||
XML_ERR_XMLDECL_NOT_STARTED, /* 56 */
|
||||
XML_ERR_XMLDECL_NOT_FINISHED, /* 57 */
|
||||
XML_ERR_CONDSEC_NOT_STARTED, /* 58 */
|
||||
XML_ERR_CONDSEC_NOT_FINISHED, /* 59 */
|
||||
XML_ERR_EXT_SUBSET_NOT_FINISHED, /* 60 */
|
||||
XML_ERR_DOCTYPE_NOT_FINISHED, /* 61 */
|
||||
XML_ERR_MISPLACED_CDATA_END, /* 62 */
|
||||
XML_ERR_CDATA_NOT_FINISHED, /* 63 */
|
||||
XML_ERR_RESERVED_XML_NAME, /* 64 */
|
||||
XML_ERR_SPACE_REQUIRED, /* 65 */
|
||||
XML_ERR_SEPARATOR_REQUIRED, /* 66 */
|
||||
XML_ERR_NMTOKEN_REQUIRED, /* 67 */
|
||||
XML_ERR_NAME_REQUIRED, /* 68 */
|
||||
XML_ERR_PCDATA_REQUIRED, /* 69 */
|
||||
XML_ERR_URI_REQUIRED, /* 70 */
|
||||
XML_ERR_PUBID_REQUIRED, /* 71 */
|
||||
XML_ERR_LT_REQUIRED, /* 72 */
|
||||
XML_ERR_GT_REQUIRED, /* 73 */
|
||||
XML_ERR_LTSLASH_REQUIRED, /* 74 */
|
||||
XML_ERR_EQUAL_REQUIRED, /* 75 */
|
||||
XML_ERR_TAG_NAME_MISMATCH, /* 76 */
|
||||
XML_ERR_TAG_NOT_FINISHED, /* 77 */
|
||||
XML_ERR_STANDALONE_VALUE, /* 78 */
|
||||
XML_ERR_ENCODING_NAME, /* 79 */
|
||||
XML_ERR_HYPHEN_IN_COMMENT, /* 80 */
|
||||
XML_ERR_INVALID_ENCODING, /* 81 */
|
||||
XML_ERR_EXT_ENTITY_STANDALONE, /* 82 */
|
||||
XML_ERR_CONDSEC_INVALID, /* 83 */
|
||||
XML_ERR_VALUE_REQUIRED, /* 84 */
|
||||
XML_ERR_NOT_WELL_BALANCED, /* 85 */
|
||||
XML_ERR_EXTRA_CONTENT, /* 86 */
|
||||
XML_ERR_ENTITY_CHAR_ERROR, /* 87 */
|
||||
XML_ERR_ENTITY_PE_INTERNAL, /* 88 */
|
||||
XML_ERR_ENTITY_LOOP, /* 89 */
|
||||
XML_ERR_ENTITY_BOUNDARY, /* 90 */
|
||||
XML_ERR_INVALID_URI, /* 91 */
|
||||
XML_ERR_URI_FRAGMENT, /* 92 */
|
||||
XML_WAR_CATALOG_PI, /* 93 */
|
||||
XML_ERR_NO_DTD, /* 94 */
|
||||
XML_ERR_CONDSEC_INVALID_KEYWORD, /* 95 */
|
||||
XML_ERR_VERSION_MISSING, /* 96 */
|
||||
XML_WAR_UNKNOWN_VERSION, /* 97 */
|
||||
XML_WAR_LANG_VALUE, /* 98 */
|
||||
XML_WAR_NS_URI, /* 99 */
|
||||
XML_WAR_NS_URI_RELATIVE, /* 100 */
|
||||
XML_ERR_MISSING_ENCODING, /* 101 */
|
||||
XML_WAR_SPACE_VALUE, /* 102 */
|
||||
XML_ERR_NOT_STANDALONE, /* 103 */
|
||||
XML_ERR_ENTITY_PROCESSING, /* 104 */
|
||||
XML_ERR_NOTATION_PROCESSING, /* 105 */
|
||||
XML_WAR_NS_COLUMN, /* 106 */
|
||||
XML_WAR_ENTITY_REDEFINED, /* 107 */
|
||||
XML_ERR_UNKNOWN_VERSION, /* 108 */
|
||||
XML_ERR_VERSION_MISMATCH, /* 109 */
|
||||
XML_ERR_NAME_TOO_LONG, /* 110 */
|
||||
XML_ERR_USER_STOP, /* 111 */
|
||||
XML_ERR_COMMENT_ABRUPTLY_ENDED, /* 112 */
|
||||
XML_WAR_ENCODING_MISMATCH, /* 113 */
|
||||
XML_ERR_RESOURCE_LIMIT, /* 114 */
|
||||
XML_ERR_ARGUMENT, /* 115 */
|
||||
XML_ERR_SYSTEM, /* 116 */
|
||||
XML_ERR_REDECL_PREDEF_ENTITY, /* 117 */
|
||||
XML_ERR_INT_SUBSET_NOT_FINISHED, /* 118 */
|
||||
XML_NS_ERR_XML_NAMESPACE = 200,
|
||||
XML_NS_ERR_UNDEFINED_NAMESPACE, /* 201 */
|
||||
XML_NS_ERR_QNAME, /* 202 */
|
||||
XML_NS_ERR_ATTRIBUTE_REDEFINED, /* 203 */
|
||||
XML_NS_ERR_EMPTY, /* 204 */
|
||||
XML_NS_ERR_COLON, /* 205 */
|
||||
XML_DTD_ATTRIBUTE_DEFAULT = 500,
|
||||
XML_DTD_ATTRIBUTE_REDEFINED, /* 501 */
|
||||
XML_DTD_ATTRIBUTE_VALUE, /* 502 */
|
||||
XML_DTD_CONTENT_ERROR, /* 503 */
|
||||
XML_DTD_CONTENT_MODEL, /* 504 */
|
||||
XML_DTD_CONTENT_NOT_DETERMINIST, /* 505 */
|
||||
XML_DTD_DIFFERENT_PREFIX, /* 506 */
|
||||
XML_DTD_ELEM_DEFAULT_NAMESPACE, /* 507 */
|
||||
XML_DTD_ELEM_NAMESPACE, /* 508 */
|
||||
XML_DTD_ELEM_REDEFINED, /* 509 */
|
||||
XML_DTD_EMPTY_NOTATION, /* 510 */
|
||||
XML_DTD_ENTITY_TYPE, /* 511 */
|
||||
XML_DTD_ID_FIXED, /* 512 */
|
||||
XML_DTD_ID_REDEFINED, /* 513 */
|
||||
XML_DTD_ID_SUBSET, /* 514 */
|
||||
XML_DTD_INVALID_CHILD, /* 515 */
|
||||
XML_DTD_INVALID_DEFAULT, /* 516 */
|
||||
XML_DTD_LOAD_ERROR, /* 517 */
|
||||
XML_DTD_MISSING_ATTRIBUTE, /* 518 */
|
||||
XML_DTD_MIXED_CORRUPT, /* 519 */
|
||||
XML_DTD_MULTIPLE_ID, /* 520 */
|
||||
XML_DTD_NO_DOC, /* 521 */
|
||||
XML_DTD_NO_DTD, /* 522 */
|
||||
XML_DTD_NO_ELEM_NAME, /* 523 */
|
||||
XML_DTD_NO_PREFIX, /* 524 */
|
||||
XML_DTD_NO_ROOT, /* 525 */
|
||||
XML_DTD_NOTATION_REDEFINED, /* 526 */
|
||||
XML_DTD_NOTATION_VALUE, /* 527 */
|
||||
XML_DTD_NOT_EMPTY, /* 528 */
|
||||
XML_DTD_NOT_PCDATA, /* 529 */
|
||||
XML_DTD_NOT_STANDALONE, /* 530 */
|
||||
XML_DTD_ROOT_NAME, /* 531 */
|
||||
XML_DTD_STANDALONE_WHITE_SPACE, /* 532 */
|
||||
XML_DTD_UNKNOWN_ATTRIBUTE, /* 533 */
|
||||
XML_DTD_UNKNOWN_ELEM, /* 534 */
|
||||
XML_DTD_UNKNOWN_ENTITY, /* 535 */
|
||||
XML_DTD_UNKNOWN_ID, /* 536 */
|
||||
XML_DTD_UNKNOWN_NOTATION, /* 537 */
|
||||
XML_DTD_STANDALONE_DEFAULTED, /* 538 */
|
||||
XML_DTD_XMLID_VALUE, /* 539 */
|
||||
XML_DTD_XMLID_TYPE, /* 540 */
|
||||
XML_DTD_DUP_TOKEN, /* 541 */
|
||||
XML_HTML_STRUCURE_ERROR = 800,
|
||||
XML_HTML_UNKNOWN_TAG, /* 801 */
|
||||
XML_HTML_INCORRECTLY_OPENED_COMMENT, /* 802 */
|
||||
XML_RNGP_ANYNAME_ATTR_ANCESTOR = 1000,
|
||||
XML_RNGP_ATTR_CONFLICT, /* 1001 */
|
||||
XML_RNGP_ATTRIBUTE_CHILDREN, /* 1002 */
|
||||
XML_RNGP_ATTRIBUTE_CONTENT, /* 1003 */
|
||||
XML_RNGP_ATTRIBUTE_EMPTY, /* 1004 */
|
||||
XML_RNGP_ATTRIBUTE_NOOP, /* 1005 */
|
||||
XML_RNGP_CHOICE_CONTENT, /* 1006 */
|
||||
XML_RNGP_CHOICE_EMPTY, /* 1007 */
|
||||
XML_RNGP_CREATE_FAILURE, /* 1008 */
|
||||
XML_RNGP_DATA_CONTENT, /* 1009 */
|
||||
XML_RNGP_DEF_CHOICE_AND_INTERLEAVE, /* 1010 */
|
||||
XML_RNGP_DEFINE_CREATE_FAILED, /* 1011 */
|
||||
XML_RNGP_DEFINE_EMPTY, /* 1012 */
|
||||
XML_RNGP_DEFINE_MISSING, /* 1013 */
|
||||
XML_RNGP_DEFINE_NAME_MISSING, /* 1014 */
|
||||
XML_RNGP_ELEM_CONTENT_EMPTY, /* 1015 */
|
||||
XML_RNGP_ELEM_CONTENT_ERROR, /* 1016 */
|
||||
XML_RNGP_ELEMENT_EMPTY, /* 1017 */
|
||||
XML_RNGP_ELEMENT_CONTENT, /* 1018 */
|
||||
XML_RNGP_ELEMENT_NAME, /* 1019 */
|
||||
XML_RNGP_ELEMENT_NO_CONTENT, /* 1020 */
|
||||
XML_RNGP_ELEM_TEXT_CONFLICT, /* 1021 */
|
||||
XML_RNGP_EMPTY, /* 1022 */
|
||||
XML_RNGP_EMPTY_CONSTRUCT, /* 1023 */
|
||||
XML_RNGP_EMPTY_CONTENT, /* 1024 */
|
||||
XML_RNGP_EMPTY_NOT_EMPTY, /* 1025 */
|
||||
XML_RNGP_ERROR_TYPE_LIB, /* 1026 */
|
||||
XML_RNGP_EXCEPT_EMPTY, /* 1027 */
|
||||
XML_RNGP_EXCEPT_MISSING, /* 1028 */
|
||||
XML_RNGP_EXCEPT_MULTIPLE, /* 1029 */
|
||||
XML_RNGP_EXCEPT_NO_CONTENT, /* 1030 */
|
||||
XML_RNGP_EXTERNALREF_EMTPY, /* 1031 */
|
||||
XML_RNGP_EXTERNAL_REF_FAILURE, /* 1032 */
|
||||
XML_RNGP_EXTERNALREF_RECURSE, /* 1033 */
|
||||
XML_RNGP_FORBIDDEN_ATTRIBUTE, /* 1034 */
|
||||
XML_RNGP_FOREIGN_ELEMENT, /* 1035 */
|
||||
XML_RNGP_GRAMMAR_CONTENT, /* 1036 */
|
||||
XML_RNGP_GRAMMAR_EMPTY, /* 1037 */
|
||||
XML_RNGP_GRAMMAR_MISSING, /* 1038 */
|
||||
XML_RNGP_GRAMMAR_NO_START, /* 1039 */
|
||||
XML_RNGP_GROUP_ATTR_CONFLICT, /* 1040 */
|
||||
XML_RNGP_HREF_ERROR, /* 1041 */
|
||||
XML_RNGP_INCLUDE_EMPTY, /* 1042 */
|
||||
XML_RNGP_INCLUDE_FAILURE, /* 1043 */
|
||||
XML_RNGP_INCLUDE_RECURSE, /* 1044 */
|
||||
XML_RNGP_INTERLEAVE_ADD, /* 1045 */
|
||||
XML_RNGP_INTERLEAVE_CREATE_FAILED, /* 1046 */
|
||||
XML_RNGP_INTERLEAVE_EMPTY, /* 1047 */
|
||||
XML_RNGP_INTERLEAVE_NO_CONTENT, /* 1048 */
|
||||
XML_RNGP_INVALID_DEFINE_NAME, /* 1049 */
|
||||
XML_RNGP_INVALID_URI, /* 1050 */
|
||||
XML_RNGP_INVALID_VALUE, /* 1051 */
|
||||
XML_RNGP_MISSING_HREF, /* 1052 */
|
||||
XML_RNGP_NAME_MISSING, /* 1053 */
|
||||
XML_RNGP_NEED_COMBINE, /* 1054 */
|
||||
XML_RNGP_NOTALLOWED_NOT_EMPTY, /* 1055 */
|
||||
XML_RNGP_NSNAME_ATTR_ANCESTOR, /* 1056 */
|
||||
XML_RNGP_NSNAME_NO_NS, /* 1057 */
|
||||
XML_RNGP_PARAM_FORBIDDEN, /* 1058 */
|
||||
XML_RNGP_PARAM_NAME_MISSING, /* 1059 */
|
||||
XML_RNGP_PARENTREF_CREATE_FAILED, /* 1060 */
|
||||
XML_RNGP_PARENTREF_NAME_INVALID, /* 1061 */
|
||||
XML_RNGP_PARENTREF_NO_NAME, /* 1062 */
|
||||
XML_RNGP_PARENTREF_NO_PARENT, /* 1063 */
|
||||
XML_RNGP_PARENTREF_NOT_EMPTY, /* 1064 */
|
||||
XML_RNGP_PARSE_ERROR, /* 1065 */
|
||||
XML_RNGP_PAT_ANYNAME_EXCEPT_ANYNAME, /* 1066 */
|
||||
XML_RNGP_PAT_ATTR_ATTR, /* 1067 */
|
||||
XML_RNGP_PAT_ATTR_ELEM, /* 1068 */
|
||||
XML_RNGP_PAT_DATA_EXCEPT_ATTR, /* 1069 */
|
||||
XML_RNGP_PAT_DATA_EXCEPT_ELEM, /* 1070 */
|
||||
XML_RNGP_PAT_DATA_EXCEPT_EMPTY, /* 1071 */
|
||||
XML_RNGP_PAT_DATA_EXCEPT_GROUP, /* 1072 */
|
||||
XML_RNGP_PAT_DATA_EXCEPT_INTERLEAVE, /* 1073 */
|
||||
XML_RNGP_PAT_DATA_EXCEPT_LIST, /* 1074 */
|
||||
XML_RNGP_PAT_DATA_EXCEPT_ONEMORE, /* 1075 */
|
||||
XML_RNGP_PAT_DATA_EXCEPT_REF, /* 1076 */
|
||||
XML_RNGP_PAT_DATA_EXCEPT_TEXT, /* 1077 */
|
||||
XML_RNGP_PAT_LIST_ATTR, /* 1078 */
|
||||
XML_RNGP_PAT_LIST_ELEM, /* 1079 */
|
||||
XML_RNGP_PAT_LIST_INTERLEAVE, /* 1080 */
|
||||
XML_RNGP_PAT_LIST_LIST, /* 1081 */
|
||||
XML_RNGP_PAT_LIST_REF, /* 1082 */
|
||||
XML_RNGP_PAT_LIST_TEXT, /* 1083 */
|
||||
XML_RNGP_PAT_NSNAME_EXCEPT_ANYNAME, /* 1084 */
|
||||
XML_RNGP_PAT_NSNAME_EXCEPT_NSNAME, /* 1085 */
|
||||
XML_RNGP_PAT_ONEMORE_GROUP_ATTR, /* 1086 */
|
||||
XML_RNGP_PAT_ONEMORE_INTERLEAVE_ATTR, /* 1087 */
|
||||
XML_RNGP_PAT_START_ATTR, /* 1088 */
|
||||
XML_RNGP_PAT_START_DATA, /* 1089 */
|
||||
XML_RNGP_PAT_START_EMPTY, /* 1090 */
|
||||
XML_RNGP_PAT_START_GROUP, /* 1091 */
|
||||
XML_RNGP_PAT_START_INTERLEAVE, /* 1092 */
|
||||
XML_RNGP_PAT_START_LIST, /* 1093 */
|
||||
XML_RNGP_PAT_START_ONEMORE, /* 1094 */
|
||||
XML_RNGP_PAT_START_TEXT, /* 1095 */
|
||||
XML_RNGP_PAT_START_VALUE, /* 1096 */
|
||||
XML_RNGP_PREFIX_UNDEFINED, /* 1097 */
|
||||
XML_RNGP_REF_CREATE_FAILED, /* 1098 */
|
||||
XML_RNGP_REF_CYCLE, /* 1099 */
|
||||
XML_RNGP_REF_NAME_INVALID, /* 1100 */
|
||||
XML_RNGP_REF_NO_DEF, /* 1101 */
|
||||
XML_RNGP_REF_NO_NAME, /* 1102 */
|
||||
XML_RNGP_REF_NOT_EMPTY, /* 1103 */
|
||||
XML_RNGP_START_CHOICE_AND_INTERLEAVE, /* 1104 */
|
||||
XML_RNGP_START_CONTENT, /* 1105 */
|
||||
XML_RNGP_START_EMPTY, /* 1106 */
|
||||
XML_RNGP_START_MISSING, /* 1107 */
|
||||
XML_RNGP_TEXT_EXPECTED, /* 1108 */
|
||||
XML_RNGP_TEXT_HAS_CHILD, /* 1109 */
|
||||
XML_RNGP_TYPE_MISSING, /* 1110 */
|
||||
XML_RNGP_TYPE_NOT_FOUND, /* 1111 */
|
||||
XML_RNGP_TYPE_VALUE, /* 1112 */
|
||||
XML_RNGP_UNKNOWN_ATTRIBUTE, /* 1113 */
|
||||
XML_RNGP_UNKNOWN_COMBINE, /* 1114 */
|
||||
XML_RNGP_UNKNOWN_CONSTRUCT, /* 1115 */
|
||||
XML_RNGP_UNKNOWN_TYPE_LIB, /* 1116 */
|
||||
XML_RNGP_URI_FRAGMENT, /* 1117 */
|
||||
XML_RNGP_URI_NOT_ABSOLUTE, /* 1118 */
|
||||
XML_RNGP_VALUE_EMPTY, /* 1119 */
|
||||
XML_RNGP_VALUE_NO_CONTENT, /* 1120 */
|
||||
XML_RNGP_XMLNS_NAME, /* 1121 */
|
||||
XML_RNGP_XML_NS, /* 1122 */
|
||||
XML_XPATH_EXPRESSION_OK = 1200,
|
||||
XML_XPATH_NUMBER_ERROR, /* 1201 */
|
||||
XML_XPATH_UNFINISHED_LITERAL_ERROR, /* 1202 */
|
||||
XML_XPATH_START_LITERAL_ERROR, /* 1203 */
|
||||
XML_XPATH_VARIABLE_REF_ERROR, /* 1204 */
|
||||
XML_XPATH_UNDEF_VARIABLE_ERROR, /* 1205 */
|
||||
XML_XPATH_INVALID_PREDICATE_ERROR, /* 1206 */
|
||||
XML_XPATH_EXPR_ERROR, /* 1207 */
|
||||
XML_XPATH_UNCLOSED_ERROR, /* 1208 */
|
||||
XML_XPATH_UNKNOWN_FUNC_ERROR, /* 1209 */
|
||||
XML_XPATH_INVALID_OPERAND, /* 1210 */
|
||||
XML_XPATH_INVALID_TYPE, /* 1211 */
|
||||
XML_XPATH_INVALID_ARITY, /* 1212 */
|
||||
XML_XPATH_INVALID_CTXT_SIZE, /* 1213 */
|
||||
XML_XPATH_INVALID_CTXT_POSITION, /* 1214 */
|
||||
XML_XPATH_MEMORY_ERROR, /* 1215 */
|
||||
XML_XPTR_SYNTAX_ERROR, /* 1216 */
|
||||
XML_XPTR_RESOURCE_ERROR, /* 1217 */
|
||||
XML_XPTR_SUB_RESOURCE_ERROR, /* 1218 */
|
||||
XML_XPATH_UNDEF_PREFIX_ERROR, /* 1219 */
|
||||
XML_XPATH_ENCODING_ERROR, /* 1220 */
|
||||
XML_XPATH_INVALID_CHAR_ERROR, /* 1221 */
|
||||
XML_TREE_INVALID_HEX = 1300,
|
||||
XML_TREE_INVALID_DEC, /* 1301 */
|
||||
XML_TREE_UNTERMINATED_ENTITY, /* 1302 */
|
||||
XML_TREE_NOT_UTF8, /* 1303 */
|
||||
XML_SAVE_NOT_UTF8 = 1400,
|
||||
XML_SAVE_CHAR_INVALID, /* 1401 */
|
||||
XML_SAVE_NO_DOCTYPE, /* 1402 */
|
||||
XML_SAVE_UNKNOWN_ENCODING, /* 1403 */
|
||||
XML_REGEXP_COMPILE_ERROR = 1450,
|
||||
XML_IO_UNKNOWN = 1500,
|
||||
XML_IO_EACCES, /* 1501 */
|
||||
XML_IO_EAGAIN, /* 1502 */
|
||||
XML_IO_EBADF, /* 1503 */
|
||||
XML_IO_EBADMSG, /* 1504 */
|
||||
XML_IO_EBUSY, /* 1505 */
|
||||
XML_IO_ECANCELED, /* 1506 */
|
||||
XML_IO_ECHILD, /* 1507 */
|
||||
XML_IO_EDEADLK, /* 1508 */
|
||||
XML_IO_EDOM, /* 1509 */
|
||||
XML_IO_EEXIST, /* 1510 */
|
||||
XML_IO_EFAULT, /* 1511 */
|
||||
XML_IO_EFBIG, /* 1512 */
|
||||
XML_IO_EINPROGRESS, /* 1513 */
|
||||
XML_IO_EINTR, /* 1514 */
|
||||
XML_IO_EINVAL, /* 1515 */
|
||||
XML_IO_EIO, /* 1516 */
|
||||
XML_IO_EISDIR, /* 1517 */
|
||||
XML_IO_EMFILE, /* 1518 */
|
||||
XML_IO_EMLINK, /* 1519 */
|
||||
XML_IO_EMSGSIZE, /* 1520 */
|
||||
XML_IO_ENAMETOOLONG, /* 1521 */
|
||||
XML_IO_ENFILE, /* 1522 */
|
||||
XML_IO_ENODEV, /* 1523 */
|
||||
XML_IO_ENOENT, /* 1524 */
|
||||
XML_IO_ENOEXEC, /* 1525 */
|
||||
XML_IO_ENOLCK, /* 1526 */
|
||||
XML_IO_ENOMEM, /* 1527 */
|
||||
XML_IO_ENOSPC, /* 1528 */
|
||||
XML_IO_ENOSYS, /* 1529 */
|
||||
XML_IO_ENOTDIR, /* 1530 */
|
||||
XML_IO_ENOTEMPTY, /* 1531 */
|
||||
XML_IO_ENOTSUP, /* 1532 */
|
||||
XML_IO_ENOTTY, /* 1533 */
|
||||
XML_IO_ENXIO, /* 1534 */
|
||||
XML_IO_EPERM, /* 1535 */
|
||||
XML_IO_EPIPE, /* 1536 */
|
||||
XML_IO_ERANGE, /* 1537 */
|
||||
XML_IO_EROFS, /* 1538 */
|
||||
XML_IO_ESPIPE, /* 1539 */
|
||||
XML_IO_ESRCH, /* 1540 */
|
||||
XML_IO_ETIMEDOUT, /* 1541 */
|
||||
XML_IO_EXDEV, /* 1542 */
|
||||
XML_IO_NETWORK_ATTEMPT, /* 1543 */
|
||||
XML_IO_ENCODER, /* 1544 */
|
||||
XML_IO_FLUSH, /* 1545 */
|
||||
XML_IO_WRITE, /* 1546 */
|
||||
XML_IO_NO_INPUT, /* 1547 */
|
||||
XML_IO_BUFFER_FULL, /* 1548 */
|
||||
XML_IO_LOAD_ERROR, /* 1549 */
|
||||
XML_IO_ENOTSOCK, /* 1550 */
|
||||
XML_IO_EISCONN, /* 1551 */
|
||||
XML_IO_ECONNREFUSED, /* 1552 */
|
||||
XML_IO_ENETUNREACH, /* 1553 */
|
||||
XML_IO_EADDRINUSE, /* 1554 */
|
||||
XML_IO_EALREADY, /* 1555 */
|
||||
XML_IO_EAFNOSUPPORT, /* 1556 */
|
||||
XML_IO_UNSUPPORTED_PROTOCOL, /* 1557 */
|
||||
XML_XINCLUDE_RECURSION=1600,
|
||||
XML_XINCLUDE_PARSE_VALUE, /* 1601 */
|
||||
XML_XINCLUDE_ENTITY_DEF_MISMATCH, /* 1602 */
|
||||
XML_XINCLUDE_NO_HREF, /* 1603 */
|
||||
XML_XINCLUDE_NO_FALLBACK, /* 1604 */
|
||||
XML_XINCLUDE_HREF_URI, /* 1605 */
|
||||
XML_XINCLUDE_TEXT_FRAGMENT, /* 1606 */
|
||||
XML_XINCLUDE_TEXT_DOCUMENT, /* 1607 */
|
||||
XML_XINCLUDE_INVALID_CHAR, /* 1608 */
|
||||
XML_XINCLUDE_BUILD_FAILED, /* 1609 */
|
||||
XML_XINCLUDE_UNKNOWN_ENCODING, /* 1610 */
|
||||
XML_XINCLUDE_MULTIPLE_ROOT, /* 1611 */
|
||||
XML_XINCLUDE_XPTR_FAILED, /* 1612 */
|
||||
XML_XINCLUDE_XPTR_RESULT, /* 1613 */
|
||||
XML_XINCLUDE_INCLUDE_IN_INCLUDE, /* 1614 */
|
||||
XML_XINCLUDE_FALLBACKS_IN_INCLUDE, /* 1615 */
|
||||
XML_XINCLUDE_FALLBACK_NOT_IN_INCLUDE, /* 1616 */
|
||||
XML_XINCLUDE_DEPRECATED_NS, /* 1617 */
|
||||
XML_XINCLUDE_FRAGMENT_ID, /* 1618 */
|
||||
XML_CATALOG_MISSING_ATTR = 1650,
|
||||
XML_CATALOG_ENTRY_BROKEN, /* 1651 */
|
||||
XML_CATALOG_PREFER_VALUE, /* 1652 */
|
||||
XML_CATALOG_NOT_CATALOG, /* 1653 */
|
||||
XML_CATALOG_RECURSION, /* 1654 */
|
||||
XML_SCHEMAP_PREFIX_UNDEFINED = 1700,
|
||||
XML_SCHEMAP_ATTRFORMDEFAULT_VALUE, /* 1701 */
|
||||
XML_SCHEMAP_ATTRGRP_NONAME_NOREF, /* 1702 */
|
||||
XML_SCHEMAP_ATTR_NONAME_NOREF, /* 1703 */
|
||||
XML_SCHEMAP_COMPLEXTYPE_NONAME_NOREF, /* 1704 */
|
||||
XML_SCHEMAP_ELEMFORMDEFAULT_VALUE, /* 1705 */
|
||||
XML_SCHEMAP_ELEM_NONAME_NOREF, /* 1706 */
|
||||
XML_SCHEMAP_EXTENSION_NO_BASE, /* 1707 */
|
||||
XML_SCHEMAP_FACET_NO_VALUE, /* 1708 */
|
||||
XML_SCHEMAP_FAILED_BUILD_IMPORT, /* 1709 */
|
||||
XML_SCHEMAP_GROUP_NONAME_NOREF, /* 1710 */
|
||||
XML_SCHEMAP_IMPORT_NAMESPACE_NOT_URI, /* 1711 */
|
||||
XML_SCHEMAP_IMPORT_REDEFINE_NSNAME, /* 1712 */
|
||||
XML_SCHEMAP_IMPORT_SCHEMA_NOT_URI, /* 1713 */
|
||||
XML_SCHEMAP_INVALID_BOOLEAN, /* 1714 */
|
||||
XML_SCHEMAP_INVALID_ENUM, /* 1715 */
|
||||
XML_SCHEMAP_INVALID_FACET, /* 1716 */
|
||||
XML_SCHEMAP_INVALID_FACET_VALUE, /* 1717 */
|
||||
XML_SCHEMAP_INVALID_MAXOCCURS, /* 1718 */
|
||||
XML_SCHEMAP_INVALID_MINOCCURS, /* 1719 */
|
||||
XML_SCHEMAP_INVALID_REF_AND_SUBTYPE, /* 1720 */
|
||||
XML_SCHEMAP_INVALID_WHITE_SPACE, /* 1721 */
|
||||
XML_SCHEMAP_NOATTR_NOREF, /* 1722 */
|
||||
XML_SCHEMAP_NOTATION_NO_NAME, /* 1723 */
|
||||
XML_SCHEMAP_NOTYPE_NOREF, /* 1724 */
|
||||
XML_SCHEMAP_REF_AND_SUBTYPE, /* 1725 */
|
||||
XML_SCHEMAP_RESTRICTION_NONAME_NOREF, /* 1726 */
|
||||
XML_SCHEMAP_SIMPLETYPE_NONAME, /* 1727 */
|
||||
XML_SCHEMAP_TYPE_AND_SUBTYPE, /* 1728 */
|
||||
XML_SCHEMAP_UNKNOWN_ALL_CHILD, /* 1729 */
|
||||
XML_SCHEMAP_UNKNOWN_ANYATTRIBUTE_CHILD, /* 1730 */
|
||||
XML_SCHEMAP_UNKNOWN_ATTR_CHILD, /* 1731 */
|
||||
XML_SCHEMAP_UNKNOWN_ATTRGRP_CHILD, /* 1732 */
|
||||
XML_SCHEMAP_UNKNOWN_ATTRIBUTE_GROUP, /* 1733 */
|
||||
XML_SCHEMAP_UNKNOWN_BASE_TYPE, /* 1734 */
|
||||
XML_SCHEMAP_UNKNOWN_CHOICE_CHILD, /* 1735 */
|
||||
XML_SCHEMAP_UNKNOWN_COMPLEXCONTENT_CHILD, /* 1736 */
|
||||
XML_SCHEMAP_UNKNOWN_COMPLEXTYPE_CHILD, /* 1737 */
|
||||
XML_SCHEMAP_UNKNOWN_ELEM_CHILD, /* 1738 */
|
||||
XML_SCHEMAP_UNKNOWN_EXTENSION_CHILD, /* 1739 */
|
||||
XML_SCHEMAP_UNKNOWN_FACET_CHILD, /* 1740 */
|
||||
XML_SCHEMAP_UNKNOWN_FACET_TYPE, /* 1741 */
|
||||
XML_SCHEMAP_UNKNOWN_GROUP_CHILD, /* 1742 */
|
||||
XML_SCHEMAP_UNKNOWN_IMPORT_CHILD, /* 1743 */
|
||||
XML_SCHEMAP_UNKNOWN_LIST_CHILD, /* 1744 */
|
||||
XML_SCHEMAP_UNKNOWN_NOTATION_CHILD, /* 1745 */
|
||||
XML_SCHEMAP_UNKNOWN_PROCESSCONTENT_CHILD, /* 1746 */
|
||||
XML_SCHEMAP_UNKNOWN_REF, /* 1747 */
|
||||
XML_SCHEMAP_UNKNOWN_RESTRICTION_CHILD, /* 1748 */
|
||||
XML_SCHEMAP_UNKNOWN_SCHEMAS_CHILD, /* 1749 */
|
||||
XML_SCHEMAP_UNKNOWN_SEQUENCE_CHILD, /* 1750 */
|
||||
XML_SCHEMAP_UNKNOWN_SIMPLECONTENT_CHILD, /* 1751 */
|
||||
XML_SCHEMAP_UNKNOWN_SIMPLETYPE_CHILD, /* 1752 */
|
||||
XML_SCHEMAP_UNKNOWN_TYPE, /* 1753 */
|
||||
XML_SCHEMAP_UNKNOWN_UNION_CHILD, /* 1754 */
|
||||
XML_SCHEMAP_ELEM_DEFAULT_FIXED, /* 1755 */
|
||||
XML_SCHEMAP_REGEXP_INVALID, /* 1756 */
|
||||
XML_SCHEMAP_FAILED_LOAD, /* 1757 */
|
||||
XML_SCHEMAP_NOTHING_TO_PARSE, /* 1758 */
|
||||
XML_SCHEMAP_NOROOT, /* 1759 */
|
||||
XML_SCHEMAP_REDEFINED_GROUP, /* 1760 */
|
||||
XML_SCHEMAP_REDEFINED_TYPE, /* 1761 */
|
||||
XML_SCHEMAP_REDEFINED_ELEMENT, /* 1762 */
|
||||
XML_SCHEMAP_REDEFINED_ATTRGROUP, /* 1763 */
|
||||
XML_SCHEMAP_REDEFINED_ATTR, /* 1764 */
|
||||
XML_SCHEMAP_REDEFINED_NOTATION, /* 1765 */
|
||||
XML_SCHEMAP_FAILED_PARSE, /* 1766 */
|
||||
XML_SCHEMAP_UNKNOWN_PREFIX, /* 1767 */
|
||||
XML_SCHEMAP_DEF_AND_PREFIX, /* 1768 */
|
||||
XML_SCHEMAP_UNKNOWN_INCLUDE_CHILD, /* 1769 */
|
||||
XML_SCHEMAP_INCLUDE_SCHEMA_NOT_URI, /* 1770 */
|
||||
XML_SCHEMAP_INCLUDE_SCHEMA_NO_URI, /* 1771 */
|
||||
XML_SCHEMAP_NOT_SCHEMA, /* 1772 */
|
||||
XML_SCHEMAP_UNKNOWN_MEMBER_TYPE, /* 1773 */
|
||||
XML_SCHEMAP_INVALID_ATTR_USE, /* 1774 */
|
||||
XML_SCHEMAP_RECURSIVE, /* 1775 */
|
||||
XML_SCHEMAP_SUPERNUMEROUS_LIST_ITEM_TYPE, /* 1776 */
|
||||
XML_SCHEMAP_INVALID_ATTR_COMBINATION, /* 1777 */
|
||||
XML_SCHEMAP_INVALID_ATTR_INLINE_COMBINATION, /* 1778 */
|
||||
XML_SCHEMAP_MISSING_SIMPLETYPE_CHILD, /* 1779 */
|
||||
XML_SCHEMAP_INVALID_ATTR_NAME, /* 1780 */
|
||||
XML_SCHEMAP_REF_AND_CONTENT, /* 1781 */
|
||||
XML_SCHEMAP_CT_PROPS_CORRECT_1, /* 1782 */
|
||||
XML_SCHEMAP_CT_PROPS_CORRECT_2, /* 1783 */
|
||||
XML_SCHEMAP_CT_PROPS_CORRECT_3, /* 1784 */
|
||||
XML_SCHEMAP_CT_PROPS_CORRECT_4, /* 1785 */
|
||||
XML_SCHEMAP_CT_PROPS_CORRECT_5, /* 1786 */
|
||||
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1, /* 1787 */
|
||||
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_1, /* 1788 */
|
||||
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_2, /* 1789 */
|
||||
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_2, /* 1790 */
|
||||
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_3, /* 1791 */
|
||||
XML_SCHEMAP_WILDCARD_INVALID_NS_MEMBER, /* 1792 */
|
||||
XML_SCHEMAP_INTERSECTION_NOT_EXPRESSIBLE, /* 1793 */
|
||||
XML_SCHEMAP_UNION_NOT_EXPRESSIBLE, /* 1794 */
|
||||
XML_SCHEMAP_SRC_IMPORT_3_1, /* 1795 */
|
||||
XML_SCHEMAP_SRC_IMPORT_3_2, /* 1796 */
|
||||
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_1, /* 1797 */
|
||||
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_2, /* 1798 */
|
||||
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_3, /* 1799 */
|
||||
XML_SCHEMAP_COS_CT_EXTENDS_1_3, /* 1800 */
|
||||
XML_SCHEMAV_NOROOT = 1801,
|
||||
XML_SCHEMAV_UNDECLAREDELEM, /* 1802 */
|
||||
XML_SCHEMAV_NOTTOPLEVEL, /* 1803 */
|
||||
XML_SCHEMAV_MISSING, /* 1804 */
|
||||
XML_SCHEMAV_WRONGELEM, /* 1805 */
|
||||
XML_SCHEMAV_NOTYPE, /* 1806 */
|
||||
XML_SCHEMAV_NOROLLBACK, /* 1807 */
|
||||
XML_SCHEMAV_ISABSTRACT, /* 1808 */
|
||||
XML_SCHEMAV_NOTEMPTY, /* 1809 */
|
||||
XML_SCHEMAV_ELEMCONT, /* 1810 */
|
||||
XML_SCHEMAV_HAVEDEFAULT, /* 1811 */
|
||||
XML_SCHEMAV_NOTNILLABLE, /* 1812 */
|
||||
XML_SCHEMAV_EXTRACONTENT, /* 1813 */
|
||||
XML_SCHEMAV_INVALIDATTR, /* 1814 */
|
||||
XML_SCHEMAV_INVALIDELEM, /* 1815 */
|
||||
XML_SCHEMAV_NOTDETERMINIST, /* 1816 */
|
||||
XML_SCHEMAV_CONSTRUCT, /* 1817 */
|
||||
XML_SCHEMAV_INTERNAL, /* 1818 */
|
||||
XML_SCHEMAV_NOTSIMPLE, /* 1819 */
|
||||
XML_SCHEMAV_ATTRUNKNOWN, /* 1820 */
|
||||
XML_SCHEMAV_ATTRINVALID, /* 1821 */
|
||||
XML_SCHEMAV_VALUE, /* 1822 */
|
||||
XML_SCHEMAV_FACET, /* 1823 */
|
||||
XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1, /* 1824 */
|
||||
XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_2, /* 1825 */
|
||||
XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_3, /* 1826 */
|
||||
XML_SCHEMAV_CVC_TYPE_3_1_1, /* 1827 */
|
||||
XML_SCHEMAV_CVC_TYPE_3_1_2, /* 1828 */
|
||||
XML_SCHEMAV_CVC_FACET_VALID, /* 1829 */
|
||||
XML_SCHEMAV_CVC_LENGTH_VALID, /* 1830 */
|
||||
XML_SCHEMAV_CVC_MINLENGTH_VALID, /* 1831 */
|
||||
XML_SCHEMAV_CVC_MAXLENGTH_VALID, /* 1832 */
|
||||
XML_SCHEMAV_CVC_MININCLUSIVE_VALID, /* 1833 */
|
||||
XML_SCHEMAV_CVC_MAXINCLUSIVE_VALID, /* 1834 */
|
||||
XML_SCHEMAV_CVC_MINEXCLUSIVE_VALID, /* 1835 */
|
||||
XML_SCHEMAV_CVC_MAXEXCLUSIVE_VALID, /* 1836 */
|
||||
XML_SCHEMAV_CVC_TOTALDIGITS_VALID, /* 1837 */
|
||||
XML_SCHEMAV_CVC_FRACTIONDIGITS_VALID, /* 1838 */
|
||||
XML_SCHEMAV_CVC_PATTERN_VALID, /* 1839 */
|
||||
XML_SCHEMAV_CVC_ENUMERATION_VALID, /* 1840 */
|
||||
XML_SCHEMAV_CVC_COMPLEX_TYPE_2_1, /* 1841 */
|
||||
XML_SCHEMAV_CVC_COMPLEX_TYPE_2_2, /* 1842 */
|
||||
XML_SCHEMAV_CVC_COMPLEX_TYPE_2_3, /* 1843 */
|
||||
XML_SCHEMAV_CVC_COMPLEX_TYPE_2_4, /* 1844 */
|
||||
XML_SCHEMAV_CVC_ELT_1, /* 1845 */
|
||||
XML_SCHEMAV_CVC_ELT_2, /* 1846 */
|
||||
XML_SCHEMAV_CVC_ELT_3_1, /* 1847 */
|
||||
XML_SCHEMAV_CVC_ELT_3_2_1, /* 1848 */
|
||||
XML_SCHEMAV_CVC_ELT_3_2_2, /* 1849 */
|
||||
XML_SCHEMAV_CVC_ELT_4_1, /* 1850 */
|
||||
XML_SCHEMAV_CVC_ELT_4_2, /* 1851 */
|
||||
XML_SCHEMAV_CVC_ELT_4_3, /* 1852 */
|
||||
XML_SCHEMAV_CVC_ELT_5_1_1, /* 1853 */
|
||||
XML_SCHEMAV_CVC_ELT_5_1_2, /* 1854 */
|
||||
XML_SCHEMAV_CVC_ELT_5_2_1, /* 1855 */
|
||||
XML_SCHEMAV_CVC_ELT_5_2_2_1, /* 1856 */
|
||||
XML_SCHEMAV_CVC_ELT_5_2_2_2_1, /* 1857 */
|
||||
XML_SCHEMAV_CVC_ELT_5_2_2_2_2, /* 1858 */
|
||||
XML_SCHEMAV_CVC_ELT_6, /* 1859 */
|
||||
XML_SCHEMAV_CVC_ELT_7, /* 1860 */
|
||||
XML_SCHEMAV_CVC_ATTRIBUTE_1, /* 1861 */
|
||||
XML_SCHEMAV_CVC_ATTRIBUTE_2, /* 1862 */
|
||||
XML_SCHEMAV_CVC_ATTRIBUTE_3, /* 1863 */
|
||||
XML_SCHEMAV_CVC_ATTRIBUTE_4, /* 1864 */
|
||||
XML_SCHEMAV_CVC_COMPLEX_TYPE_3_1, /* 1865 */
|
||||
XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_1, /* 1866 */
|
||||
XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_2, /* 1867 */
|
||||
XML_SCHEMAV_CVC_COMPLEX_TYPE_4, /* 1868 */
|
||||
XML_SCHEMAV_CVC_COMPLEX_TYPE_5_1, /* 1869 */
|
||||
XML_SCHEMAV_CVC_COMPLEX_TYPE_5_2, /* 1870 */
|
||||
XML_SCHEMAV_ELEMENT_CONTENT, /* 1871 */
|
||||
XML_SCHEMAV_DOCUMENT_ELEMENT_MISSING, /* 1872 */
|
||||
XML_SCHEMAV_CVC_COMPLEX_TYPE_1, /* 1873 */
|
||||
XML_SCHEMAV_CVC_AU, /* 1874 */
|
||||
XML_SCHEMAV_CVC_TYPE_1, /* 1875 */
|
||||
XML_SCHEMAV_CVC_TYPE_2, /* 1876 */
|
||||
XML_SCHEMAV_CVC_IDC, /* 1877 */
|
||||
XML_SCHEMAV_CVC_WILDCARD, /* 1878 */
|
||||
XML_SCHEMAV_MISC, /* 1879 */
|
||||
XML_XPTR_UNKNOWN_SCHEME = 1900,
|
||||
XML_XPTR_CHILDSEQ_START, /* 1901 */
|
||||
XML_XPTR_EVAL_FAILED, /* 1902 */
|
||||
XML_XPTR_EXTRA_OBJECTS, /* 1903 */
|
||||
XML_C14N_CREATE_CTXT = 1950,
|
||||
XML_C14N_REQUIRES_UTF8, /* 1951 */
|
||||
XML_C14N_CREATE_STACK, /* 1952 */
|
||||
XML_C14N_INVALID_NODE, /* 1953 */
|
||||
XML_C14N_UNKNOW_NODE, /* 1954 */
|
||||
XML_C14N_RELATIVE_NAMESPACE, /* 1955 */
|
||||
XML_FTP_PASV_ANSWER = 2000,
|
||||
XML_FTP_EPSV_ANSWER, /* 2001 */
|
||||
XML_FTP_ACCNT, /* 2002 */
|
||||
XML_FTP_URL_SYNTAX, /* 2003 */
|
||||
XML_HTTP_URL_SYNTAX = 2020,
|
||||
XML_HTTP_USE_IP, /* 2021 */
|
||||
XML_HTTP_UNKNOWN_HOST, /* 2022 */
|
||||
XML_SCHEMAP_SRC_SIMPLE_TYPE_1 = 3000,
|
||||
XML_SCHEMAP_SRC_SIMPLE_TYPE_2, /* 3001 */
|
||||
XML_SCHEMAP_SRC_SIMPLE_TYPE_3, /* 3002 */
|
||||
XML_SCHEMAP_SRC_SIMPLE_TYPE_4, /* 3003 */
|
||||
XML_SCHEMAP_SRC_RESOLVE, /* 3004 */
|
||||
XML_SCHEMAP_SRC_RESTRICTION_BASE_OR_SIMPLETYPE, /* 3005 */
|
||||
XML_SCHEMAP_SRC_LIST_ITEMTYPE_OR_SIMPLETYPE, /* 3006 */
|
||||
XML_SCHEMAP_SRC_UNION_MEMBERTYPES_OR_SIMPLETYPES, /* 3007 */
|
||||
XML_SCHEMAP_ST_PROPS_CORRECT_1, /* 3008 */
|
||||
XML_SCHEMAP_ST_PROPS_CORRECT_2, /* 3009 */
|
||||
XML_SCHEMAP_ST_PROPS_CORRECT_3, /* 3010 */
|
||||
XML_SCHEMAP_COS_ST_RESTRICTS_1_1, /* 3011 */
|
||||
XML_SCHEMAP_COS_ST_RESTRICTS_1_2, /* 3012 */
|
||||
XML_SCHEMAP_COS_ST_RESTRICTS_1_3_1, /* 3013 */
|
||||
XML_SCHEMAP_COS_ST_RESTRICTS_1_3_2, /* 3014 */
|
||||
XML_SCHEMAP_COS_ST_RESTRICTS_2_1, /* 3015 */
|
||||
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_1, /* 3016 */
|
||||
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_2, /* 3017 */
|
||||
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_1, /* 3018 */
|
||||
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_2, /* 3019 */
|
||||
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_3, /* 3020 */
|
||||
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_4, /* 3021 */
|
||||
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_5, /* 3022 */
|
||||
XML_SCHEMAP_COS_ST_RESTRICTS_3_1, /* 3023 */
|
||||
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1, /* 3024 */
|
||||
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1_2, /* 3025 */
|
||||
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_2, /* 3026 */
|
||||
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_1, /* 3027 */
|
||||
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_3, /* 3028 */
|
||||
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_4, /* 3029 */
|
||||
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_5, /* 3030 */
|
||||
XML_SCHEMAP_COS_ST_DERIVED_OK_2_1, /* 3031 */
|
||||
XML_SCHEMAP_COS_ST_DERIVED_OK_2_2, /* 3032 */
|
||||
XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, /* 3033 */
|
||||
XML_SCHEMAP_S4S_ELEM_MISSING, /* 3034 */
|
||||
XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, /* 3035 */
|
||||
XML_SCHEMAP_S4S_ATTR_MISSING, /* 3036 */
|
||||
XML_SCHEMAP_S4S_ATTR_INVALID_VALUE, /* 3037 */
|
||||
XML_SCHEMAP_SRC_ELEMENT_1, /* 3038 */
|
||||
XML_SCHEMAP_SRC_ELEMENT_2_1, /* 3039 */
|
||||
XML_SCHEMAP_SRC_ELEMENT_2_2, /* 3040 */
|
||||
XML_SCHEMAP_SRC_ELEMENT_3, /* 3041 */
|
||||
XML_SCHEMAP_P_PROPS_CORRECT_1, /* 3042 */
|
||||
XML_SCHEMAP_P_PROPS_CORRECT_2_1, /* 3043 */
|
||||
XML_SCHEMAP_P_PROPS_CORRECT_2_2, /* 3044 */
|
||||
XML_SCHEMAP_E_PROPS_CORRECT_2, /* 3045 */
|
||||
XML_SCHEMAP_E_PROPS_CORRECT_3, /* 3046 */
|
||||
XML_SCHEMAP_E_PROPS_CORRECT_4, /* 3047 */
|
||||
XML_SCHEMAP_E_PROPS_CORRECT_5, /* 3048 */
|
||||
XML_SCHEMAP_E_PROPS_CORRECT_6, /* 3049 */
|
||||
XML_SCHEMAP_SRC_INCLUDE, /* 3050 */
|
||||
XML_SCHEMAP_SRC_ATTRIBUTE_1, /* 3051 */
|
||||
XML_SCHEMAP_SRC_ATTRIBUTE_2, /* 3052 */
|
||||
XML_SCHEMAP_SRC_ATTRIBUTE_3_1, /* 3053 */
|
||||
XML_SCHEMAP_SRC_ATTRIBUTE_3_2, /* 3054 */
|
||||
XML_SCHEMAP_SRC_ATTRIBUTE_4, /* 3055 */
|
||||
XML_SCHEMAP_NO_XMLNS, /* 3056 */
|
||||
XML_SCHEMAP_NO_XSI, /* 3057 */
|
||||
XML_SCHEMAP_COS_VALID_DEFAULT_1, /* 3058 */
|
||||
XML_SCHEMAP_COS_VALID_DEFAULT_2_1, /* 3059 */
|
||||
XML_SCHEMAP_COS_VALID_DEFAULT_2_2_1, /* 3060 */
|
||||
XML_SCHEMAP_COS_VALID_DEFAULT_2_2_2, /* 3061 */
|
||||
XML_SCHEMAP_CVC_SIMPLE_TYPE, /* 3062 */
|
||||
XML_SCHEMAP_COS_CT_EXTENDS_1_1, /* 3063 */
|
||||
XML_SCHEMAP_SRC_IMPORT_1_1, /* 3064 */
|
||||
XML_SCHEMAP_SRC_IMPORT_1_2, /* 3065 */
|
||||
XML_SCHEMAP_SRC_IMPORT_2, /* 3066 */
|
||||
XML_SCHEMAP_SRC_IMPORT_2_1, /* 3067 */
|
||||
XML_SCHEMAP_SRC_IMPORT_2_2, /* 3068 */
|
||||
XML_SCHEMAP_INTERNAL, /* 3069 non-W3C */
|
||||
XML_SCHEMAP_NOT_DETERMINISTIC, /* 3070 non-W3C */
|
||||
XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_1, /* 3071 */
|
||||
XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_2, /* 3072 */
|
||||
XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_3, /* 3073 */
|
||||
XML_SCHEMAP_MG_PROPS_CORRECT_1, /* 3074 */
|
||||
XML_SCHEMAP_MG_PROPS_CORRECT_2, /* 3075 */
|
||||
XML_SCHEMAP_SRC_CT_1, /* 3076 */
|
||||
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_3, /* 3077 */
|
||||
XML_SCHEMAP_AU_PROPS_CORRECT_2, /* 3078 */
|
||||
XML_SCHEMAP_A_PROPS_CORRECT_2, /* 3079 */
|
||||
XML_SCHEMAP_C_PROPS_CORRECT, /* 3080 */
|
||||
XML_SCHEMAP_SRC_REDEFINE, /* 3081 */
|
||||
XML_SCHEMAP_SRC_IMPORT, /* 3082 */
|
||||
XML_SCHEMAP_WARN_SKIP_SCHEMA, /* 3083 */
|
||||
XML_SCHEMAP_WARN_UNLOCATED_SCHEMA, /* 3084 */
|
||||
XML_SCHEMAP_WARN_ATTR_REDECL_PROH, /* 3085 */
|
||||
XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH, /* 3085 */
|
||||
XML_SCHEMAP_AG_PROPS_CORRECT, /* 3086 */
|
||||
XML_SCHEMAP_COS_CT_EXTENDS_1_2, /* 3087 */
|
||||
XML_SCHEMAP_AU_PROPS_CORRECT, /* 3088 */
|
||||
XML_SCHEMAP_A_PROPS_CORRECT_3, /* 3089 */
|
||||
XML_SCHEMAP_COS_ALL_LIMITED, /* 3090 */
|
||||
XML_SCHEMATRONV_ASSERT = 4000, /* 4000 */
|
||||
XML_SCHEMATRONV_REPORT,
|
||||
XML_MODULE_OPEN = 4900, /* 4900 */
|
||||
XML_MODULE_CLOSE, /* 4901 */
|
||||
XML_CHECK_FOUND_ELEMENT = 5000,
|
||||
XML_CHECK_FOUND_ATTRIBUTE, /* 5001 */
|
||||
XML_CHECK_FOUND_TEXT, /* 5002 */
|
||||
XML_CHECK_FOUND_CDATA, /* 5003 */
|
||||
XML_CHECK_FOUND_ENTITYREF, /* 5004 */
|
||||
XML_CHECK_FOUND_ENTITY, /* 5005 */
|
||||
XML_CHECK_FOUND_PI, /* 5006 */
|
||||
XML_CHECK_FOUND_COMMENT, /* 5007 */
|
||||
XML_CHECK_FOUND_DOCTYPE, /* 5008 */
|
||||
XML_CHECK_FOUND_FRAGMENT, /* 5009 */
|
||||
XML_CHECK_FOUND_NOTATION, /* 5010 */
|
||||
XML_CHECK_UNKNOWN_NODE, /* 5011 */
|
||||
XML_CHECK_ENTITY_TYPE, /* 5012 */
|
||||
XML_CHECK_NO_PARENT, /* 5013 */
|
||||
XML_CHECK_NO_DOC, /* 5014 */
|
||||
XML_CHECK_NO_NAME, /* 5015 */
|
||||
XML_CHECK_NO_ELEM, /* 5016 */
|
||||
XML_CHECK_WRONG_DOC, /* 5017 */
|
||||
XML_CHECK_NO_PREV, /* 5018 */
|
||||
XML_CHECK_WRONG_PREV, /* 5019 */
|
||||
XML_CHECK_NO_NEXT, /* 5020 */
|
||||
XML_CHECK_WRONG_NEXT, /* 5021 */
|
||||
XML_CHECK_NOT_DTD, /* 5022 */
|
||||
XML_CHECK_NOT_ATTR, /* 5023 */
|
||||
XML_CHECK_NOT_ATTR_DECL, /* 5024 */
|
||||
XML_CHECK_NOT_ELEM_DECL, /* 5025 */
|
||||
XML_CHECK_NOT_ENTITY_DECL, /* 5026 */
|
||||
XML_CHECK_NOT_NS_DECL, /* 5027 */
|
||||
XML_CHECK_NO_HREF, /* 5028 */
|
||||
XML_CHECK_WRONG_PARENT,/* 5029 */
|
||||
XML_CHECK_NS_SCOPE, /* 5030 */
|
||||
XML_CHECK_NS_ANCESTOR, /* 5031 */
|
||||
XML_CHECK_NOT_UTF8, /* 5032 */
|
||||
XML_CHECK_NO_DICT, /* 5033 */
|
||||
XML_CHECK_NOT_NCNAME, /* 5034 */
|
||||
XML_CHECK_OUTSIDE_DICT, /* 5035 */
|
||||
XML_CHECK_WRONG_NAME, /* 5036 */
|
||||
XML_CHECK_NAME_NOT_NULL, /* 5037 */
|
||||
XML_I18N_NO_NAME = 6000,
|
||||
XML_I18N_NO_HANDLER, /* 6001 */
|
||||
XML_I18N_EXCESS_HANDLER, /* 6002 */
|
||||
XML_I18N_CONV_FAILED, /* 6003 */
|
||||
XML_I18N_NO_OUTPUT, /* 6004 */
|
||||
XML_BUF_OVERFLOW = 7000
|
||||
} xmlParserErrors;
|
||||
|
||||
/**
|
||||
* xmlGenericErrorFunc:
|
||||
* @ctx: a parsing context
|
||||
* @msg: the message
|
||||
* @...: the extra arguments of the varargs to format the message
|
||||
*
|
||||
* Signature of the function to use when there is an error and
|
||||
* no parsing or validity context available .
|
||||
*/
|
||||
typedef void (*xmlGenericErrorFunc) (void *ctx,
|
||||
const char *msg,
|
||||
...) LIBXML_ATTR_FORMAT(2,3);
|
||||
/**
|
||||
* xmlStructuredErrorFunc:
|
||||
* @userData: user provided data for the error callback
|
||||
* @error: the error being raised.
|
||||
*
|
||||
* Signature of the function to use when there is an error and
|
||||
* the module handles the new error reporting mechanism.
|
||||
*/
|
||||
typedef void (*xmlStructuredErrorFunc) (void *userData, const xmlError *error);
|
||||
|
||||
/** DOC_DISABLE */
|
||||
#define XML_GLOBALS_ERROR \
|
||||
XML_OP(xmlLastError, xmlError, XML_DEPRECATED) \
|
||||
XML_OP(xmlGenericError, xmlGenericErrorFunc, XML_NO_ATTR) \
|
||||
XML_OP(xmlGenericErrorContext, void *, XML_NO_ATTR) \
|
||||
XML_OP(xmlStructuredError, xmlStructuredErrorFunc, XML_NO_ATTR) \
|
||||
XML_OP(xmlStructuredErrorContext, void *, XML_NO_ATTR)
|
||||
|
||||
#define XML_OP XML_DECLARE_GLOBAL
|
||||
XML_GLOBALS_ERROR
|
||||
#undef XML_OP
|
||||
|
||||
#if defined(LIBXML_THREAD_ENABLED) && !defined(XML_GLOBALS_NO_REDEFINITION)
|
||||
#define xmlLastError XML_GLOBAL_MACRO(xmlLastError)
|
||||
#define xmlGenericError XML_GLOBAL_MACRO(xmlGenericError)
|
||||
#define xmlGenericErrorContext XML_GLOBAL_MACRO(xmlGenericErrorContext)
|
||||
#define xmlStructuredError XML_GLOBAL_MACRO(xmlStructuredError)
|
||||
#define xmlStructuredErrorContext XML_GLOBAL_MACRO(xmlStructuredErrorContext)
|
||||
#endif
|
||||
/** DOC_ENABLE */
|
||||
|
||||
/*
|
||||
* Use the following function to reset the two global variables
|
||||
* xmlGenericError and xmlGenericErrorContext.
|
||||
*/
|
||||
XMLPUBFUN void
|
||||
xmlSetGenericErrorFunc (void *ctx,
|
||||
xmlGenericErrorFunc handler);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlThrDefSetGenericErrorFunc(void *ctx,
|
||||
xmlGenericErrorFunc handler);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
initGenericErrorDefaultFunc (xmlGenericErrorFunc *handler);
|
||||
|
||||
XMLPUBFUN void
|
||||
xmlSetStructuredErrorFunc (void *ctx,
|
||||
xmlStructuredErrorFunc handler);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlThrDefSetStructuredErrorFunc(void *ctx,
|
||||
xmlStructuredErrorFunc handler);
|
||||
/*
|
||||
* Default message routines used by SAX and Valid context for error
|
||||
* and warning reporting.
|
||||
*/
|
||||
XMLPUBFUN void
|
||||
xmlParserError (void *ctx,
|
||||
const char *msg,
|
||||
...) LIBXML_ATTR_FORMAT(2,3);
|
||||
XMLPUBFUN void
|
||||
xmlParserWarning (void *ctx,
|
||||
const char *msg,
|
||||
...) LIBXML_ATTR_FORMAT(2,3);
|
||||
XMLPUBFUN void
|
||||
xmlParserValidityError (void *ctx,
|
||||
const char *msg,
|
||||
...) LIBXML_ATTR_FORMAT(2,3);
|
||||
XMLPUBFUN void
|
||||
xmlParserValidityWarning (void *ctx,
|
||||
const char *msg,
|
||||
...) LIBXML_ATTR_FORMAT(2,3);
|
||||
/** DOC_DISABLE */
|
||||
struct _xmlParserInput;
|
||||
/** DOC_ENABLE */
|
||||
XMLPUBFUN void
|
||||
xmlParserPrintFileInfo (struct _xmlParserInput *input);
|
||||
XMLPUBFUN void
|
||||
xmlParserPrintFileContext (struct _xmlParserInput *input);
|
||||
XMLPUBFUN void
|
||||
xmlFormatError (const xmlError *err,
|
||||
xmlGenericErrorFunc channel,
|
||||
void *data);
|
||||
|
||||
/*
|
||||
* Extended error information routines
|
||||
*/
|
||||
XMLPUBFUN const xmlError *
|
||||
xmlGetLastError (void);
|
||||
XMLPUBFUN void
|
||||
xmlResetLastError (void);
|
||||
XMLPUBFUN const xmlError *
|
||||
xmlCtxtGetLastError (void *ctx);
|
||||
XMLPUBFUN void
|
||||
xmlCtxtResetLastError (void *ctx);
|
||||
XMLPUBFUN void
|
||||
xmlResetError (xmlErrorPtr err);
|
||||
XMLPUBFUN int
|
||||
xmlCopyError (const xmlError *from,
|
||||
xmlErrorPtr to);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __XML_ERROR_H__ */
|
||||
+146
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* Summary: macros for marking symbols as exportable/importable.
|
||||
* Description: macros for marking symbols as exportable/importable.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*/
|
||||
|
||||
#ifndef __XML_EXPORTS_H__
|
||||
#define __XML_EXPORTS_H__
|
||||
|
||||
/** DOC_DISABLE */
|
||||
|
||||
/*
|
||||
* Symbol visibility
|
||||
*/
|
||||
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
#ifdef LIBXML_STATIC
|
||||
#define XMLPUBLIC
|
||||
#elif defined(IN_LIBXML)
|
||||
#define XMLPUBLIC __declspec(dllexport)
|
||||
#else
|
||||
#define XMLPUBLIC __declspec(dllimport)
|
||||
#endif
|
||||
#else /* not Windows */
|
||||
#define XMLPUBLIC
|
||||
#endif /* platform switch */
|
||||
|
||||
#define XMLPUBFUN XMLPUBLIC
|
||||
|
||||
#define XMLPUBVAR XMLPUBLIC extern
|
||||
|
||||
/* Compatibility */
|
||||
#define XMLCALL
|
||||
#define XMLCDECL
|
||||
#ifndef LIBXML_DLL_IMPORT
|
||||
#define LIBXML_DLL_IMPORT XMLPUBVAR
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Attributes
|
||||
*/
|
||||
|
||||
#ifndef ATTRIBUTE_UNUSED
|
||||
#if __GNUC__ * 100 + __GNUC_MINOR__ >= 207 || defined(__clang__)
|
||||
#define ATTRIBUTE_UNUSED __attribute__((unused))
|
||||
#else
|
||||
#define ATTRIBUTE_UNUSED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(__clang__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 403)
|
||||
#define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
|
||||
#else
|
||||
#define LIBXML_ATTR_ALLOC_SIZE(x)
|
||||
#endif
|
||||
|
||||
#if __GNUC__ * 100 + __GNUC_MINOR__ >= 303
|
||||
#define LIBXML_ATTR_FORMAT(fmt,args) \
|
||||
__attribute__((__format__(__printf__,fmt,args)))
|
||||
#else
|
||||
#define LIBXML_ATTR_FORMAT(fmt,args)
|
||||
#endif
|
||||
|
||||
#ifndef XML_DEPRECATED
|
||||
#if defined(IN_LIBXML)
|
||||
#define XML_DEPRECATED
|
||||
#elif __GNUC__ * 100 + __GNUC_MINOR__ >= 301
|
||||
#define XML_DEPRECATED __attribute__((deprecated))
|
||||
#elif defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
/* Available since Visual Studio 2005 */
|
||||
#define XML_DEPRECATED __declspec(deprecated)
|
||||
#else
|
||||
#define XML_DEPRECATED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Warnings pragmas, should be moved from public headers
|
||||
*/
|
||||
|
||||
#if defined(__LCC__)
|
||||
|
||||
#define XML_IGNORE_FPTR_CAST_WARNINGS
|
||||
#define XML_POP_WARNINGS \
|
||||
_Pragma("diag_default 1215")
|
||||
|
||||
#elif defined(__clang__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
|
||||
|
||||
#if defined(__clang__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 800)
|
||||
#define XML_IGNORE_FPTR_CAST_WARNINGS \
|
||||
_Pragma("GCC diagnostic push") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wpedantic\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wcast-function-type\"")
|
||||
#else
|
||||
#define XML_IGNORE_FPTR_CAST_WARNINGS \
|
||||
_Pragma("GCC diagnostic push") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wpedantic\"")
|
||||
#endif
|
||||
#define XML_POP_WARNINGS \
|
||||
_Pragma("GCC diagnostic pop")
|
||||
|
||||
#elif defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
|
||||
#define XML_IGNORE_FPTR_CAST_WARNINGS __pragma(warning(push))
|
||||
#define XML_POP_WARNINGS __pragma(warning(pop))
|
||||
|
||||
#else
|
||||
|
||||
#define XML_IGNORE_FPTR_CAST_WARNINGS
|
||||
#define XML_POP_WARNINGS
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Accessors for globals
|
||||
*/
|
||||
|
||||
#define XML_NO_ATTR
|
||||
|
||||
#ifdef LIBXML_THREAD_ENABLED
|
||||
#define XML_DECLARE_GLOBAL(name, type, attrs) \
|
||||
attrs XMLPUBFUN type *__##name(void);
|
||||
#define XML_GLOBAL_MACRO(name) (*__##name())
|
||||
#else
|
||||
#define XML_DECLARE_GLOBAL(name, type, attrs) \
|
||||
attrs XMLPUBVAR type name;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Originally declared in xmlversion.h which is generated
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
XMLPUBFUN void xmlCheckVersion(int version);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XML_EXPORTS_H__ */
|
||||
|
||||
|
||||
+188
@@ -0,0 +1,188 @@
|
||||
/*
|
||||
* Summary: interface for the memory allocator
|
||||
* Description: provides interfaces for the memory allocator,
|
||||
* including debugging capabilities.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __DEBUG_MEMORY_ALLOC__
|
||||
#define __DEBUG_MEMORY_ALLOC__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The XML memory wrapper support 4 basic overloadable functions.
|
||||
*/
|
||||
/**
|
||||
* xmlFreeFunc:
|
||||
* @mem: an already allocated block of memory
|
||||
*
|
||||
* Signature for a free() implementation.
|
||||
*/
|
||||
typedef void (*xmlFreeFunc)(void *mem);
|
||||
/**
|
||||
* xmlMallocFunc:
|
||||
* @size: the size requested in bytes
|
||||
*
|
||||
* Signature for a malloc() implementation.
|
||||
*
|
||||
* Returns a pointer to the newly allocated block or NULL in case of error.
|
||||
*/
|
||||
typedef void *(LIBXML_ATTR_ALLOC_SIZE(1) *xmlMallocFunc)(size_t size);
|
||||
|
||||
/**
|
||||
* xmlReallocFunc:
|
||||
* @mem: an already allocated block of memory
|
||||
* @size: the new size requested in bytes
|
||||
*
|
||||
* Signature for a realloc() implementation.
|
||||
*
|
||||
* Returns a pointer to the newly reallocated block or NULL in case of error.
|
||||
*/
|
||||
typedef void *(*xmlReallocFunc)(void *mem, size_t size);
|
||||
|
||||
/**
|
||||
* xmlStrdupFunc:
|
||||
* @str: a zero terminated string
|
||||
*
|
||||
* Signature for an strdup() implementation.
|
||||
*
|
||||
* Returns the copy of the string or NULL in case of error.
|
||||
*/
|
||||
typedef char *(*xmlStrdupFunc)(const char *str);
|
||||
|
||||
/*
|
||||
* In general the memory allocation entry points are not kept
|
||||
* thread specific but this can be overridden by LIBXML_THREAD_ALLOC_ENABLED
|
||||
* - xmlMalloc
|
||||
* - xmlMallocAtomic
|
||||
* - xmlRealloc
|
||||
* - xmlMemStrdup
|
||||
* - xmlFree
|
||||
*/
|
||||
/** DOC_DISABLE */
|
||||
#ifdef LIBXML_THREAD_ALLOC_ENABLED
|
||||
#define XML_GLOBALS_ALLOC \
|
||||
XML_OP(xmlMalloc, xmlMallocFunc, XML_NO_ATTR) \
|
||||
XML_OP(xmlMallocAtomic, xmlMallocFunc, XML_NO_ATTR) \
|
||||
XML_OP(xmlRealloc, xmlReallocFunc, XML_NO_ATTR) \
|
||||
XML_OP(xmlFree, xmlFreeFunc, XML_NO_ATTR) \
|
||||
XML_OP(xmlMemStrdup, xmlStrdupFunc, XML_NO_ATTR)
|
||||
#define XML_OP XML_DECLARE_GLOBAL
|
||||
XML_GLOBALS_ALLOC
|
||||
#undef XML_OP
|
||||
#if defined(LIBXML_THREAD_ENABLED) && !defined(XML_GLOBALS_NO_REDEFINITION)
|
||||
#define xmlMalloc XML_GLOBAL_MACRO(xmlMalloc)
|
||||
#define xmlMallocAtomic XML_GLOBAL_MACRO(xmlMallocAtomic)
|
||||
#define xmlRealloc XML_GLOBAL_MACRO(xmlRealloc)
|
||||
#define xmlFree XML_GLOBAL_MACRO(xmlFree)
|
||||
#define xmlMemStrdup XML_GLOBAL_MACRO(xmlMemStrdup)
|
||||
#endif
|
||||
#else
|
||||
#define XML_GLOBALS_ALLOC
|
||||
/** DOC_ENABLE */
|
||||
XMLPUBVAR xmlMallocFunc xmlMalloc;
|
||||
XMLPUBVAR xmlMallocFunc xmlMallocAtomic;
|
||||
XMLPUBVAR xmlReallocFunc xmlRealloc;
|
||||
XMLPUBVAR xmlFreeFunc xmlFree;
|
||||
XMLPUBVAR xmlStrdupFunc xmlMemStrdup;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The way to overload the existing functions.
|
||||
* The xmlGc function have an extra entry for atomic block
|
||||
* allocations useful for garbage collected memory allocators
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlMemSetup (xmlFreeFunc freeFunc,
|
||||
xmlMallocFunc mallocFunc,
|
||||
xmlReallocFunc reallocFunc,
|
||||
xmlStrdupFunc strdupFunc);
|
||||
XMLPUBFUN int
|
||||
xmlMemGet (xmlFreeFunc *freeFunc,
|
||||
xmlMallocFunc *mallocFunc,
|
||||
xmlReallocFunc *reallocFunc,
|
||||
xmlStrdupFunc *strdupFunc);
|
||||
XMLPUBFUN int
|
||||
xmlGcMemSetup (xmlFreeFunc freeFunc,
|
||||
xmlMallocFunc mallocFunc,
|
||||
xmlMallocFunc mallocAtomicFunc,
|
||||
xmlReallocFunc reallocFunc,
|
||||
xmlStrdupFunc strdupFunc);
|
||||
XMLPUBFUN int
|
||||
xmlGcMemGet (xmlFreeFunc *freeFunc,
|
||||
xmlMallocFunc *mallocFunc,
|
||||
xmlMallocFunc *mallocAtomicFunc,
|
||||
xmlReallocFunc *reallocFunc,
|
||||
xmlStrdupFunc *strdupFunc);
|
||||
|
||||
/*
|
||||
* Initialization of the memory layer.
|
||||
*/
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlInitMemory (void);
|
||||
|
||||
/*
|
||||
* Cleanup of the memory layer.
|
||||
*/
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlCleanupMemory (void);
|
||||
/*
|
||||
* These are specific to the XML debug memory wrapper.
|
||||
*/
|
||||
XMLPUBFUN size_t
|
||||
xmlMemSize (void *ptr);
|
||||
XMLPUBFUN int
|
||||
xmlMemUsed (void);
|
||||
XMLPUBFUN int
|
||||
xmlMemBlocks (void);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlMemDisplay (FILE *fp);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlMemDisplayLast(FILE *fp, long nbBytes);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlMemShow (FILE *fp, int nr);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlMemoryDump (void);
|
||||
XMLPUBFUN void *
|
||||
xmlMemMalloc (size_t size) LIBXML_ATTR_ALLOC_SIZE(1);
|
||||
XMLPUBFUN void *
|
||||
xmlMemRealloc (void *ptr,size_t size);
|
||||
XMLPUBFUN void
|
||||
xmlMemFree (void *ptr);
|
||||
XMLPUBFUN char *
|
||||
xmlMemoryStrdup (const char *str);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void *
|
||||
xmlMallocLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void *
|
||||
xmlReallocLoc (void *ptr, size_t size, const char *file, int line);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void *
|
||||
xmlMallocAtomicLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN char *
|
||||
xmlMemStrdupLoc (const char *str, const char *file, int line);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __DEBUG_MEMORY_ALLOC__ */
|
||||
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Summary: dynamic module loading
|
||||
* Description: basic API for dynamic module loading, used by
|
||||
* libexslt added in 2.6.17
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Joel W. Reed
|
||||
*/
|
||||
|
||||
#ifndef __XML_MODULE_H__
|
||||
#define __XML_MODULE_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#ifdef LIBXML_MODULES_ENABLED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* xmlModulePtr:
|
||||
*
|
||||
* A handle to a dynamically loaded module
|
||||
*/
|
||||
typedef struct _xmlModule xmlModule;
|
||||
typedef xmlModule *xmlModulePtr;
|
||||
|
||||
/**
|
||||
* xmlModuleOption:
|
||||
*
|
||||
* enumeration of options that can be passed down to xmlModuleOpen()
|
||||
*/
|
||||
typedef enum {
|
||||
XML_MODULE_LAZY = 1, /* lazy binding */
|
||||
XML_MODULE_LOCAL= 2 /* local binding */
|
||||
} xmlModuleOption;
|
||||
|
||||
XMLPUBFUN xmlModulePtr xmlModuleOpen (const char *filename,
|
||||
int options);
|
||||
|
||||
XMLPUBFUN int xmlModuleSymbol (xmlModulePtr module,
|
||||
const char* name,
|
||||
void **result);
|
||||
|
||||
XMLPUBFUN int xmlModuleClose (xmlModulePtr module);
|
||||
|
||||
XMLPUBFUN int xmlModuleFree (xmlModulePtr module);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_MODULES_ENABLED */
|
||||
|
||||
#endif /*__XML_MODULE_H__ */
|
||||
+436
@@ -0,0 +1,436 @@
|
||||
/*
|
||||
* Summary: the XMLReader implementation
|
||||
* Description: API of the XML streaming API based on C# interfaces.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_XMLREADER_H__
|
||||
#define __XML_XMLREADER_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/xmlerror.h>
|
||||
#include <libxml/xmlIO.h>
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#include <libxml/relaxng.h>
|
||||
#include <libxml/xmlschemas.h>
|
||||
#endif
|
||||
/* for compatibility */
|
||||
#include <libxml/parser.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* xmlParserSeverities:
|
||||
*
|
||||
* How severe an error callback is when the per-reader error callback API
|
||||
* is used.
|
||||
*/
|
||||
typedef enum {
|
||||
XML_PARSER_SEVERITY_VALIDITY_WARNING = 1,
|
||||
XML_PARSER_SEVERITY_VALIDITY_ERROR = 2,
|
||||
XML_PARSER_SEVERITY_WARNING = 3,
|
||||
XML_PARSER_SEVERITY_ERROR = 4
|
||||
} xmlParserSeverities;
|
||||
|
||||
#ifdef LIBXML_READER_ENABLED
|
||||
|
||||
/**
|
||||
* xmlTextReaderMode:
|
||||
*
|
||||
* Internal state values for the reader.
|
||||
*/
|
||||
typedef enum {
|
||||
XML_TEXTREADER_MODE_INITIAL = 0,
|
||||
XML_TEXTREADER_MODE_INTERACTIVE = 1,
|
||||
XML_TEXTREADER_MODE_ERROR = 2,
|
||||
XML_TEXTREADER_MODE_EOF =3,
|
||||
XML_TEXTREADER_MODE_CLOSED = 4,
|
||||
XML_TEXTREADER_MODE_READING = 5
|
||||
} xmlTextReaderMode;
|
||||
|
||||
/**
|
||||
* xmlParserProperties:
|
||||
*
|
||||
* Some common options to use with xmlTextReaderSetParserProp, but it
|
||||
* is better to use xmlParserOption and the xmlReaderNewxxx and
|
||||
* xmlReaderForxxx APIs now.
|
||||
*/
|
||||
typedef enum {
|
||||
XML_PARSER_LOADDTD = 1,
|
||||
XML_PARSER_DEFAULTATTRS = 2,
|
||||
XML_PARSER_VALIDATE = 3,
|
||||
XML_PARSER_SUBST_ENTITIES = 4
|
||||
} xmlParserProperties;
|
||||
|
||||
/**
|
||||
* xmlReaderTypes:
|
||||
*
|
||||
* Predefined constants for the different types of nodes.
|
||||
*/
|
||||
typedef enum {
|
||||
XML_READER_TYPE_NONE = 0,
|
||||
XML_READER_TYPE_ELEMENT = 1,
|
||||
XML_READER_TYPE_ATTRIBUTE = 2,
|
||||
XML_READER_TYPE_TEXT = 3,
|
||||
XML_READER_TYPE_CDATA = 4,
|
||||
XML_READER_TYPE_ENTITY_REFERENCE = 5,
|
||||
XML_READER_TYPE_ENTITY = 6,
|
||||
XML_READER_TYPE_PROCESSING_INSTRUCTION = 7,
|
||||
XML_READER_TYPE_COMMENT = 8,
|
||||
XML_READER_TYPE_DOCUMENT = 9,
|
||||
XML_READER_TYPE_DOCUMENT_TYPE = 10,
|
||||
XML_READER_TYPE_DOCUMENT_FRAGMENT = 11,
|
||||
XML_READER_TYPE_NOTATION = 12,
|
||||
XML_READER_TYPE_WHITESPACE = 13,
|
||||
XML_READER_TYPE_SIGNIFICANT_WHITESPACE = 14,
|
||||
XML_READER_TYPE_END_ELEMENT = 15,
|
||||
XML_READER_TYPE_END_ENTITY = 16,
|
||||
XML_READER_TYPE_XML_DECLARATION = 17
|
||||
} xmlReaderTypes;
|
||||
|
||||
/**
|
||||
* xmlTextReader:
|
||||
*
|
||||
* Structure for an xmlReader context.
|
||||
*/
|
||||
typedef struct _xmlTextReader xmlTextReader;
|
||||
|
||||
/**
|
||||
* xmlTextReaderPtr:
|
||||
*
|
||||
* Pointer to an xmlReader context.
|
||||
*/
|
||||
typedef xmlTextReader *xmlTextReaderPtr;
|
||||
|
||||
/*
|
||||
* Constructors & Destructor
|
||||
*/
|
||||
XMLPUBFUN xmlTextReaderPtr
|
||||
xmlNewTextReader (xmlParserInputBufferPtr input,
|
||||
const char *URI);
|
||||
XMLPUBFUN xmlTextReaderPtr
|
||||
xmlNewTextReaderFilename(const char *URI);
|
||||
|
||||
XMLPUBFUN void
|
||||
xmlFreeTextReader (xmlTextReaderPtr reader);
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderSetup(xmlTextReaderPtr reader,
|
||||
xmlParserInputBufferPtr input, const char *URL,
|
||||
const char *encoding, int options);
|
||||
XMLPUBFUN void
|
||||
xmlTextReaderSetMaxAmplification(xmlTextReaderPtr reader,
|
||||
unsigned maxAmpl);
|
||||
XMLPUBFUN const xmlError *
|
||||
xmlTextReaderGetLastError(xmlTextReaderPtr reader);
|
||||
|
||||
/*
|
||||
* Iterators
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderRead (xmlTextReaderPtr reader);
|
||||
|
||||
#ifdef LIBXML_WRITER_ENABLED
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlTextReaderReadInnerXml(xmlTextReaderPtr reader);
|
||||
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlTextReaderReadOuterXml(xmlTextReaderPtr reader);
|
||||
#endif
|
||||
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlTextReaderReadString (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderReadAttributeValue(xmlTextReaderPtr reader);
|
||||
|
||||
/*
|
||||
* Attributes of the node
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderAttributeCount(xmlTextReaderPtr reader);
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderDepth (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderHasAttributes(xmlTextReaderPtr reader);
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderHasValue(xmlTextReaderPtr reader);
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderIsDefault (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderIsEmptyElement(xmlTextReaderPtr reader);
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderNodeType (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderQuoteChar (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderReadState (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderIsNamespaceDecl(xmlTextReaderPtr reader);
|
||||
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlTextReaderConstBaseUri (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlTextReaderConstLocalName (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlTextReaderConstName (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlTextReaderConstNamespaceUri(xmlTextReaderPtr reader);
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlTextReaderConstPrefix (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlTextReaderConstXmlLang (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlTextReaderConstString (xmlTextReaderPtr reader,
|
||||
const xmlChar *str);
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlTextReaderConstValue (xmlTextReaderPtr reader);
|
||||
|
||||
/*
|
||||
* use the Const version of the routine for
|
||||
* better performance and simpler code
|
||||
*/
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlTextReaderBaseUri (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlTextReaderLocalName (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlTextReaderName (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlTextReaderNamespaceUri(xmlTextReaderPtr reader);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlTextReaderPrefix (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlTextReaderXmlLang (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlTextReaderValue (xmlTextReaderPtr reader);
|
||||
|
||||
/*
|
||||
* Methods of the XmlTextReader
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderClose (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlTextReaderGetAttributeNo (xmlTextReaderPtr reader,
|
||||
int no);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlTextReaderGetAttribute (xmlTextReaderPtr reader,
|
||||
const xmlChar *name);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlTextReaderGetAttributeNs (xmlTextReaderPtr reader,
|
||||
const xmlChar *localName,
|
||||
const xmlChar *namespaceURI);
|
||||
XMLPUBFUN xmlParserInputBufferPtr
|
||||
xmlTextReaderGetRemainder (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlTextReaderLookupNamespace(xmlTextReaderPtr reader,
|
||||
const xmlChar *prefix);
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderMoveToAttributeNo(xmlTextReaderPtr reader,
|
||||
int no);
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderMoveToAttribute(xmlTextReaderPtr reader,
|
||||
const xmlChar *name);
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderMoveToAttributeNs(xmlTextReaderPtr reader,
|
||||
const xmlChar *localName,
|
||||
const xmlChar *namespaceURI);
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderMoveToFirstAttribute(xmlTextReaderPtr reader);
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderMoveToNextAttribute(xmlTextReaderPtr reader);
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderMoveToElement (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderNormalization (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlTextReaderConstEncoding (xmlTextReaderPtr reader);
|
||||
|
||||
/*
|
||||
* Extensions
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderSetParserProp (xmlTextReaderPtr reader,
|
||||
int prop,
|
||||
int value);
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderGetParserProp (xmlTextReaderPtr reader,
|
||||
int prop);
|
||||
XMLPUBFUN xmlNodePtr
|
||||
xmlTextReaderCurrentNode (xmlTextReaderPtr reader);
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderGetParserLineNumber(xmlTextReaderPtr reader);
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderGetParserColumnNumber(xmlTextReaderPtr reader);
|
||||
|
||||
XMLPUBFUN xmlNodePtr
|
||||
xmlTextReaderPreserve (xmlTextReaderPtr reader);
|
||||
#ifdef LIBXML_PATTERN_ENABLED
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderPreservePattern(xmlTextReaderPtr reader,
|
||||
const xmlChar *pattern,
|
||||
const xmlChar **namespaces);
|
||||
#endif /* LIBXML_PATTERN_ENABLED */
|
||||
XMLPUBFUN xmlDocPtr
|
||||
xmlTextReaderCurrentDoc (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN xmlNodePtr
|
||||
xmlTextReaderExpand (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderNext (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderNextSibling (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderIsValid (xmlTextReaderPtr reader);
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader,
|
||||
const char *rng);
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderRelaxNGValidateCtxt(xmlTextReaderPtr reader,
|
||||
xmlRelaxNGValidCtxtPtr ctxt,
|
||||
int options);
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader,
|
||||
xmlRelaxNGPtr schema);
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderSchemaValidate (xmlTextReaderPtr reader,
|
||||
const char *xsd);
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderSchemaValidateCtxt(xmlTextReaderPtr reader,
|
||||
xmlSchemaValidCtxtPtr ctxt,
|
||||
int options);
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderSetSchema (xmlTextReaderPtr reader,
|
||||
xmlSchemaPtr schema);
|
||||
#endif
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlTextReaderConstXmlVersion(xmlTextReaderPtr reader);
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderStandalone (xmlTextReaderPtr reader);
|
||||
|
||||
|
||||
/*
|
||||
* Index lookup
|
||||
*/
|
||||
XMLPUBFUN long
|
||||
xmlTextReaderByteConsumed (xmlTextReaderPtr reader);
|
||||
|
||||
/*
|
||||
* New more complete APIs for simpler creation and reuse of readers
|
||||
*/
|
||||
XMLPUBFUN xmlTextReaderPtr
|
||||
xmlReaderWalker (xmlDocPtr doc);
|
||||
XMLPUBFUN xmlTextReaderPtr
|
||||
xmlReaderForDoc (const xmlChar * cur,
|
||||
const char *URL,
|
||||
const char *encoding,
|
||||
int options);
|
||||
XMLPUBFUN xmlTextReaderPtr
|
||||
xmlReaderForFile (const char *filename,
|
||||
const char *encoding,
|
||||
int options);
|
||||
XMLPUBFUN xmlTextReaderPtr
|
||||
xmlReaderForMemory (const char *buffer,
|
||||
int size,
|
||||
const char *URL,
|
||||
const char *encoding,
|
||||
int options);
|
||||
XMLPUBFUN xmlTextReaderPtr
|
||||
xmlReaderForFd (int fd,
|
||||
const char *URL,
|
||||
const char *encoding,
|
||||
int options);
|
||||
XMLPUBFUN xmlTextReaderPtr
|
||||
xmlReaderForIO (xmlInputReadCallback ioread,
|
||||
xmlInputCloseCallback ioclose,
|
||||
void *ioctx,
|
||||
const char *URL,
|
||||
const char *encoding,
|
||||
int options);
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlReaderNewWalker (xmlTextReaderPtr reader,
|
||||
xmlDocPtr doc);
|
||||
XMLPUBFUN int
|
||||
xmlReaderNewDoc (xmlTextReaderPtr reader,
|
||||
const xmlChar * cur,
|
||||
const char *URL,
|
||||
const char *encoding,
|
||||
int options);
|
||||
XMLPUBFUN int
|
||||
xmlReaderNewFile (xmlTextReaderPtr reader,
|
||||
const char *filename,
|
||||
const char *encoding,
|
||||
int options);
|
||||
XMLPUBFUN int
|
||||
xmlReaderNewMemory (xmlTextReaderPtr reader,
|
||||
const char *buffer,
|
||||
int size,
|
||||
const char *URL,
|
||||
const char *encoding,
|
||||
int options);
|
||||
XMLPUBFUN int
|
||||
xmlReaderNewFd (xmlTextReaderPtr reader,
|
||||
int fd,
|
||||
const char *URL,
|
||||
const char *encoding,
|
||||
int options);
|
||||
XMLPUBFUN int
|
||||
xmlReaderNewIO (xmlTextReaderPtr reader,
|
||||
xmlInputReadCallback ioread,
|
||||
xmlInputCloseCallback ioclose,
|
||||
void *ioctx,
|
||||
const char *URL,
|
||||
const char *encoding,
|
||||
int options);
|
||||
/*
|
||||
* Error handling extensions
|
||||
*/
|
||||
typedef void * xmlTextReaderLocatorPtr;
|
||||
|
||||
/**
|
||||
* xmlTextReaderErrorFunc:
|
||||
* @arg: the user argument
|
||||
* @msg: the message
|
||||
* @severity: the severity of the error
|
||||
* @locator: a locator indicating where the error occurred
|
||||
*
|
||||
* Signature of an error callback from a reader parser
|
||||
*/
|
||||
typedef void (*xmlTextReaderErrorFunc)(void *arg,
|
||||
const char *msg,
|
||||
xmlParserSeverities severity,
|
||||
xmlTextReaderLocatorPtr locator);
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlTextReaderLocatorBaseURI (xmlTextReaderLocatorPtr locator);
|
||||
XMLPUBFUN void
|
||||
xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader,
|
||||
xmlTextReaderErrorFunc f,
|
||||
void *arg);
|
||||
XMLPUBFUN void
|
||||
xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader,
|
||||
xmlStructuredErrorFunc f,
|
||||
void *arg);
|
||||
XMLPUBFUN void
|
||||
xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader,
|
||||
xmlTextReaderErrorFunc *f,
|
||||
void **arg);
|
||||
|
||||
#endif /* LIBXML_READER_ENABLED */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XML_XMLREADER_H__ */
|
||||
|
||||
+215
@@ -0,0 +1,215 @@
|
||||
/*
|
||||
* Summary: regular expressions handling
|
||||
* Description: basic API for libxml regular expressions handling used
|
||||
* for XML Schemas and validation.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_REGEXP_H__
|
||||
#define __XML_REGEXP_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <libxml/xmlversion.h>
|
||||
#include <libxml/xmlstring.h>
|
||||
|
||||
#ifdef LIBXML_REGEXP_ENABLED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* xmlRegexpPtr:
|
||||
*
|
||||
* A libxml regular expression, they can actually be far more complex
|
||||
* thank the POSIX regex expressions.
|
||||
*/
|
||||
typedef struct _xmlRegexp xmlRegexp;
|
||||
typedef xmlRegexp *xmlRegexpPtr;
|
||||
|
||||
/**
|
||||
* xmlRegExecCtxtPtr:
|
||||
*
|
||||
* A libxml progressive regular expression evaluation context
|
||||
*/
|
||||
typedef struct _xmlRegExecCtxt xmlRegExecCtxt;
|
||||
typedef xmlRegExecCtxt *xmlRegExecCtxtPtr;
|
||||
|
||||
/*
|
||||
* The POSIX like API
|
||||
*/
|
||||
XMLPUBFUN xmlRegexpPtr
|
||||
xmlRegexpCompile (const xmlChar *regexp);
|
||||
XMLPUBFUN void xmlRegFreeRegexp(xmlRegexpPtr regexp);
|
||||
XMLPUBFUN int
|
||||
xmlRegexpExec (xmlRegexpPtr comp,
|
||||
const xmlChar *value);
|
||||
XMLPUBFUN void
|
||||
xmlRegexpPrint (FILE *output,
|
||||
xmlRegexpPtr regexp);
|
||||
XMLPUBFUN int
|
||||
xmlRegexpIsDeterminist(xmlRegexpPtr comp);
|
||||
|
||||
/**
|
||||
* xmlRegExecCallbacks:
|
||||
* @exec: the regular expression context
|
||||
* @token: the current token string
|
||||
* @transdata: transition data
|
||||
* @inputdata: input data
|
||||
*
|
||||
* Callback function when doing a transition in the automata
|
||||
*/
|
||||
typedef void (*xmlRegExecCallbacks) (xmlRegExecCtxtPtr exec,
|
||||
const xmlChar *token,
|
||||
void *transdata,
|
||||
void *inputdata);
|
||||
|
||||
/*
|
||||
* The progressive API
|
||||
*/
|
||||
XMLPUBFUN xmlRegExecCtxtPtr
|
||||
xmlRegNewExecCtxt (xmlRegexpPtr comp,
|
||||
xmlRegExecCallbacks callback,
|
||||
void *data);
|
||||
XMLPUBFUN void
|
||||
xmlRegFreeExecCtxt (xmlRegExecCtxtPtr exec);
|
||||
XMLPUBFUN int
|
||||
xmlRegExecPushString(xmlRegExecCtxtPtr exec,
|
||||
const xmlChar *value,
|
||||
void *data);
|
||||
XMLPUBFUN int
|
||||
xmlRegExecPushString2(xmlRegExecCtxtPtr exec,
|
||||
const xmlChar *value,
|
||||
const xmlChar *value2,
|
||||
void *data);
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlRegExecNextValues(xmlRegExecCtxtPtr exec,
|
||||
int *nbval,
|
||||
int *nbneg,
|
||||
xmlChar **values,
|
||||
int *terminal);
|
||||
XMLPUBFUN int
|
||||
xmlRegExecErrInfo (xmlRegExecCtxtPtr exec,
|
||||
const xmlChar **string,
|
||||
int *nbval,
|
||||
int *nbneg,
|
||||
xmlChar **values,
|
||||
int *terminal);
|
||||
#ifdef LIBXML_EXPR_ENABLED
|
||||
/*
|
||||
* Formal regular expression handling
|
||||
* Its goal is to do some formal work on content models
|
||||
*/
|
||||
|
||||
/* expressions are used within a context */
|
||||
typedef struct _xmlExpCtxt xmlExpCtxt;
|
||||
typedef xmlExpCtxt *xmlExpCtxtPtr;
|
||||
|
||||
XMLPUBFUN void
|
||||
xmlExpFreeCtxt (xmlExpCtxtPtr ctxt);
|
||||
XMLPUBFUN xmlExpCtxtPtr
|
||||
xmlExpNewCtxt (int maxNodes,
|
||||
xmlDictPtr dict);
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlExpCtxtNbNodes(xmlExpCtxtPtr ctxt);
|
||||
XMLPUBFUN int
|
||||
xmlExpCtxtNbCons(xmlExpCtxtPtr ctxt);
|
||||
|
||||
/* Expressions are trees but the tree is opaque */
|
||||
typedef struct _xmlExpNode xmlExpNode;
|
||||
typedef xmlExpNode *xmlExpNodePtr;
|
||||
|
||||
typedef enum {
|
||||
XML_EXP_EMPTY = 0,
|
||||
XML_EXP_FORBID = 1,
|
||||
XML_EXP_ATOM = 2,
|
||||
XML_EXP_SEQ = 3,
|
||||
XML_EXP_OR = 4,
|
||||
XML_EXP_COUNT = 5
|
||||
} xmlExpNodeType;
|
||||
|
||||
/*
|
||||
* 2 core expressions shared by all for the empty language set
|
||||
* and for the set with just the empty token
|
||||
*/
|
||||
XMLPUBVAR xmlExpNodePtr forbiddenExp;
|
||||
XMLPUBVAR xmlExpNodePtr emptyExp;
|
||||
|
||||
/*
|
||||
* Expressions are reference counted internally
|
||||
*/
|
||||
XMLPUBFUN void
|
||||
xmlExpFree (xmlExpCtxtPtr ctxt,
|
||||
xmlExpNodePtr expr);
|
||||
XMLPUBFUN void
|
||||
xmlExpRef (xmlExpNodePtr expr);
|
||||
|
||||
/*
|
||||
* constructors can be either manual or from a string
|
||||
*/
|
||||
XMLPUBFUN xmlExpNodePtr
|
||||
xmlExpParse (xmlExpCtxtPtr ctxt,
|
||||
const char *expr);
|
||||
XMLPUBFUN xmlExpNodePtr
|
||||
xmlExpNewAtom (xmlExpCtxtPtr ctxt,
|
||||
const xmlChar *name,
|
||||
int len);
|
||||
XMLPUBFUN xmlExpNodePtr
|
||||
xmlExpNewOr (xmlExpCtxtPtr ctxt,
|
||||
xmlExpNodePtr left,
|
||||
xmlExpNodePtr right);
|
||||
XMLPUBFUN xmlExpNodePtr
|
||||
xmlExpNewSeq (xmlExpCtxtPtr ctxt,
|
||||
xmlExpNodePtr left,
|
||||
xmlExpNodePtr right);
|
||||
XMLPUBFUN xmlExpNodePtr
|
||||
xmlExpNewRange (xmlExpCtxtPtr ctxt,
|
||||
xmlExpNodePtr subset,
|
||||
int min,
|
||||
int max);
|
||||
/*
|
||||
* The really interesting APIs
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlExpIsNillable(xmlExpNodePtr expr);
|
||||
XMLPUBFUN int
|
||||
xmlExpMaxToken (xmlExpNodePtr expr);
|
||||
XMLPUBFUN int
|
||||
xmlExpGetLanguage(xmlExpCtxtPtr ctxt,
|
||||
xmlExpNodePtr expr,
|
||||
const xmlChar**langList,
|
||||
int len);
|
||||
XMLPUBFUN int
|
||||
xmlExpGetStart (xmlExpCtxtPtr ctxt,
|
||||
xmlExpNodePtr expr,
|
||||
const xmlChar**tokList,
|
||||
int len);
|
||||
XMLPUBFUN xmlExpNodePtr
|
||||
xmlExpStringDerive(xmlExpCtxtPtr ctxt,
|
||||
xmlExpNodePtr expr,
|
||||
const xmlChar *str,
|
||||
int len);
|
||||
XMLPUBFUN xmlExpNodePtr
|
||||
xmlExpExpDerive (xmlExpCtxtPtr ctxt,
|
||||
xmlExpNodePtr expr,
|
||||
xmlExpNodePtr sub);
|
||||
XMLPUBFUN int
|
||||
xmlExpSubsume (xmlExpCtxtPtr ctxt,
|
||||
xmlExpNodePtr expr,
|
||||
xmlExpNodePtr sub);
|
||||
XMLPUBFUN void
|
||||
xmlExpDump (xmlBufferPtr buf,
|
||||
xmlExpNodePtr expr);
|
||||
#endif /* LIBXML_EXPR_ENABLED */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_REGEXP_ENABLED */
|
||||
|
||||
#endif /*__XML_REGEXP_H__ */
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Summary: the XML document serializer
|
||||
* Description: API to save document or subtree of document
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_XMLSAVE_H__
|
||||
#define __XML_XMLSAVE_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/encoding.h>
|
||||
#include <libxml/xmlIO.h>
|
||||
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* xmlSaveOption:
|
||||
*
|
||||
* This is the set of XML save options that can be passed down
|
||||
* to the xmlSaveToFd() and similar calls.
|
||||
*/
|
||||
typedef enum {
|
||||
XML_SAVE_FORMAT = 1<<0, /* format save output */
|
||||
XML_SAVE_NO_DECL = 1<<1, /* drop the xml declaration */
|
||||
XML_SAVE_NO_EMPTY = 1<<2, /* no empty tags */
|
||||
XML_SAVE_NO_XHTML = 1<<3, /* disable XHTML1 specific rules */
|
||||
XML_SAVE_XHTML = 1<<4, /* force XHTML1 specific rules */
|
||||
XML_SAVE_AS_XML = 1<<5, /* force XML serialization on HTML doc */
|
||||
XML_SAVE_AS_HTML = 1<<6, /* force HTML serialization on XML doc */
|
||||
XML_SAVE_WSNONSIG = 1<<7 /* format with non-significant whitespace */
|
||||
} xmlSaveOption;
|
||||
|
||||
|
||||
typedef struct _xmlSaveCtxt xmlSaveCtxt;
|
||||
typedef xmlSaveCtxt *xmlSaveCtxtPtr;
|
||||
|
||||
XMLPUBFUN xmlSaveCtxtPtr
|
||||
xmlSaveToFd (int fd,
|
||||
const char *encoding,
|
||||
int options);
|
||||
XMLPUBFUN xmlSaveCtxtPtr
|
||||
xmlSaveToFilename (const char *filename,
|
||||
const char *encoding,
|
||||
int options);
|
||||
|
||||
XMLPUBFUN xmlSaveCtxtPtr
|
||||
xmlSaveToBuffer (xmlBufferPtr buffer,
|
||||
const char *encoding,
|
||||
int options);
|
||||
|
||||
XMLPUBFUN xmlSaveCtxtPtr
|
||||
xmlSaveToIO (xmlOutputWriteCallback iowrite,
|
||||
xmlOutputCloseCallback ioclose,
|
||||
void *ioctx,
|
||||
const char *encoding,
|
||||
int options);
|
||||
|
||||
XMLPUBFUN long
|
||||
xmlSaveDoc (xmlSaveCtxtPtr ctxt,
|
||||
xmlDocPtr doc);
|
||||
XMLPUBFUN long
|
||||
xmlSaveTree (xmlSaveCtxtPtr ctxt,
|
||||
xmlNodePtr node);
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlSaveFlush (xmlSaveCtxtPtr ctxt);
|
||||
XMLPUBFUN int
|
||||
xmlSaveClose (xmlSaveCtxtPtr ctxt);
|
||||
XMLPUBFUN int
|
||||
xmlSaveFinish (xmlSaveCtxtPtr ctxt);
|
||||
XMLPUBFUN int
|
||||
xmlSaveSetEscape (xmlSaveCtxtPtr ctxt,
|
||||
xmlCharEncodingOutputFunc escape);
|
||||
XMLPUBFUN int
|
||||
xmlSaveSetAttrEscape (xmlSaveCtxtPtr ctxt,
|
||||
xmlCharEncodingOutputFunc escape);
|
||||
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlThrDefIndentTreeOutput(int v);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN const char *
|
||||
xmlThrDefTreeIndentString(const char * v);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlThrDefSaveNoEmptyTags(int v);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_OUTPUT_ENABLED */
|
||||
#endif /* __XML_XMLSAVE_H__ */
|
||||
|
||||
|
||||
+249
@@ -0,0 +1,249 @@
|
||||
/*
|
||||
* Summary: incomplete XML Schemas structure implementation
|
||||
* Description: interface to the XML Schemas handling and schema validity
|
||||
* checking, it is incomplete right now.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __XML_SCHEMA_H__
|
||||
#define __XML_SCHEMA_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
|
||||
#include <stdio.h>
|
||||
#include <libxml/encoding.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/xmlerror.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This error codes are obsolete; not used any more.
|
||||
*/
|
||||
typedef enum {
|
||||
XML_SCHEMAS_ERR_OK = 0,
|
||||
XML_SCHEMAS_ERR_NOROOT = 1,
|
||||
XML_SCHEMAS_ERR_UNDECLAREDELEM,
|
||||
XML_SCHEMAS_ERR_NOTTOPLEVEL,
|
||||
XML_SCHEMAS_ERR_MISSING,
|
||||
XML_SCHEMAS_ERR_WRONGELEM,
|
||||
XML_SCHEMAS_ERR_NOTYPE,
|
||||
XML_SCHEMAS_ERR_NOROLLBACK,
|
||||
XML_SCHEMAS_ERR_ISABSTRACT,
|
||||
XML_SCHEMAS_ERR_NOTEMPTY,
|
||||
XML_SCHEMAS_ERR_ELEMCONT,
|
||||
XML_SCHEMAS_ERR_HAVEDEFAULT,
|
||||
XML_SCHEMAS_ERR_NOTNILLABLE,
|
||||
XML_SCHEMAS_ERR_EXTRACONTENT,
|
||||
XML_SCHEMAS_ERR_INVALIDATTR,
|
||||
XML_SCHEMAS_ERR_INVALIDELEM,
|
||||
XML_SCHEMAS_ERR_NOTDETERMINIST,
|
||||
XML_SCHEMAS_ERR_CONSTRUCT,
|
||||
XML_SCHEMAS_ERR_INTERNAL,
|
||||
XML_SCHEMAS_ERR_NOTSIMPLE,
|
||||
XML_SCHEMAS_ERR_ATTRUNKNOWN,
|
||||
XML_SCHEMAS_ERR_ATTRINVALID,
|
||||
XML_SCHEMAS_ERR_VALUE,
|
||||
XML_SCHEMAS_ERR_FACET,
|
||||
XML_SCHEMAS_ERR_,
|
||||
XML_SCHEMAS_ERR_XXX
|
||||
} xmlSchemaValidError;
|
||||
|
||||
/*
|
||||
* ATTENTION: Change xmlSchemaSetValidOptions's check
|
||||
* for invalid values, if adding to the validation
|
||||
* options below.
|
||||
*/
|
||||
/**
|
||||
* xmlSchemaValidOption:
|
||||
*
|
||||
* This is the set of XML Schema validation options.
|
||||
*/
|
||||
typedef enum {
|
||||
XML_SCHEMA_VAL_VC_I_CREATE = 1<<0
|
||||
/* Default/fixed: create an attribute node
|
||||
* or an element's text node on the instance.
|
||||
*/
|
||||
} xmlSchemaValidOption;
|
||||
|
||||
/*
|
||||
XML_SCHEMA_VAL_XSI_ASSEMBLE = 1<<1,
|
||||
* assemble schemata using
|
||||
* xsi:schemaLocation and
|
||||
* xsi:noNamespaceSchemaLocation
|
||||
*/
|
||||
|
||||
/**
|
||||
* The schemas related types are kept internal
|
||||
*/
|
||||
typedef struct _xmlSchema xmlSchema;
|
||||
typedef xmlSchema *xmlSchemaPtr;
|
||||
|
||||
/**
|
||||
* xmlSchemaValidityErrorFunc:
|
||||
* @ctx: the validation context
|
||||
* @msg: the message
|
||||
* @...: extra arguments
|
||||
*
|
||||
* Signature of an error callback from an XSD validation
|
||||
*/
|
||||
typedef void (*xmlSchemaValidityErrorFunc)
|
||||
(void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
|
||||
|
||||
/**
|
||||
* xmlSchemaValidityWarningFunc:
|
||||
* @ctx: the validation context
|
||||
* @msg: the message
|
||||
* @...: extra arguments
|
||||
*
|
||||
* Signature of a warning callback from an XSD validation
|
||||
*/
|
||||
typedef void (*xmlSchemaValidityWarningFunc)
|
||||
(void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
|
||||
|
||||
/**
|
||||
* A schemas validation context
|
||||
*/
|
||||
typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt;
|
||||
typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr;
|
||||
|
||||
typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt;
|
||||
typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr;
|
||||
|
||||
/**
|
||||
* xmlSchemaValidityLocatorFunc:
|
||||
* @ctx: user provided context
|
||||
* @file: returned file information
|
||||
* @line: returned line information
|
||||
*
|
||||
* A schemas validation locator, a callback called by the validator.
|
||||
* This is used when file or node information are not available
|
||||
* to find out what file and line number are affected
|
||||
*
|
||||
* Returns: 0 in case of success and -1 in case of error
|
||||
*/
|
||||
|
||||
typedef int (*xmlSchemaValidityLocatorFunc) (void *ctx,
|
||||
const char **file, unsigned long *line);
|
||||
|
||||
/*
|
||||
* Interfaces for parsing.
|
||||
*/
|
||||
XMLPUBFUN xmlSchemaParserCtxtPtr
|
||||
xmlSchemaNewParserCtxt (const char *URL);
|
||||
XMLPUBFUN xmlSchemaParserCtxtPtr
|
||||
xmlSchemaNewMemParserCtxt (const char *buffer,
|
||||
int size);
|
||||
XMLPUBFUN xmlSchemaParserCtxtPtr
|
||||
xmlSchemaNewDocParserCtxt (xmlDocPtr doc);
|
||||
XMLPUBFUN void
|
||||
xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt);
|
||||
XMLPUBFUN void
|
||||
xmlSchemaSetParserErrors (xmlSchemaParserCtxtPtr ctxt,
|
||||
xmlSchemaValidityErrorFunc err,
|
||||
xmlSchemaValidityWarningFunc warn,
|
||||
void *ctx);
|
||||
XMLPUBFUN void
|
||||
xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxtPtr ctxt,
|
||||
xmlStructuredErrorFunc serror,
|
||||
void *ctx);
|
||||
XMLPUBFUN int
|
||||
xmlSchemaGetParserErrors(xmlSchemaParserCtxtPtr ctxt,
|
||||
xmlSchemaValidityErrorFunc * err,
|
||||
xmlSchemaValidityWarningFunc * warn,
|
||||
void **ctx);
|
||||
XMLPUBFUN int
|
||||
xmlSchemaIsValid (xmlSchemaValidCtxtPtr ctxt);
|
||||
|
||||
XMLPUBFUN xmlSchemaPtr
|
||||
xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt);
|
||||
XMLPUBFUN void
|
||||
xmlSchemaFree (xmlSchemaPtr schema);
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
XMLPUBFUN void
|
||||
xmlSchemaDump (FILE *output,
|
||||
xmlSchemaPtr schema);
|
||||
#endif /* LIBXML_OUTPUT_ENABLED */
|
||||
/*
|
||||
* Interfaces for validating
|
||||
*/
|
||||
XMLPUBFUN void
|
||||
xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt,
|
||||
xmlSchemaValidityErrorFunc err,
|
||||
xmlSchemaValidityWarningFunc warn,
|
||||
void *ctx);
|
||||
XMLPUBFUN void
|
||||
xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt,
|
||||
xmlStructuredErrorFunc serror,
|
||||
void *ctx);
|
||||
XMLPUBFUN int
|
||||
xmlSchemaGetValidErrors (xmlSchemaValidCtxtPtr ctxt,
|
||||
xmlSchemaValidityErrorFunc *err,
|
||||
xmlSchemaValidityWarningFunc *warn,
|
||||
void **ctx);
|
||||
XMLPUBFUN int
|
||||
xmlSchemaSetValidOptions (xmlSchemaValidCtxtPtr ctxt,
|
||||
int options);
|
||||
XMLPUBFUN void
|
||||
xmlSchemaValidateSetFilename(xmlSchemaValidCtxtPtr vctxt,
|
||||
const char *filename);
|
||||
XMLPUBFUN int
|
||||
xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxtPtr ctxt);
|
||||
|
||||
XMLPUBFUN xmlSchemaValidCtxtPtr
|
||||
xmlSchemaNewValidCtxt (xmlSchemaPtr schema);
|
||||
XMLPUBFUN void
|
||||
xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt);
|
||||
XMLPUBFUN int
|
||||
xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt,
|
||||
xmlDocPtr instance);
|
||||
XMLPUBFUN int
|
||||
xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt,
|
||||
xmlNodePtr elem);
|
||||
XMLPUBFUN int
|
||||
xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt,
|
||||
xmlParserInputBufferPtr input,
|
||||
xmlCharEncoding enc,
|
||||
xmlSAXHandlerPtr sax,
|
||||
void *user_data);
|
||||
XMLPUBFUN int
|
||||
xmlSchemaValidateFile (xmlSchemaValidCtxtPtr ctxt,
|
||||
const char * filename,
|
||||
int options);
|
||||
|
||||
XMLPUBFUN xmlParserCtxtPtr
|
||||
xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt);
|
||||
|
||||
/*
|
||||
* Interface to insert Schemas SAX validation in a SAX stream
|
||||
*/
|
||||
typedef struct _xmlSchemaSAXPlug xmlSchemaSAXPlugStruct;
|
||||
typedef xmlSchemaSAXPlugStruct *xmlSchemaSAXPlugPtr;
|
||||
|
||||
XMLPUBFUN xmlSchemaSAXPlugPtr
|
||||
xmlSchemaSAXPlug (xmlSchemaValidCtxtPtr ctxt,
|
||||
xmlSAXHandlerPtr *sax,
|
||||
void **user_data);
|
||||
XMLPUBFUN int
|
||||
xmlSchemaSAXUnplug (xmlSchemaSAXPlugPtr plug);
|
||||
|
||||
|
||||
XMLPUBFUN void
|
||||
xmlSchemaValidateSetLocator (xmlSchemaValidCtxtPtr vctxt,
|
||||
xmlSchemaValidityLocatorFunc f,
|
||||
void *ctxt);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_SCHEMAS_ENABLED */
|
||||
#endif /* __XML_SCHEMA_H__ */
|
||||
+152
@@ -0,0 +1,152 @@
|
||||
/*
|
||||
* Summary: implementation of XML Schema Datatypes
|
||||
* Description: module providing the XML Schema Datatypes implementation
|
||||
* both definition and validity checking
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __XML_SCHEMA_TYPES_H__
|
||||
#define __XML_SCHEMA_TYPES_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
|
||||
#include <libxml/schemasInternals.h>
|
||||
#include <libxml/xmlschemas.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
XML_SCHEMA_WHITESPACE_UNKNOWN = 0,
|
||||
XML_SCHEMA_WHITESPACE_PRESERVE = 1,
|
||||
XML_SCHEMA_WHITESPACE_REPLACE = 2,
|
||||
XML_SCHEMA_WHITESPACE_COLLAPSE = 3
|
||||
} xmlSchemaWhitespaceValueType;
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlSchemaInitTypes (void);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlSchemaCleanupTypes (void);
|
||||
XMLPUBFUN xmlSchemaTypePtr
|
||||
xmlSchemaGetPredefinedType (const xmlChar *name,
|
||||
const xmlChar *ns);
|
||||
XMLPUBFUN int
|
||||
xmlSchemaValidatePredefinedType (xmlSchemaTypePtr type,
|
||||
const xmlChar *value,
|
||||
xmlSchemaValPtr *val);
|
||||
XMLPUBFUN int
|
||||
xmlSchemaValPredefTypeNode (xmlSchemaTypePtr type,
|
||||
const xmlChar *value,
|
||||
xmlSchemaValPtr *val,
|
||||
xmlNodePtr node);
|
||||
XMLPUBFUN int
|
||||
xmlSchemaValidateFacet (xmlSchemaTypePtr base,
|
||||
xmlSchemaFacetPtr facet,
|
||||
const xmlChar *value,
|
||||
xmlSchemaValPtr val);
|
||||
XMLPUBFUN int
|
||||
xmlSchemaValidateFacetWhtsp (xmlSchemaFacetPtr facet,
|
||||
xmlSchemaWhitespaceValueType fws,
|
||||
xmlSchemaValType valType,
|
||||
const xmlChar *value,
|
||||
xmlSchemaValPtr val,
|
||||
xmlSchemaWhitespaceValueType ws);
|
||||
XMLPUBFUN void
|
||||
xmlSchemaFreeValue (xmlSchemaValPtr val);
|
||||
XMLPUBFUN xmlSchemaFacetPtr
|
||||
xmlSchemaNewFacet (void);
|
||||
XMLPUBFUN int
|
||||
xmlSchemaCheckFacet (xmlSchemaFacetPtr facet,
|
||||
xmlSchemaTypePtr typeDecl,
|
||||
xmlSchemaParserCtxtPtr ctxt,
|
||||
const xmlChar *name);
|
||||
XMLPUBFUN void
|
||||
xmlSchemaFreeFacet (xmlSchemaFacetPtr facet);
|
||||
XMLPUBFUN int
|
||||
xmlSchemaCompareValues (xmlSchemaValPtr x,
|
||||
xmlSchemaValPtr y);
|
||||
XMLPUBFUN xmlSchemaTypePtr
|
||||
xmlSchemaGetBuiltInListSimpleTypeItemType (xmlSchemaTypePtr type);
|
||||
XMLPUBFUN int
|
||||
xmlSchemaValidateListSimpleTypeFacet (xmlSchemaFacetPtr facet,
|
||||
const xmlChar *value,
|
||||
unsigned long actualLen,
|
||||
unsigned long *expectedLen);
|
||||
XMLPUBFUN xmlSchemaTypePtr
|
||||
xmlSchemaGetBuiltInType (xmlSchemaValType type);
|
||||
XMLPUBFUN int
|
||||
xmlSchemaIsBuiltInTypeFacet (xmlSchemaTypePtr type,
|
||||
int facetType);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlSchemaCollapseString (const xmlChar *value);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlSchemaWhiteSpaceReplace (const xmlChar *value);
|
||||
XMLPUBFUN unsigned long
|
||||
xmlSchemaGetFacetValueAsULong (xmlSchemaFacetPtr facet);
|
||||
XMLPUBFUN int
|
||||
xmlSchemaValidateLengthFacet (xmlSchemaTypePtr type,
|
||||
xmlSchemaFacetPtr facet,
|
||||
const xmlChar *value,
|
||||
xmlSchemaValPtr val,
|
||||
unsigned long *length);
|
||||
XMLPUBFUN int
|
||||
xmlSchemaValidateLengthFacetWhtsp(xmlSchemaFacetPtr facet,
|
||||
xmlSchemaValType valType,
|
||||
const xmlChar *value,
|
||||
xmlSchemaValPtr val,
|
||||
unsigned long *length,
|
||||
xmlSchemaWhitespaceValueType ws);
|
||||
XMLPUBFUN int
|
||||
xmlSchemaValPredefTypeNodeNoNorm(xmlSchemaTypePtr type,
|
||||
const xmlChar *value,
|
||||
xmlSchemaValPtr *val,
|
||||
xmlNodePtr node);
|
||||
XMLPUBFUN int
|
||||
xmlSchemaGetCanonValue (xmlSchemaValPtr val,
|
||||
const xmlChar **retValue);
|
||||
XMLPUBFUN int
|
||||
xmlSchemaGetCanonValueWhtsp (xmlSchemaValPtr val,
|
||||
const xmlChar **retValue,
|
||||
xmlSchemaWhitespaceValueType ws);
|
||||
XMLPUBFUN int
|
||||
xmlSchemaValueAppend (xmlSchemaValPtr prev,
|
||||
xmlSchemaValPtr cur);
|
||||
XMLPUBFUN xmlSchemaValPtr
|
||||
xmlSchemaValueGetNext (xmlSchemaValPtr cur);
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlSchemaValueGetAsString (xmlSchemaValPtr val);
|
||||
XMLPUBFUN int
|
||||
xmlSchemaValueGetAsBoolean (xmlSchemaValPtr val);
|
||||
XMLPUBFUN xmlSchemaValPtr
|
||||
xmlSchemaNewStringValue (xmlSchemaValType type,
|
||||
const xmlChar *value);
|
||||
XMLPUBFUN xmlSchemaValPtr
|
||||
xmlSchemaNewNOTATIONValue (const xmlChar *name,
|
||||
const xmlChar *ns);
|
||||
XMLPUBFUN xmlSchemaValPtr
|
||||
xmlSchemaNewQNameValue (const xmlChar *namespaceName,
|
||||
const xmlChar *localName);
|
||||
XMLPUBFUN int
|
||||
xmlSchemaCompareValuesWhtsp (xmlSchemaValPtr x,
|
||||
xmlSchemaWhitespaceValueType xws,
|
||||
xmlSchemaValPtr y,
|
||||
xmlSchemaWhitespaceValueType yws);
|
||||
XMLPUBFUN xmlSchemaValPtr
|
||||
xmlSchemaCopyValue (xmlSchemaValPtr val);
|
||||
XMLPUBFUN xmlSchemaValType
|
||||
xmlSchemaGetValType (xmlSchemaValPtr val);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_SCHEMAS_ENABLED */
|
||||
#endif /* __XML_SCHEMA_TYPES_H__ */
|
||||
+140
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Summary: set of routines to process strings
|
||||
* Description: type and interfaces needed for the internal string handling
|
||||
* of the library, especially UTF8 processing.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_STRING_H__
|
||||
#define __XML_STRING_H__
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* xmlChar:
|
||||
*
|
||||
* This is a basic byte in an UTF-8 encoded string.
|
||||
* It's unsigned allowing to pinpoint case where char * are assigned
|
||||
* to xmlChar * (possibly making serialization back impossible).
|
||||
*/
|
||||
typedef unsigned char xmlChar;
|
||||
|
||||
/**
|
||||
* BAD_CAST:
|
||||
*
|
||||
* Macro to cast a string to an xmlChar * when one know its safe.
|
||||
*/
|
||||
#define BAD_CAST (xmlChar *)
|
||||
|
||||
/*
|
||||
* xmlChar handling
|
||||
*/
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlStrdup (const xmlChar *cur);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlStrndup (const xmlChar *cur,
|
||||
int len);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlCharStrndup (const char *cur,
|
||||
int len);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlCharStrdup (const char *cur);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlStrsub (const xmlChar *str,
|
||||
int start,
|
||||
int len);
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlStrchr (const xmlChar *str,
|
||||
xmlChar val);
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlStrstr (const xmlChar *str,
|
||||
const xmlChar *val);
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlStrcasestr (const xmlChar *str,
|
||||
const xmlChar *val);
|
||||
XMLPUBFUN int
|
||||
xmlStrcmp (const xmlChar *str1,
|
||||
const xmlChar *str2);
|
||||
XMLPUBFUN int
|
||||
xmlStrncmp (const xmlChar *str1,
|
||||
const xmlChar *str2,
|
||||
int len);
|
||||
XMLPUBFUN int
|
||||
xmlStrcasecmp (const xmlChar *str1,
|
||||
const xmlChar *str2);
|
||||
XMLPUBFUN int
|
||||
xmlStrncasecmp (const xmlChar *str1,
|
||||
const xmlChar *str2,
|
||||
int len);
|
||||
XMLPUBFUN int
|
||||
xmlStrEqual (const xmlChar *str1,
|
||||
const xmlChar *str2);
|
||||
XMLPUBFUN int
|
||||
xmlStrQEqual (const xmlChar *pref,
|
||||
const xmlChar *name,
|
||||
const xmlChar *str);
|
||||
XMLPUBFUN int
|
||||
xmlStrlen (const xmlChar *str);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlStrcat (xmlChar *cur,
|
||||
const xmlChar *add);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlStrncat (xmlChar *cur,
|
||||
const xmlChar *add,
|
||||
int len);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlStrncatNew (const xmlChar *str1,
|
||||
const xmlChar *str2,
|
||||
int len);
|
||||
XMLPUBFUN int
|
||||
xmlStrPrintf (xmlChar *buf,
|
||||
int len,
|
||||
const char *msg,
|
||||
...) LIBXML_ATTR_FORMAT(3,4);
|
||||
XMLPUBFUN int
|
||||
xmlStrVPrintf (xmlChar *buf,
|
||||
int len,
|
||||
const char *msg,
|
||||
va_list ap) LIBXML_ATTR_FORMAT(3,0);
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlGetUTF8Char (const unsigned char *utf,
|
||||
int *len);
|
||||
XMLPUBFUN int
|
||||
xmlCheckUTF8 (const unsigned char *utf);
|
||||
XMLPUBFUN int
|
||||
xmlUTF8Strsize (const xmlChar *utf,
|
||||
int len);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlUTF8Strndup (const xmlChar *utf,
|
||||
int len);
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlUTF8Strpos (const xmlChar *utf,
|
||||
int pos);
|
||||
XMLPUBFUN int
|
||||
xmlUTF8Strloc (const xmlChar *utf,
|
||||
const xmlChar *utfchar);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlUTF8Strsub (const xmlChar *utf,
|
||||
int start,
|
||||
int len);
|
||||
XMLPUBFUN int
|
||||
xmlUTF8Strlen (const xmlChar *utf);
|
||||
XMLPUBFUN int
|
||||
xmlUTF8Size (const xmlChar *utf);
|
||||
XMLPUBFUN int
|
||||
xmlUTF8Charcmp (const xmlChar *utf1,
|
||||
const xmlChar *utf2);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __XML_STRING_H__ */
|
||||
+366
@@ -0,0 +1,366 @@
|
||||
/*
|
||||
* Summary: Unicode character APIs
|
||||
* Description: API for the Unicode character APIs
|
||||
*
|
||||
* This file is automatically generated from the
|
||||
* UCS description files of the Unicode Character Database
|
||||
* http://www.unicode.org/Public/4.0-Update1/UCD-4.0.1.html
|
||||
* using the genUnicode.py Python script.
|
||||
*
|
||||
* Generation date: Tue Apr 30 17:30:38 2024
|
||||
* Sources: Blocks-4.0.1.txt UnicodeData-4.0.1.txt
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_UNICODE_H__
|
||||
#define __XML_UNICODE_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#ifdef LIBXML_UNICODE_ENABLED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsAegeanNumbers (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsAlphabeticPresentationForms (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsArabic (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsArabicPresentationFormsA (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsArabicPresentationFormsB (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsArmenian (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsArrows (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsBasicLatin (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsBengali (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsBlockElements (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsBopomofo (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsBopomofoExtended (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsBoxDrawing (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsBraillePatterns (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsBuhid (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsByzantineMusicalSymbols (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCJKCompatibility (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCJKCompatibilityForms (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCJKCompatibilityIdeographs (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCJKCompatibilityIdeographsSupplement (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCJKRadicalsSupplement (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCJKSymbolsandPunctuation (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCJKUnifiedIdeographs (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCJKUnifiedIdeographsExtensionA (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCJKUnifiedIdeographsExtensionB (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCherokee (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCombiningDiacriticalMarks (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCombiningDiacriticalMarksforSymbols (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCombiningHalfMarks (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCombiningMarksforSymbols (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsControlPictures (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCurrencySymbols (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCypriotSyllabary (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCyrillic (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCyrillicSupplement (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsDeseret (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsDevanagari (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsDingbats (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsEnclosedAlphanumerics (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsEnclosedCJKLettersandMonths (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsEthiopic (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsGeneralPunctuation (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsGeometricShapes (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsGeorgian (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsGothic (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsGreek (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsGreekExtended (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsGreekandCoptic (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsGujarati (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsGurmukhi (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsHalfwidthandFullwidthForms (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsHangulCompatibilityJamo (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsHangulJamo (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsHangulSyllables (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsHanunoo (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsHebrew (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsHighPrivateUseSurrogates (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsHighSurrogates (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsHiragana (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsIPAExtensions (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsIdeographicDescriptionCharacters (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsKanbun (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsKangxiRadicals (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsKannada (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsKatakana (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsKatakanaPhoneticExtensions (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsKhmer (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsKhmerSymbols (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsLao (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsLatin1Supplement (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsLatinExtendedA (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsLatinExtendedB (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsLatinExtendedAdditional (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsLetterlikeSymbols (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsLimbu (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsLinearBIdeograms (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsLinearBSyllabary (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsLowSurrogates (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsMalayalam (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsMathematicalAlphanumericSymbols (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsMathematicalOperators (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsMiscellaneousMathematicalSymbolsA (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsMiscellaneousMathematicalSymbolsB (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsMiscellaneousSymbols (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsMiscellaneousSymbolsandArrows (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsMiscellaneousTechnical (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsMongolian (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsMusicalSymbols (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsMyanmar (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsNumberForms (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsOgham (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsOldItalic (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsOpticalCharacterRecognition (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsOriya (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsOsmanya (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsPhoneticExtensions (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsPrivateUse (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsPrivateUseArea (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsRunic (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsShavian (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsSinhala (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsSmallFormVariants (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsSpacingModifierLetters (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsSpecials (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsSuperscriptsandSubscripts (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsSupplementalArrowsA (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsSupplementalArrowsB (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsSupplementalMathematicalOperators (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsSupplementaryPrivateUseAreaA (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsSupplementaryPrivateUseAreaB (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsSyriac (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsTagalog (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsTagbanwa (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsTags (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsTaiLe (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsTaiXuanJingSymbols (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsTamil (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsTelugu (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsThaana (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsThai (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsTibetan (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsUgaritic (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsUnifiedCanadianAboriginalSyllabics (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsVariationSelectors (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsVariationSelectorsSupplement (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsYiRadicals (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsYiSyllables (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsYijingHexagramSymbols (int code);
|
||||
|
||||
XMLPUBFUN int xmlUCSIsBlock (int code, const char *block);
|
||||
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatC (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatCc (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatCf (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatCo (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatCs (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatL (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatLl (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatLm (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatLo (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatLt (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatLu (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatM (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatMc (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatMe (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatMn (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatN (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatNd (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatNl (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatNo (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatP (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatPc (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatPd (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatPe (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatPf (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatPi (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatPo (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatPs (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatS (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatSc (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatSk (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatSm (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatSo (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatZ (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatZl (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatZp (int code);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int xmlUCSIsCatZs (int code);
|
||||
|
||||
XMLPUBFUN int xmlUCSIsCat (int code, const char *cat);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_UNICODE_ENABLED */
|
||||
|
||||
#endif /* __XML_UNICODE_H__ */
|
||||
+347
@@ -0,0 +1,347 @@
|
||||
/*
|
||||
* Summary: compile-time version information
|
||||
* Description: compile-time version information for the XML library
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_VERSION_H__
|
||||
#define __XML_VERSION_H__
|
||||
|
||||
/**
|
||||
* LIBXML_DOTTED_VERSION:
|
||||
*
|
||||
* the version string like "1.2.3"
|
||||
*/
|
||||
#define LIBXML_DOTTED_VERSION "2.13.6"
|
||||
|
||||
/**
|
||||
* LIBXML_VERSION:
|
||||
*
|
||||
* the version number: 1.2.3 value is 10203
|
||||
*/
|
||||
#define LIBXML_VERSION 21306
|
||||
|
||||
/**
|
||||
* LIBXML_VERSION_STRING:
|
||||
*
|
||||
* the version number string, 1.2.3 value is "10203"
|
||||
*/
|
||||
#define LIBXML_VERSION_STRING "21306"
|
||||
|
||||
/**
|
||||
* LIBXML_VERSION_EXTRA:
|
||||
*
|
||||
* extra version information, used to show a git commit description
|
||||
*/
|
||||
#define LIBXML_VERSION_EXTRA ""
|
||||
|
||||
/**
|
||||
* LIBXML_TEST_VERSION:
|
||||
*
|
||||
* Macro to check that the libxml version in use is compatible with
|
||||
* the version the software has been compiled against
|
||||
*/
|
||||
#define LIBXML_TEST_VERSION xmlCheckVersion(21306);
|
||||
|
||||
/**
|
||||
* LIBXML_THREAD_ENABLED:
|
||||
*
|
||||
* Whether the thread support is configured in
|
||||
*/
|
||||
#if 1
|
||||
#define LIBXML_THREAD_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_THREAD_ALLOC_ENABLED:
|
||||
*
|
||||
* Whether the allocation hooks are per-thread
|
||||
*/
|
||||
#if 0
|
||||
#define LIBXML_THREAD_ALLOC_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_TREE_ENABLED:
|
||||
*
|
||||
* Whether the DOM like tree manipulation API support is configured in
|
||||
*/
|
||||
#if 1
|
||||
#define LIBXML_TREE_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_OUTPUT_ENABLED:
|
||||
*
|
||||
* Whether the serialization/saving support is configured in
|
||||
*/
|
||||
#if 1
|
||||
#define LIBXML_OUTPUT_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_PUSH_ENABLED:
|
||||
*
|
||||
* Whether the push parsing interfaces are configured in
|
||||
*/
|
||||
#if 1
|
||||
#define LIBXML_PUSH_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_READER_ENABLED:
|
||||
*
|
||||
* Whether the xmlReader parsing interface is configured in
|
||||
*/
|
||||
#if 1
|
||||
#define LIBXML_READER_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_PATTERN_ENABLED:
|
||||
*
|
||||
* Whether the xmlPattern node selection interface is configured in
|
||||
*/
|
||||
#if 1
|
||||
#define LIBXML_PATTERN_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_WRITER_ENABLED:
|
||||
*
|
||||
* Whether the xmlWriter saving interface is configured in
|
||||
*/
|
||||
#if 1
|
||||
#define LIBXML_WRITER_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_SAX1_ENABLED:
|
||||
*
|
||||
* Whether the older SAX1 interface is configured in
|
||||
*/
|
||||
#if 1
|
||||
#define LIBXML_SAX1_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_FTP_ENABLED:
|
||||
*
|
||||
* Whether the FTP support is configured in
|
||||
*/
|
||||
#if 0
|
||||
#define LIBXML_FTP_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_HTTP_ENABLED:
|
||||
*
|
||||
* Whether the HTTP support is configured in
|
||||
*/
|
||||
#if 1
|
||||
#define LIBXML_HTTP_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_VALID_ENABLED:
|
||||
*
|
||||
* Whether the DTD validation support is configured in
|
||||
*/
|
||||
#if 1
|
||||
#define LIBXML_VALID_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_HTML_ENABLED:
|
||||
*
|
||||
* Whether the HTML support is configured in
|
||||
*/
|
||||
#if 1
|
||||
#define LIBXML_HTML_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_LEGACY_ENABLED:
|
||||
*
|
||||
* Whether the deprecated APIs are compiled in for compatibility
|
||||
*/
|
||||
#if 1
|
||||
#define LIBXML_LEGACY_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_C14N_ENABLED:
|
||||
*
|
||||
* Whether the Canonicalization support is configured in
|
||||
*/
|
||||
#if 1
|
||||
#define LIBXML_C14N_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_CATALOG_ENABLED:
|
||||
*
|
||||
* Whether the Catalog support is configured in
|
||||
*/
|
||||
#if 1
|
||||
#define LIBXML_CATALOG_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_XPATH_ENABLED:
|
||||
*
|
||||
* Whether XPath is configured in
|
||||
*/
|
||||
#if 1
|
||||
#define LIBXML_XPATH_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_XPTR_ENABLED:
|
||||
*
|
||||
* Whether XPointer is configured in
|
||||
*/
|
||||
#if 1
|
||||
#define LIBXML_XPTR_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_XPTR_LOCS_ENABLED:
|
||||
*
|
||||
* Whether support for XPointer locations is configured in
|
||||
*/
|
||||
#if 0
|
||||
#define LIBXML_XPTR_LOCS_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_XINCLUDE_ENABLED:
|
||||
*
|
||||
* Whether XInclude is configured in
|
||||
*/
|
||||
#if 1
|
||||
#define LIBXML_XINCLUDE_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_ICONV_ENABLED:
|
||||
*
|
||||
* Whether iconv support is available
|
||||
*/
|
||||
#if 1
|
||||
#define LIBXML_ICONV_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_ICU_ENABLED:
|
||||
*
|
||||
* Whether icu support is available
|
||||
*/
|
||||
#if 0
|
||||
#define LIBXML_ICU_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_ISO8859X_ENABLED:
|
||||
*
|
||||
* Whether ISO-8859-* support is made available in case iconv is not
|
||||
*/
|
||||
#if 1
|
||||
#define LIBXML_ISO8859X_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_DEBUG_ENABLED:
|
||||
*
|
||||
* Whether Debugging module is configured in
|
||||
*/
|
||||
#if 1
|
||||
#define LIBXML_DEBUG_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_UNICODE_ENABLED:
|
||||
*
|
||||
* Whether the Unicode related interfaces are compiled in
|
||||
*/
|
||||
#if 1
|
||||
#define LIBXML_UNICODE_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_REGEXP_ENABLED:
|
||||
*
|
||||
* Whether the regular expressions interfaces are compiled in
|
||||
*/
|
||||
#if 1
|
||||
#define LIBXML_REGEXP_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_AUTOMATA_ENABLED:
|
||||
*
|
||||
* Whether the automata interfaces are compiled in
|
||||
*/
|
||||
#if 1
|
||||
#define LIBXML_AUTOMATA_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_SCHEMAS_ENABLED:
|
||||
*
|
||||
* Whether the Schemas validation interfaces are compiled in
|
||||
*/
|
||||
#if 1
|
||||
#define LIBXML_SCHEMAS_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_SCHEMATRON_ENABLED:
|
||||
*
|
||||
* Whether the Schematron validation interfaces are compiled in
|
||||
*/
|
||||
#if 1
|
||||
#define LIBXML_SCHEMATRON_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_MODULES_ENABLED:
|
||||
*
|
||||
* Whether the module interfaces are compiled in
|
||||
*/
|
||||
#if 1
|
||||
#define LIBXML_MODULES_ENABLED
|
||||
/**
|
||||
* LIBXML_MODULE_EXTENSION:
|
||||
*
|
||||
* the string suffix used by dynamic modules (usually shared libraries)
|
||||
*/
|
||||
#define LIBXML_MODULE_EXTENSION ".so"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_ZLIB_ENABLED:
|
||||
*
|
||||
* Whether the Zlib support is compiled in
|
||||
*/
|
||||
#if 1
|
||||
#define LIBXML_ZLIB_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_LZMA_ENABLED:
|
||||
*
|
||||
* Whether the Lzma support is compiled in
|
||||
*/
|
||||
#if 0
|
||||
#define LIBXML_LZMA_ENABLED
|
||||
#endif
|
||||
|
||||
#include <libxml/xmlexports.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+489
@@ -0,0 +1,489 @@
|
||||
/*
|
||||
* Summary: text writing API for XML
|
||||
* Description: text writing API for XML
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Alfred Mickautsch <alfred@mickautsch.de>
|
||||
*/
|
||||
|
||||
#ifndef __XML_XMLWRITER_H__
|
||||
#define __XML_XMLWRITER_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#ifdef LIBXML_WRITER_ENABLED
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <libxml/xmlIO.h>
|
||||
#include <libxml/list.h>
|
||||
#include <libxml/xmlstring.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _xmlTextWriter xmlTextWriter;
|
||||
typedef xmlTextWriter *xmlTextWriterPtr;
|
||||
|
||||
/*
|
||||
* Constructors & Destructor
|
||||
*/
|
||||
XMLPUBFUN xmlTextWriterPtr
|
||||
xmlNewTextWriter(xmlOutputBufferPtr out);
|
||||
XMLPUBFUN xmlTextWriterPtr
|
||||
xmlNewTextWriterFilename(const char *uri, int compression);
|
||||
XMLPUBFUN xmlTextWriterPtr
|
||||
xmlNewTextWriterMemory(xmlBufferPtr buf, int compression);
|
||||
XMLPUBFUN xmlTextWriterPtr
|
||||
xmlNewTextWriterPushParser(xmlParserCtxtPtr ctxt, int compression);
|
||||
XMLPUBFUN xmlTextWriterPtr
|
||||
xmlNewTextWriterDoc(xmlDocPtr * doc, int compression);
|
||||
XMLPUBFUN xmlTextWriterPtr
|
||||
xmlNewTextWriterTree(xmlDocPtr doc, xmlNodePtr node,
|
||||
int compression);
|
||||
XMLPUBFUN void xmlFreeTextWriter(xmlTextWriterPtr writer);
|
||||
|
||||
/*
|
||||
* Functions
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Document
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterStartDocument(xmlTextWriterPtr writer,
|
||||
const char *version,
|
||||
const char *encoding,
|
||||
const char *standalone);
|
||||
XMLPUBFUN int xmlTextWriterEndDocument(xmlTextWriterPtr
|
||||
writer);
|
||||
|
||||
/*
|
||||
* Comments
|
||||
*/
|
||||
XMLPUBFUN int xmlTextWriterStartComment(xmlTextWriterPtr
|
||||
writer);
|
||||
XMLPUBFUN int xmlTextWriterEndComment(xmlTextWriterPtr writer);
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteFormatComment(xmlTextWriterPtr writer,
|
||||
const char *format, ...)
|
||||
LIBXML_ATTR_FORMAT(2,3);
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteVFormatComment(xmlTextWriterPtr writer,
|
||||
const char *format,
|
||||
va_list argptr)
|
||||
LIBXML_ATTR_FORMAT(2,0);
|
||||
XMLPUBFUN int xmlTextWriterWriteComment(xmlTextWriterPtr
|
||||
writer,
|
||||
const xmlChar *
|
||||
content);
|
||||
|
||||
/*
|
||||
* Elements
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterStartElement(xmlTextWriterPtr writer,
|
||||
const xmlChar * name);
|
||||
XMLPUBFUN int xmlTextWriterStartElementNS(xmlTextWriterPtr
|
||||
writer,
|
||||
const xmlChar *
|
||||
prefix,
|
||||
const xmlChar * name,
|
||||
const xmlChar *
|
||||
namespaceURI);
|
||||
XMLPUBFUN int xmlTextWriterEndElement(xmlTextWriterPtr writer);
|
||||
XMLPUBFUN int xmlTextWriterFullEndElement(xmlTextWriterPtr
|
||||
writer);
|
||||
|
||||
/*
|
||||
* Elements conveniency functions
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteFormatElement(xmlTextWriterPtr writer,
|
||||
const xmlChar * name,
|
||||
const char *format, ...)
|
||||
LIBXML_ATTR_FORMAT(3,4);
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteVFormatElement(xmlTextWriterPtr writer,
|
||||
const xmlChar * name,
|
||||
const char *format,
|
||||
va_list argptr)
|
||||
LIBXML_ATTR_FORMAT(3,0);
|
||||
XMLPUBFUN int xmlTextWriterWriteElement(xmlTextWriterPtr
|
||||
writer,
|
||||
const xmlChar * name,
|
||||
const xmlChar *
|
||||
content);
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteFormatElementNS(xmlTextWriterPtr writer,
|
||||
const xmlChar * prefix,
|
||||
const xmlChar * name,
|
||||
const xmlChar * namespaceURI,
|
||||
const char *format, ...)
|
||||
LIBXML_ATTR_FORMAT(5,6);
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteVFormatElementNS(xmlTextWriterPtr writer,
|
||||
const xmlChar * prefix,
|
||||
const xmlChar * name,
|
||||
const xmlChar * namespaceURI,
|
||||
const char *format,
|
||||
va_list argptr)
|
||||
LIBXML_ATTR_FORMAT(5,0);
|
||||
XMLPUBFUN int xmlTextWriterWriteElementNS(xmlTextWriterPtr
|
||||
writer,
|
||||
const xmlChar *
|
||||
prefix,
|
||||
const xmlChar * name,
|
||||
const xmlChar *
|
||||
namespaceURI,
|
||||
const xmlChar *
|
||||
content);
|
||||
|
||||
/*
|
||||
* Text
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteFormatRaw(xmlTextWriterPtr writer,
|
||||
const char *format, ...)
|
||||
LIBXML_ATTR_FORMAT(2,3);
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteVFormatRaw(xmlTextWriterPtr writer,
|
||||
const char *format, va_list argptr)
|
||||
LIBXML_ATTR_FORMAT(2,0);
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteRawLen(xmlTextWriterPtr writer,
|
||||
const xmlChar * content, int len);
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteRaw(xmlTextWriterPtr writer,
|
||||
const xmlChar * content);
|
||||
XMLPUBFUN int xmlTextWriterWriteFormatString(xmlTextWriterPtr
|
||||
writer,
|
||||
const char
|
||||
*format, ...)
|
||||
LIBXML_ATTR_FORMAT(2,3);
|
||||
XMLPUBFUN int xmlTextWriterWriteVFormatString(xmlTextWriterPtr
|
||||
writer,
|
||||
const char
|
||||
*format,
|
||||
va_list argptr)
|
||||
LIBXML_ATTR_FORMAT(2,0);
|
||||
XMLPUBFUN int xmlTextWriterWriteString(xmlTextWriterPtr writer,
|
||||
const xmlChar *
|
||||
content);
|
||||
XMLPUBFUN int xmlTextWriterWriteBase64(xmlTextWriterPtr writer,
|
||||
const char *data,
|
||||
int start, int len);
|
||||
XMLPUBFUN int xmlTextWriterWriteBinHex(xmlTextWriterPtr writer,
|
||||
const char *data,
|
||||
int start, int len);
|
||||
|
||||
/*
|
||||
* Attributes
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterStartAttribute(xmlTextWriterPtr writer,
|
||||
const xmlChar * name);
|
||||
XMLPUBFUN int xmlTextWriterStartAttributeNS(xmlTextWriterPtr
|
||||
writer,
|
||||
const xmlChar *
|
||||
prefix,
|
||||
const xmlChar *
|
||||
name,
|
||||
const xmlChar *
|
||||
namespaceURI);
|
||||
XMLPUBFUN int xmlTextWriterEndAttribute(xmlTextWriterPtr
|
||||
writer);
|
||||
|
||||
/*
|
||||
* Attributes conveniency functions
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteFormatAttribute(xmlTextWriterPtr writer,
|
||||
const xmlChar * name,
|
||||
const char *format, ...)
|
||||
LIBXML_ATTR_FORMAT(3,4);
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteVFormatAttribute(xmlTextWriterPtr writer,
|
||||
const xmlChar * name,
|
||||
const char *format,
|
||||
va_list argptr)
|
||||
LIBXML_ATTR_FORMAT(3,0);
|
||||
XMLPUBFUN int xmlTextWriterWriteAttribute(xmlTextWriterPtr
|
||||
writer,
|
||||
const xmlChar * name,
|
||||
const xmlChar *
|
||||
content);
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteFormatAttributeNS(xmlTextWriterPtr writer,
|
||||
const xmlChar * prefix,
|
||||
const xmlChar * name,
|
||||
const xmlChar * namespaceURI,
|
||||
const char *format, ...)
|
||||
LIBXML_ATTR_FORMAT(5,6);
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteVFormatAttributeNS(xmlTextWriterPtr writer,
|
||||
const xmlChar * prefix,
|
||||
const xmlChar * name,
|
||||
const xmlChar * namespaceURI,
|
||||
const char *format,
|
||||
va_list argptr)
|
||||
LIBXML_ATTR_FORMAT(5,0);
|
||||
XMLPUBFUN int xmlTextWriterWriteAttributeNS(xmlTextWriterPtr
|
||||
writer,
|
||||
const xmlChar *
|
||||
prefix,
|
||||
const xmlChar *
|
||||
name,
|
||||
const xmlChar *
|
||||
namespaceURI,
|
||||
const xmlChar *
|
||||
content);
|
||||
|
||||
/*
|
||||
* PI's
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterStartPI(xmlTextWriterPtr writer,
|
||||
const xmlChar * target);
|
||||
XMLPUBFUN int xmlTextWriterEndPI(xmlTextWriterPtr writer);
|
||||
|
||||
/*
|
||||
* PI conveniency functions
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteFormatPI(xmlTextWriterPtr writer,
|
||||
const xmlChar * target,
|
||||
const char *format, ...)
|
||||
LIBXML_ATTR_FORMAT(3,4);
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteVFormatPI(xmlTextWriterPtr writer,
|
||||
const xmlChar * target,
|
||||
const char *format, va_list argptr)
|
||||
LIBXML_ATTR_FORMAT(3,0);
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWritePI(xmlTextWriterPtr writer,
|
||||
const xmlChar * target,
|
||||
const xmlChar * content);
|
||||
|
||||
/**
|
||||
* xmlTextWriterWriteProcessingInstruction:
|
||||
*
|
||||
* This macro maps to xmlTextWriterWritePI
|
||||
*/
|
||||
#define xmlTextWriterWriteProcessingInstruction xmlTextWriterWritePI
|
||||
|
||||
/*
|
||||
* CDATA
|
||||
*/
|
||||
XMLPUBFUN int xmlTextWriterStartCDATA(xmlTextWriterPtr writer);
|
||||
XMLPUBFUN int xmlTextWriterEndCDATA(xmlTextWriterPtr writer);
|
||||
|
||||
/*
|
||||
* CDATA conveniency functions
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteFormatCDATA(xmlTextWriterPtr writer,
|
||||
const char *format, ...)
|
||||
LIBXML_ATTR_FORMAT(2,3);
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteVFormatCDATA(xmlTextWriterPtr writer,
|
||||
const char *format, va_list argptr)
|
||||
LIBXML_ATTR_FORMAT(2,0);
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteCDATA(xmlTextWriterPtr writer,
|
||||
const xmlChar * content);
|
||||
|
||||
/*
|
||||
* DTD
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterStartDTD(xmlTextWriterPtr writer,
|
||||
const xmlChar * name,
|
||||
const xmlChar * pubid,
|
||||
const xmlChar * sysid);
|
||||
XMLPUBFUN int xmlTextWriterEndDTD(xmlTextWriterPtr writer);
|
||||
|
||||
/*
|
||||
* DTD conveniency functions
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteFormatDTD(xmlTextWriterPtr writer,
|
||||
const xmlChar * name,
|
||||
const xmlChar * pubid,
|
||||
const xmlChar * sysid,
|
||||
const char *format, ...)
|
||||
LIBXML_ATTR_FORMAT(5,6);
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteVFormatDTD(xmlTextWriterPtr writer,
|
||||
const xmlChar * name,
|
||||
const xmlChar * pubid,
|
||||
const xmlChar * sysid,
|
||||
const char *format, va_list argptr)
|
||||
LIBXML_ATTR_FORMAT(5,0);
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteDTD(xmlTextWriterPtr writer,
|
||||
const xmlChar * name,
|
||||
const xmlChar * pubid,
|
||||
const xmlChar * sysid,
|
||||
const xmlChar * subset);
|
||||
|
||||
/**
|
||||
* xmlTextWriterWriteDocType:
|
||||
*
|
||||
* this macro maps to xmlTextWriterWriteDTD
|
||||
*/
|
||||
#define xmlTextWriterWriteDocType xmlTextWriterWriteDTD
|
||||
|
||||
/*
|
||||
* DTD element definition
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterStartDTDElement(xmlTextWriterPtr writer,
|
||||
const xmlChar * name);
|
||||
XMLPUBFUN int xmlTextWriterEndDTDElement(xmlTextWriterPtr
|
||||
writer);
|
||||
|
||||
/*
|
||||
* DTD element definition conveniency functions
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteFormatDTDElement(xmlTextWriterPtr writer,
|
||||
const xmlChar * name,
|
||||
const char *format, ...)
|
||||
LIBXML_ATTR_FORMAT(3,4);
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteVFormatDTDElement(xmlTextWriterPtr writer,
|
||||
const xmlChar * name,
|
||||
const char *format,
|
||||
va_list argptr)
|
||||
LIBXML_ATTR_FORMAT(3,0);
|
||||
XMLPUBFUN int xmlTextWriterWriteDTDElement(xmlTextWriterPtr
|
||||
writer,
|
||||
const xmlChar *
|
||||
name,
|
||||
const xmlChar *
|
||||
content);
|
||||
|
||||
/*
|
||||
* DTD attribute list definition
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterStartDTDAttlist(xmlTextWriterPtr writer,
|
||||
const xmlChar * name);
|
||||
XMLPUBFUN int xmlTextWriterEndDTDAttlist(xmlTextWriterPtr
|
||||
writer);
|
||||
|
||||
/*
|
||||
* DTD attribute list definition conveniency functions
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteFormatDTDAttlist(xmlTextWriterPtr writer,
|
||||
const xmlChar * name,
|
||||
const char *format, ...)
|
||||
LIBXML_ATTR_FORMAT(3,4);
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteVFormatDTDAttlist(xmlTextWriterPtr writer,
|
||||
const xmlChar * name,
|
||||
const char *format,
|
||||
va_list argptr)
|
||||
LIBXML_ATTR_FORMAT(3,0);
|
||||
XMLPUBFUN int xmlTextWriterWriteDTDAttlist(xmlTextWriterPtr
|
||||
writer,
|
||||
const xmlChar *
|
||||
name,
|
||||
const xmlChar *
|
||||
content);
|
||||
|
||||
/*
|
||||
* DTD entity definition
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterStartDTDEntity(xmlTextWriterPtr writer,
|
||||
int pe, const xmlChar * name);
|
||||
XMLPUBFUN int xmlTextWriterEndDTDEntity(xmlTextWriterPtr
|
||||
writer);
|
||||
|
||||
/*
|
||||
* DTD entity definition conveniency functions
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteFormatDTDInternalEntity(xmlTextWriterPtr writer,
|
||||
int pe,
|
||||
const xmlChar * name,
|
||||
const char *format, ...)
|
||||
LIBXML_ATTR_FORMAT(4,5);
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteVFormatDTDInternalEntity(xmlTextWriterPtr writer,
|
||||
int pe,
|
||||
const xmlChar * name,
|
||||
const char *format,
|
||||
va_list argptr)
|
||||
LIBXML_ATTR_FORMAT(4,0);
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteDTDInternalEntity(xmlTextWriterPtr writer,
|
||||
int pe,
|
||||
const xmlChar * name,
|
||||
const xmlChar * content);
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteDTDExternalEntity(xmlTextWriterPtr writer,
|
||||
int pe,
|
||||
const xmlChar * name,
|
||||
const xmlChar * pubid,
|
||||
const xmlChar * sysid,
|
||||
const xmlChar * ndataid);
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteDTDExternalEntityContents(xmlTextWriterPtr
|
||||
writer,
|
||||
const xmlChar * pubid,
|
||||
const xmlChar * sysid,
|
||||
const xmlChar *
|
||||
ndataid);
|
||||
XMLPUBFUN int xmlTextWriterWriteDTDEntity(xmlTextWriterPtr
|
||||
writer, int pe,
|
||||
const xmlChar * name,
|
||||
const xmlChar *
|
||||
pubid,
|
||||
const xmlChar *
|
||||
sysid,
|
||||
const xmlChar *
|
||||
ndataid,
|
||||
const xmlChar *
|
||||
content);
|
||||
|
||||
/*
|
||||
* DTD notation definition
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterWriteDTDNotation(xmlTextWriterPtr writer,
|
||||
const xmlChar * name,
|
||||
const xmlChar * pubid,
|
||||
const xmlChar * sysid);
|
||||
|
||||
/*
|
||||
* Indentation
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterSetIndent(xmlTextWriterPtr writer, int indent);
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterSetIndentString(xmlTextWriterPtr writer,
|
||||
const xmlChar * str);
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlTextWriterSetQuoteChar(xmlTextWriterPtr writer, xmlChar quotechar);
|
||||
|
||||
|
||||
/*
|
||||
* misc
|
||||
*/
|
||||
XMLPUBFUN int xmlTextWriterFlush(xmlTextWriterPtr writer);
|
||||
XMLPUBFUN int xmlTextWriterClose(xmlTextWriterPtr writer);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_WRITER_ENABLED */
|
||||
|
||||
#endif /* __XML_XMLWRITER_H__ */
|
||||
+579
@@ -0,0 +1,579 @@
|
||||
/*
|
||||
* Summary: XML Path Language implementation
|
||||
* Description: API for the XML Path Language implementation
|
||||
*
|
||||
* XML Path Language implementation
|
||||
* XPath is a language for addressing parts of an XML document,
|
||||
* designed to be used by both XSLT and XPointer
|
||||
* http://www.w3.org/TR/xpath
|
||||
*
|
||||
* Implements
|
||||
* W3C Recommendation 16 November 1999
|
||||
* http://www.w3.org/TR/1999/REC-xpath-19991116
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_XPATH_H__
|
||||
#define __XML_XPATH_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#ifdef LIBXML_XPATH_ENABLED
|
||||
|
||||
#include <libxml/xmlerror.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/hash.h>
|
||||
#endif /* LIBXML_XPATH_ENABLED */
|
||||
|
||||
#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED */
|
||||
|
||||
#ifdef LIBXML_XPATH_ENABLED
|
||||
|
||||
typedef struct _xmlXPathContext xmlXPathContext;
|
||||
typedef xmlXPathContext *xmlXPathContextPtr;
|
||||
typedef struct _xmlXPathParserContext xmlXPathParserContext;
|
||||
typedef xmlXPathParserContext *xmlXPathParserContextPtr;
|
||||
|
||||
/**
|
||||
* The set of XPath error codes.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
XPATH_EXPRESSION_OK = 0,
|
||||
XPATH_NUMBER_ERROR,
|
||||
XPATH_UNFINISHED_LITERAL_ERROR,
|
||||
XPATH_START_LITERAL_ERROR,
|
||||
XPATH_VARIABLE_REF_ERROR,
|
||||
XPATH_UNDEF_VARIABLE_ERROR,
|
||||
XPATH_INVALID_PREDICATE_ERROR,
|
||||
XPATH_EXPR_ERROR,
|
||||
XPATH_UNCLOSED_ERROR,
|
||||
XPATH_UNKNOWN_FUNC_ERROR,
|
||||
XPATH_INVALID_OPERAND,
|
||||
XPATH_INVALID_TYPE,
|
||||
XPATH_INVALID_ARITY,
|
||||
XPATH_INVALID_CTXT_SIZE,
|
||||
XPATH_INVALID_CTXT_POSITION,
|
||||
XPATH_MEMORY_ERROR,
|
||||
XPTR_SYNTAX_ERROR,
|
||||
XPTR_RESOURCE_ERROR,
|
||||
XPTR_SUB_RESOURCE_ERROR,
|
||||
XPATH_UNDEF_PREFIX_ERROR,
|
||||
XPATH_ENCODING_ERROR,
|
||||
XPATH_INVALID_CHAR_ERROR,
|
||||
XPATH_INVALID_CTXT,
|
||||
XPATH_STACK_ERROR,
|
||||
XPATH_FORBID_VARIABLE_ERROR,
|
||||
XPATH_OP_LIMIT_EXCEEDED,
|
||||
XPATH_RECURSION_LIMIT_EXCEEDED
|
||||
} xmlXPathError;
|
||||
|
||||
/*
|
||||
* A node-set (an unordered collection of nodes without duplicates).
|
||||
*/
|
||||
typedef struct _xmlNodeSet xmlNodeSet;
|
||||
typedef xmlNodeSet *xmlNodeSetPtr;
|
||||
struct _xmlNodeSet {
|
||||
int nodeNr; /* number of nodes in the set */
|
||||
int nodeMax; /* size of the array as allocated */
|
||||
xmlNodePtr *nodeTab; /* array of nodes in no particular order */
|
||||
/* @@ with_ns to check whether namespace nodes should be looked at @@ */
|
||||
};
|
||||
|
||||
/*
|
||||
* An expression is evaluated to yield an object, which
|
||||
* has one of the following four basic types:
|
||||
* - node-set
|
||||
* - boolean
|
||||
* - number
|
||||
* - string
|
||||
*
|
||||
* @@ XPointer will add more types !
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
XPATH_UNDEFINED = 0,
|
||||
XPATH_NODESET = 1,
|
||||
XPATH_BOOLEAN = 2,
|
||||
XPATH_NUMBER = 3,
|
||||
XPATH_STRING = 4,
|
||||
#ifdef LIBXML_XPTR_LOCS_ENABLED
|
||||
XPATH_POINT = 5,
|
||||
XPATH_RANGE = 6,
|
||||
XPATH_LOCATIONSET = 7,
|
||||
#endif
|
||||
XPATH_USERS = 8,
|
||||
XPATH_XSLT_TREE = 9 /* An XSLT value tree, non modifiable */
|
||||
} xmlXPathObjectType;
|
||||
|
||||
#ifndef LIBXML_XPTR_LOCS_ENABLED
|
||||
/** DOC_DISABLE */
|
||||
#define XPATH_POINT 5
|
||||
#define XPATH_RANGE 6
|
||||
#define XPATH_LOCATIONSET 7
|
||||
/** DOC_ENABLE */
|
||||
#endif
|
||||
|
||||
typedef struct _xmlXPathObject xmlXPathObject;
|
||||
typedef xmlXPathObject *xmlXPathObjectPtr;
|
||||
struct _xmlXPathObject {
|
||||
xmlXPathObjectType type;
|
||||
xmlNodeSetPtr nodesetval;
|
||||
int boolval;
|
||||
double floatval;
|
||||
xmlChar *stringval;
|
||||
void *user;
|
||||
int index;
|
||||
void *user2;
|
||||
int index2;
|
||||
};
|
||||
|
||||
/**
|
||||
* xmlXPathConvertFunc:
|
||||
* @obj: an XPath object
|
||||
* @type: the number of the target type
|
||||
*
|
||||
* A conversion function is associated to a type and used to cast
|
||||
* the new type to primitive values.
|
||||
*
|
||||
* Returns -1 in case of error, 0 otherwise
|
||||
*/
|
||||
typedef int (*xmlXPathConvertFunc) (xmlXPathObjectPtr obj, int type);
|
||||
|
||||
/*
|
||||
* Extra type: a name and a conversion function.
|
||||
*/
|
||||
|
||||
typedef struct _xmlXPathType xmlXPathType;
|
||||
typedef xmlXPathType *xmlXPathTypePtr;
|
||||
struct _xmlXPathType {
|
||||
const xmlChar *name; /* the type name */
|
||||
xmlXPathConvertFunc func; /* the conversion function */
|
||||
};
|
||||
|
||||
/*
|
||||
* Extra variable: a name and a value.
|
||||
*/
|
||||
|
||||
typedef struct _xmlXPathVariable xmlXPathVariable;
|
||||
typedef xmlXPathVariable *xmlXPathVariablePtr;
|
||||
struct _xmlXPathVariable {
|
||||
const xmlChar *name; /* the variable name */
|
||||
xmlXPathObjectPtr value; /* the value */
|
||||
};
|
||||
|
||||
/**
|
||||
* xmlXPathEvalFunc:
|
||||
* @ctxt: an XPath parser context
|
||||
* @nargs: the number of arguments passed to the function
|
||||
*
|
||||
* An XPath evaluation function, the parameters are on the XPath context stack.
|
||||
*/
|
||||
|
||||
typedef void (*xmlXPathEvalFunc)(xmlXPathParserContextPtr ctxt,
|
||||
int nargs);
|
||||
|
||||
/*
|
||||
* Extra function: a name and a evaluation function.
|
||||
*/
|
||||
|
||||
typedef struct _xmlXPathFunct xmlXPathFunct;
|
||||
typedef xmlXPathFunct *xmlXPathFuncPtr;
|
||||
struct _xmlXPathFunct {
|
||||
const xmlChar *name; /* the function name */
|
||||
xmlXPathEvalFunc func; /* the evaluation function */
|
||||
};
|
||||
|
||||
/**
|
||||
* xmlXPathAxisFunc:
|
||||
* @ctxt: the XPath interpreter context
|
||||
* @cur: the previous node being explored on that axis
|
||||
*
|
||||
* An axis traversal function. To traverse an axis, the engine calls
|
||||
* the first time with cur == NULL and repeat until the function returns
|
||||
* NULL indicating the end of the axis traversal.
|
||||
*
|
||||
* Returns the next node in that axis or NULL if at the end of the axis.
|
||||
*/
|
||||
|
||||
typedef xmlXPathObjectPtr (*xmlXPathAxisFunc) (xmlXPathParserContextPtr ctxt,
|
||||
xmlXPathObjectPtr cur);
|
||||
|
||||
/*
|
||||
* Extra axis: a name and an axis function.
|
||||
*/
|
||||
|
||||
typedef struct _xmlXPathAxis xmlXPathAxis;
|
||||
typedef xmlXPathAxis *xmlXPathAxisPtr;
|
||||
struct _xmlXPathAxis {
|
||||
const xmlChar *name; /* the axis name */
|
||||
xmlXPathAxisFunc func; /* the search function */
|
||||
};
|
||||
|
||||
/**
|
||||
* xmlXPathFunction:
|
||||
* @ctxt: the XPath interprestation context
|
||||
* @nargs: the number of arguments
|
||||
*
|
||||
* An XPath function.
|
||||
* The arguments (if any) are popped out from the context stack
|
||||
* and the result is pushed on the stack.
|
||||
*/
|
||||
|
||||
typedef void (*xmlXPathFunction) (xmlXPathParserContextPtr ctxt, int nargs);
|
||||
|
||||
/*
|
||||
* Function and Variable Lookup.
|
||||
*/
|
||||
|
||||
/**
|
||||
* xmlXPathVariableLookupFunc:
|
||||
* @ctxt: an XPath context
|
||||
* @name: name of the variable
|
||||
* @ns_uri: the namespace name hosting this variable
|
||||
*
|
||||
* Prototype for callbacks used to plug variable lookup in the XPath
|
||||
* engine.
|
||||
*
|
||||
* Returns the XPath object value or NULL if not found.
|
||||
*/
|
||||
typedef xmlXPathObjectPtr (*xmlXPathVariableLookupFunc) (void *ctxt,
|
||||
const xmlChar *name,
|
||||
const xmlChar *ns_uri);
|
||||
|
||||
/**
|
||||
* xmlXPathFuncLookupFunc:
|
||||
* @ctxt: an XPath context
|
||||
* @name: name of the function
|
||||
* @ns_uri: the namespace name hosting this function
|
||||
*
|
||||
* Prototype for callbacks used to plug function lookup in the XPath
|
||||
* engine.
|
||||
*
|
||||
* Returns the XPath function or NULL if not found.
|
||||
*/
|
||||
typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt,
|
||||
const xmlChar *name,
|
||||
const xmlChar *ns_uri);
|
||||
|
||||
/**
|
||||
* xmlXPathFlags:
|
||||
* Flags for XPath engine compilation and runtime
|
||||
*/
|
||||
/**
|
||||
* XML_XPATH_CHECKNS:
|
||||
*
|
||||
* check namespaces at compilation
|
||||
*/
|
||||
#define XML_XPATH_CHECKNS (1<<0)
|
||||
/**
|
||||
* XML_XPATH_NOVAR:
|
||||
*
|
||||
* forbid variables in expression
|
||||
*/
|
||||
#define XML_XPATH_NOVAR (1<<1)
|
||||
|
||||
/**
|
||||
* xmlXPathContext:
|
||||
*
|
||||
* Expression evaluation occurs with respect to a context.
|
||||
* he context consists of:
|
||||
* - a node (the context node)
|
||||
* - a node list (the context node list)
|
||||
* - a set of variable bindings
|
||||
* - a function library
|
||||
* - the set of namespace declarations in scope for the expression
|
||||
* Following the switch to hash tables, this need to be trimmed up at
|
||||
* the next binary incompatible release.
|
||||
* The node may be modified when the context is passed to libxml2
|
||||
* for an XPath evaluation so you may need to initialize it again
|
||||
* before the next call.
|
||||
*/
|
||||
|
||||
struct _xmlXPathContext {
|
||||
xmlDocPtr doc; /* The current document */
|
||||
xmlNodePtr node; /* The current node */
|
||||
|
||||
int nb_variables_unused; /* unused (hash table) */
|
||||
int max_variables_unused; /* unused (hash table) */
|
||||
xmlHashTablePtr varHash; /* Hash table of defined variables */
|
||||
|
||||
int nb_types; /* number of defined types */
|
||||
int max_types; /* max number of types */
|
||||
xmlXPathTypePtr types; /* Array of defined types */
|
||||
|
||||
int nb_funcs_unused; /* unused (hash table) */
|
||||
int max_funcs_unused; /* unused (hash table) */
|
||||
xmlHashTablePtr funcHash; /* Hash table of defined funcs */
|
||||
|
||||
int nb_axis; /* number of defined axis */
|
||||
int max_axis; /* max number of axis */
|
||||
xmlXPathAxisPtr axis; /* Array of defined axis */
|
||||
|
||||
/* the namespace nodes of the context node */
|
||||
xmlNsPtr *namespaces; /* Array of namespaces */
|
||||
int nsNr; /* number of namespace in scope */
|
||||
void *user; /* function to free */
|
||||
|
||||
/* extra variables */
|
||||
int contextSize; /* the context size */
|
||||
int proximityPosition; /* the proximity position */
|
||||
|
||||
/* extra stuff for XPointer */
|
||||
int xptr; /* is this an XPointer context? */
|
||||
xmlNodePtr here; /* for here() */
|
||||
xmlNodePtr origin; /* for origin() */
|
||||
|
||||
/* the set of namespace declarations in scope for the expression */
|
||||
xmlHashTablePtr nsHash; /* The namespaces hash table */
|
||||
xmlXPathVariableLookupFunc varLookupFunc;/* variable lookup func */
|
||||
void *varLookupData; /* variable lookup data */
|
||||
|
||||
/* Possibility to link in an extra item */
|
||||
void *extra; /* needed for XSLT */
|
||||
|
||||
/* The function name and URI when calling a function */
|
||||
const xmlChar *function;
|
||||
const xmlChar *functionURI;
|
||||
|
||||
/* function lookup function and data */
|
||||
xmlXPathFuncLookupFunc funcLookupFunc;/* function lookup func */
|
||||
void *funcLookupData; /* function lookup data */
|
||||
|
||||
/* temporary namespace lists kept for walking the namespace axis */
|
||||
xmlNsPtr *tmpNsList; /* Array of namespaces */
|
||||
int tmpNsNr; /* number of namespaces in scope */
|
||||
|
||||
/* error reporting mechanism */
|
||||
void *userData; /* user specific data block */
|
||||
xmlStructuredErrorFunc error; /* the callback in case of errors */
|
||||
xmlError lastError; /* the last error */
|
||||
xmlNodePtr debugNode; /* the source node XSLT */
|
||||
|
||||
/* dictionary */
|
||||
xmlDictPtr dict; /* dictionary if any */
|
||||
|
||||
int flags; /* flags to control compilation */
|
||||
|
||||
/* Cache for reusal of XPath objects */
|
||||
void *cache;
|
||||
|
||||
/* Resource limits */
|
||||
unsigned long opLimit;
|
||||
unsigned long opCount;
|
||||
int depth;
|
||||
};
|
||||
|
||||
/*
|
||||
* The structure of a compiled expression form is not public.
|
||||
*/
|
||||
|
||||
typedef struct _xmlXPathCompExpr xmlXPathCompExpr;
|
||||
typedef xmlXPathCompExpr *xmlXPathCompExprPtr;
|
||||
|
||||
/**
|
||||
* xmlXPathParserContext:
|
||||
*
|
||||
* An XPath parser context. It contains pure parsing information,
|
||||
* an xmlXPathContext, and the stack of objects.
|
||||
*/
|
||||
struct _xmlXPathParserContext {
|
||||
const xmlChar *cur; /* the current char being parsed */
|
||||
const xmlChar *base; /* the full expression */
|
||||
|
||||
int error; /* error code */
|
||||
|
||||
xmlXPathContextPtr context; /* the evaluation context */
|
||||
xmlXPathObjectPtr value; /* the current value */
|
||||
int valueNr; /* number of values stacked */
|
||||
int valueMax; /* max number of values stacked */
|
||||
xmlXPathObjectPtr *valueTab; /* stack of values */
|
||||
|
||||
xmlXPathCompExprPtr comp; /* the precompiled expression */
|
||||
int xptr; /* it this an XPointer expression */
|
||||
xmlNodePtr ancestor; /* used for walking preceding axis */
|
||||
|
||||
int valueFrame; /* always zero for compatibility */
|
||||
};
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* Public API *
|
||||
* *
|
||||
************************************************************************/
|
||||
|
||||
/**
|
||||
* Objects and Nodesets handling
|
||||
*/
|
||||
|
||||
XMLPUBVAR double xmlXPathNAN;
|
||||
XMLPUBVAR double xmlXPathPINF;
|
||||
XMLPUBVAR double xmlXPathNINF;
|
||||
|
||||
/* These macros may later turn into functions */
|
||||
/**
|
||||
* xmlXPathNodeSetGetLength:
|
||||
* @ns: a node-set
|
||||
*
|
||||
* Implement a functionality similar to the DOM NodeList.length.
|
||||
*
|
||||
* Returns the number of nodes in the node-set.
|
||||
*/
|
||||
#define xmlXPathNodeSetGetLength(ns) ((ns) ? (ns)->nodeNr : 0)
|
||||
/**
|
||||
* xmlXPathNodeSetItem:
|
||||
* @ns: a node-set
|
||||
* @index: index of a node in the set
|
||||
*
|
||||
* Implements a functionality similar to the DOM NodeList.item().
|
||||
*
|
||||
* Returns the xmlNodePtr at the given @index in @ns or NULL if
|
||||
* @index is out of range (0 to length-1)
|
||||
*/
|
||||
#define xmlXPathNodeSetItem(ns, index) \
|
||||
((((ns) != NULL) && \
|
||||
((index) >= 0) && ((index) < (ns)->nodeNr)) ? \
|
||||
(ns)->nodeTab[(index)] \
|
||||
: NULL)
|
||||
/**
|
||||
* xmlXPathNodeSetIsEmpty:
|
||||
* @ns: a node-set
|
||||
*
|
||||
* Checks whether @ns is empty or not.
|
||||
*
|
||||
* Returns %TRUE if @ns is an empty node-set.
|
||||
*/
|
||||
#define xmlXPathNodeSetIsEmpty(ns) \
|
||||
(((ns) == NULL) || ((ns)->nodeNr == 0) || ((ns)->nodeTab == NULL))
|
||||
|
||||
|
||||
XMLPUBFUN void
|
||||
xmlXPathFreeObject (xmlXPathObjectPtr obj);
|
||||
XMLPUBFUN xmlNodeSetPtr
|
||||
xmlXPathNodeSetCreate (xmlNodePtr val);
|
||||
XMLPUBFUN void
|
||||
xmlXPathFreeNodeSetList (xmlXPathObjectPtr obj);
|
||||
XMLPUBFUN void
|
||||
xmlXPathFreeNodeSet (xmlNodeSetPtr obj);
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPathObjectCopy (xmlXPathObjectPtr val);
|
||||
XMLPUBFUN int
|
||||
xmlXPathCmpNodes (xmlNodePtr node1,
|
||||
xmlNodePtr node2);
|
||||
/**
|
||||
* Conversion functions to basic types.
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlXPathCastNumberToBoolean (double val);
|
||||
XMLPUBFUN int
|
||||
xmlXPathCastStringToBoolean (const xmlChar * val);
|
||||
XMLPUBFUN int
|
||||
xmlXPathCastNodeSetToBoolean(xmlNodeSetPtr ns);
|
||||
XMLPUBFUN int
|
||||
xmlXPathCastToBoolean (xmlXPathObjectPtr val);
|
||||
|
||||
XMLPUBFUN double
|
||||
xmlXPathCastBooleanToNumber (int val);
|
||||
XMLPUBFUN double
|
||||
xmlXPathCastStringToNumber (const xmlChar * val);
|
||||
XMLPUBFUN double
|
||||
xmlXPathCastNodeToNumber (xmlNodePtr node);
|
||||
XMLPUBFUN double
|
||||
xmlXPathCastNodeSetToNumber (xmlNodeSetPtr ns);
|
||||
XMLPUBFUN double
|
||||
xmlXPathCastToNumber (xmlXPathObjectPtr val);
|
||||
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlXPathCastBooleanToString (int val);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlXPathCastNumberToString (double val);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlXPathCastNodeToString (xmlNodePtr node);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlXPathCastNodeSetToString (xmlNodeSetPtr ns);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlXPathCastToString (xmlXPathObjectPtr val);
|
||||
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPathConvertBoolean (xmlXPathObjectPtr val);
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPathConvertNumber (xmlXPathObjectPtr val);
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPathConvertString (xmlXPathObjectPtr val);
|
||||
|
||||
/**
|
||||
* Context handling.
|
||||
*/
|
||||
XMLPUBFUN xmlXPathContextPtr
|
||||
xmlXPathNewContext (xmlDocPtr doc);
|
||||
XMLPUBFUN void
|
||||
xmlXPathFreeContext (xmlXPathContextPtr ctxt);
|
||||
XMLPUBFUN void
|
||||
xmlXPathSetErrorHandler(xmlXPathContextPtr ctxt,
|
||||
xmlStructuredErrorFunc handler,
|
||||
void *context);
|
||||
XMLPUBFUN int
|
||||
xmlXPathContextSetCache(xmlXPathContextPtr ctxt,
|
||||
int active,
|
||||
int value,
|
||||
int options);
|
||||
/**
|
||||
* Evaluation functions.
|
||||
*/
|
||||
XMLPUBFUN long
|
||||
xmlXPathOrderDocElems (xmlDocPtr doc);
|
||||
XMLPUBFUN int
|
||||
xmlXPathSetContextNode (xmlNodePtr node,
|
||||
xmlXPathContextPtr ctx);
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPathNodeEval (xmlNodePtr node,
|
||||
const xmlChar *str,
|
||||
xmlXPathContextPtr ctx);
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPathEval (const xmlChar *str,
|
||||
xmlXPathContextPtr ctx);
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPathEvalExpression (const xmlChar *str,
|
||||
xmlXPathContextPtr ctxt);
|
||||
XMLPUBFUN int
|
||||
xmlXPathEvalPredicate (xmlXPathContextPtr ctxt,
|
||||
xmlXPathObjectPtr res);
|
||||
/**
|
||||
* Separate compilation/evaluation entry points.
|
||||
*/
|
||||
XMLPUBFUN xmlXPathCompExprPtr
|
||||
xmlXPathCompile (const xmlChar *str);
|
||||
XMLPUBFUN xmlXPathCompExprPtr
|
||||
xmlXPathCtxtCompile (xmlXPathContextPtr ctxt,
|
||||
const xmlChar *str);
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPathCompiledEval (xmlXPathCompExprPtr comp,
|
||||
xmlXPathContextPtr ctx);
|
||||
XMLPUBFUN int
|
||||
xmlXPathCompiledEvalToBoolean(xmlXPathCompExprPtr comp,
|
||||
xmlXPathContextPtr ctxt);
|
||||
XMLPUBFUN void
|
||||
xmlXPathFreeCompExpr (xmlXPathCompExprPtr comp);
|
||||
#endif /* LIBXML_XPATH_ENABLED */
|
||||
#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlXPathInit (void);
|
||||
XMLPUBFUN int
|
||||
xmlXPathIsNaN (double val);
|
||||
XMLPUBFUN int
|
||||
xmlXPathIsInf (double val);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED*/
|
||||
#endif /* ! __XML_XPATH_H__ */
|
||||
+633
@@ -0,0 +1,633 @@
|
||||
/*
|
||||
* Summary: internal interfaces for XML Path Language implementation
|
||||
* Description: internal interfaces for XML Path Language implementation
|
||||
* used to build new modules on top of XPath like XPointer and
|
||||
* XSLT
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_XPATH_INTERNALS_H__
|
||||
#define __XML_XPATH_INTERNALS_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <libxml/xmlversion.h>
|
||||
#include <libxml/xpath.h>
|
||||
|
||||
#ifdef LIBXML_XPATH_ENABLED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* Helpers *
|
||||
* *
|
||||
************************************************************************/
|
||||
|
||||
/*
|
||||
* Many of these macros may later turn into functions. They
|
||||
* shouldn't be used in #ifdef's preprocessor instructions.
|
||||
*/
|
||||
/**
|
||||
* xmlXPathSetError:
|
||||
* @ctxt: an XPath parser context
|
||||
* @err: an xmlXPathError code
|
||||
*
|
||||
* Raises an error.
|
||||
*/
|
||||
#define xmlXPathSetError(ctxt, err) \
|
||||
{ xmlXPatherror((ctxt), __FILE__, __LINE__, (err)); \
|
||||
if ((ctxt) != NULL) (ctxt)->error = (err); }
|
||||
|
||||
/**
|
||||
* xmlXPathSetArityError:
|
||||
* @ctxt: an XPath parser context
|
||||
*
|
||||
* Raises an XPATH_INVALID_ARITY error.
|
||||
*/
|
||||
#define xmlXPathSetArityError(ctxt) \
|
||||
xmlXPathSetError((ctxt), XPATH_INVALID_ARITY)
|
||||
|
||||
/**
|
||||
* xmlXPathSetTypeError:
|
||||
* @ctxt: an XPath parser context
|
||||
*
|
||||
* Raises an XPATH_INVALID_TYPE error.
|
||||
*/
|
||||
#define xmlXPathSetTypeError(ctxt) \
|
||||
xmlXPathSetError((ctxt), XPATH_INVALID_TYPE)
|
||||
|
||||
/**
|
||||
* xmlXPathGetError:
|
||||
* @ctxt: an XPath parser context
|
||||
*
|
||||
* Get the error code of an XPath context.
|
||||
*
|
||||
* Returns the context error.
|
||||
*/
|
||||
#define xmlXPathGetError(ctxt) ((ctxt)->error)
|
||||
|
||||
/**
|
||||
* xmlXPathCheckError:
|
||||
* @ctxt: an XPath parser context
|
||||
*
|
||||
* Check if an XPath error was raised.
|
||||
*
|
||||
* Returns true if an error has been raised, false otherwise.
|
||||
*/
|
||||
#define xmlXPathCheckError(ctxt) ((ctxt)->error != XPATH_EXPRESSION_OK)
|
||||
|
||||
/**
|
||||
* xmlXPathGetDocument:
|
||||
* @ctxt: an XPath parser context
|
||||
*
|
||||
* Get the document of an XPath context.
|
||||
*
|
||||
* Returns the context document.
|
||||
*/
|
||||
#define xmlXPathGetDocument(ctxt) ((ctxt)->context->doc)
|
||||
|
||||
/**
|
||||
* xmlXPathGetContextNode:
|
||||
* @ctxt: an XPath parser context
|
||||
*
|
||||
* Get the context node of an XPath context.
|
||||
*
|
||||
* Returns the context node.
|
||||
*/
|
||||
#define xmlXPathGetContextNode(ctxt) ((ctxt)->context->node)
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlXPathPopBoolean (xmlXPathParserContextPtr ctxt);
|
||||
XMLPUBFUN double
|
||||
xmlXPathPopNumber (xmlXPathParserContextPtr ctxt);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlXPathPopString (xmlXPathParserContextPtr ctxt);
|
||||
XMLPUBFUN xmlNodeSetPtr
|
||||
xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt);
|
||||
XMLPUBFUN void *
|
||||
xmlXPathPopExternal (xmlXPathParserContextPtr ctxt);
|
||||
|
||||
/**
|
||||
* xmlXPathReturnBoolean:
|
||||
* @ctxt: an XPath parser context
|
||||
* @val: a boolean
|
||||
*
|
||||
* Pushes the boolean @val on the context stack.
|
||||
*/
|
||||
#define xmlXPathReturnBoolean(ctxt, val) \
|
||||
valuePush((ctxt), xmlXPathNewBoolean(val))
|
||||
|
||||
/**
|
||||
* xmlXPathReturnTrue:
|
||||
* @ctxt: an XPath parser context
|
||||
*
|
||||
* Pushes true on the context stack.
|
||||
*/
|
||||
#define xmlXPathReturnTrue(ctxt) xmlXPathReturnBoolean((ctxt), 1)
|
||||
|
||||
/**
|
||||
* xmlXPathReturnFalse:
|
||||
* @ctxt: an XPath parser context
|
||||
*
|
||||
* Pushes false on the context stack.
|
||||
*/
|
||||
#define xmlXPathReturnFalse(ctxt) xmlXPathReturnBoolean((ctxt), 0)
|
||||
|
||||
/**
|
||||
* xmlXPathReturnNumber:
|
||||
* @ctxt: an XPath parser context
|
||||
* @val: a double
|
||||
*
|
||||
* Pushes the double @val on the context stack.
|
||||
*/
|
||||
#define xmlXPathReturnNumber(ctxt, val) \
|
||||
valuePush((ctxt), xmlXPathNewFloat(val))
|
||||
|
||||
/**
|
||||
* xmlXPathReturnString:
|
||||
* @ctxt: an XPath parser context
|
||||
* @str: a string
|
||||
*
|
||||
* Pushes the string @str on the context stack.
|
||||
*/
|
||||
#define xmlXPathReturnString(ctxt, str) \
|
||||
valuePush((ctxt), xmlXPathWrapString(str))
|
||||
|
||||
/**
|
||||
* xmlXPathReturnEmptyString:
|
||||
* @ctxt: an XPath parser context
|
||||
*
|
||||
* Pushes an empty string on the stack.
|
||||
*/
|
||||
#define xmlXPathReturnEmptyString(ctxt) \
|
||||
valuePush((ctxt), xmlXPathNewCString(""))
|
||||
|
||||
/**
|
||||
* xmlXPathReturnNodeSet:
|
||||
* @ctxt: an XPath parser context
|
||||
* @ns: a node-set
|
||||
*
|
||||
* Pushes the node-set @ns on the context stack.
|
||||
*/
|
||||
#define xmlXPathReturnNodeSet(ctxt, ns) \
|
||||
valuePush((ctxt), xmlXPathWrapNodeSet(ns))
|
||||
|
||||
/**
|
||||
* xmlXPathReturnEmptyNodeSet:
|
||||
* @ctxt: an XPath parser context
|
||||
*
|
||||
* Pushes an empty node-set on the context stack.
|
||||
*/
|
||||
#define xmlXPathReturnEmptyNodeSet(ctxt) \
|
||||
valuePush((ctxt), xmlXPathNewNodeSet(NULL))
|
||||
|
||||
/**
|
||||
* xmlXPathReturnExternal:
|
||||
* @ctxt: an XPath parser context
|
||||
* @val: user data
|
||||
*
|
||||
* Pushes user data on the context stack.
|
||||
*/
|
||||
#define xmlXPathReturnExternal(ctxt, val) \
|
||||
valuePush((ctxt), xmlXPathWrapExternal(val))
|
||||
|
||||
/**
|
||||
* xmlXPathStackIsNodeSet:
|
||||
* @ctxt: an XPath parser context
|
||||
*
|
||||
* Check if the current value on the XPath stack is a node set or
|
||||
* an XSLT value tree.
|
||||
*
|
||||
* Returns true if the current object on the stack is a node-set.
|
||||
*/
|
||||
#define xmlXPathStackIsNodeSet(ctxt) \
|
||||
(((ctxt)->value != NULL) \
|
||||
&& (((ctxt)->value->type == XPATH_NODESET) \
|
||||
|| ((ctxt)->value->type == XPATH_XSLT_TREE)))
|
||||
|
||||
/**
|
||||
* xmlXPathStackIsExternal:
|
||||
* @ctxt: an XPath parser context
|
||||
*
|
||||
* Checks if the current value on the XPath stack is an external
|
||||
* object.
|
||||
*
|
||||
* Returns true if the current object on the stack is an external
|
||||
* object.
|
||||
*/
|
||||
#define xmlXPathStackIsExternal(ctxt) \
|
||||
((ctxt->value != NULL) && (ctxt->value->type == XPATH_USERS))
|
||||
|
||||
/**
|
||||
* xmlXPathEmptyNodeSet:
|
||||
* @ns: a node-set
|
||||
*
|
||||
* Empties a node-set.
|
||||
*/
|
||||
#define xmlXPathEmptyNodeSet(ns) \
|
||||
{ while ((ns)->nodeNr > 0) (ns)->nodeTab[--(ns)->nodeNr] = NULL; }
|
||||
|
||||
/**
|
||||
* CHECK_ERROR:
|
||||
*
|
||||
* Macro to return from the function if an XPath error was detected.
|
||||
*/
|
||||
#define CHECK_ERROR \
|
||||
if (ctxt->error != XPATH_EXPRESSION_OK) return
|
||||
|
||||
/**
|
||||
* CHECK_ERROR0:
|
||||
*
|
||||
* Macro to return 0 from the function if an XPath error was detected.
|
||||
*/
|
||||
#define CHECK_ERROR0 \
|
||||
if (ctxt->error != XPATH_EXPRESSION_OK) return(0)
|
||||
|
||||
/**
|
||||
* XP_ERROR:
|
||||
* @X: the error code
|
||||
*
|
||||
* Macro to raise an XPath error and return.
|
||||
*/
|
||||
#define XP_ERROR(X) \
|
||||
{ xmlXPathErr(ctxt, X); return; }
|
||||
|
||||
/**
|
||||
* XP_ERROR0:
|
||||
* @X: the error code
|
||||
*
|
||||
* Macro to raise an XPath error and return 0.
|
||||
*/
|
||||
#define XP_ERROR0(X) \
|
||||
{ xmlXPathErr(ctxt, X); return(0); }
|
||||
|
||||
/**
|
||||
* CHECK_TYPE:
|
||||
* @typeval: the XPath type
|
||||
*
|
||||
* Macro to check that the value on top of the XPath stack is of a given
|
||||
* type.
|
||||
*/
|
||||
#define CHECK_TYPE(typeval) \
|
||||
if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \
|
||||
XP_ERROR(XPATH_INVALID_TYPE)
|
||||
|
||||
/**
|
||||
* CHECK_TYPE0:
|
||||
* @typeval: the XPath type
|
||||
*
|
||||
* Macro to check that the value on top of the XPath stack is of a given
|
||||
* type. Return(0) in case of failure
|
||||
*/
|
||||
#define CHECK_TYPE0(typeval) \
|
||||
if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \
|
||||
XP_ERROR0(XPATH_INVALID_TYPE)
|
||||
|
||||
/**
|
||||
* CHECK_ARITY:
|
||||
* @x: the number of expected args
|
||||
*
|
||||
* Macro to check that the number of args passed to an XPath function matches.
|
||||
*/
|
||||
#define CHECK_ARITY(x) \
|
||||
if (ctxt == NULL) return; \
|
||||
if (nargs != (x)) \
|
||||
XP_ERROR(XPATH_INVALID_ARITY); \
|
||||
if (ctxt->valueNr < (x)) \
|
||||
XP_ERROR(XPATH_STACK_ERROR);
|
||||
|
||||
/**
|
||||
* CAST_TO_STRING:
|
||||
*
|
||||
* Macro to try to cast the value on the top of the XPath stack to a string.
|
||||
*/
|
||||
#define CAST_TO_STRING \
|
||||
if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_STRING)) \
|
||||
xmlXPathStringFunction(ctxt, 1);
|
||||
|
||||
/**
|
||||
* CAST_TO_NUMBER:
|
||||
*
|
||||
* Macro to try to cast the value on the top of the XPath stack to a number.
|
||||
*/
|
||||
#define CAST_TO_NUMBER \
|
||||
if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_NUMBER)) \
|
||||
xmlXPathNumberFunction(ctxt, 1);
|
||||
|
||||
/**
|
||||
* CAST_TO_BOOLEAN:
|
||||
*
|
||||
* Macro to try to cast the value on the top of the XPath stack to a boolean.
|
||||
*/
|
||||
#define CAST_TO_BOOLEAN \
|
||||
if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_BOOLEAN)) \
|
||||
xmlXPathBooleanFunction(ctxt, 1);
|
||||
|
||||
/*
|
||||
* Variable Lookup forwarding.
|
||||
*/
|
||||
|
||||
XMLPUBFUN void
|
||||
xmlXPathRegisterVariableLookup (xmlXPathContextPtr ctxt,
|
||||
xmlXPathVariableLookupFunc f,
|
||||
void *data);
|
||||
|
||||
/*
|
||||
* Function Lookup forwarding.
|
||||
*/
|
||||
|
||||
XMLPUBFUN void
|
||||
xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt,
|
||||
xmlXPathFuncLookupFunc f,
|
||||
void *funcCtxt);
|
||||
|
||||
/*
|
||||
* Error reporting.
|
||||
*/
|
||||
XMLPUBFUN void
|
||||
xmlXPatherror (xmlXPathParserContextPtr ctxt,
|
||||
const char *file,
|
||||
int line,
|
||||
int no);
|
||||
|
||||
XMLPUBFUN void
|
||||
xmlXPathErr (xmlXPathParserContextPtr ctxt,
|
||||
int error);
|
||||
|
||||
#ifdef LIBXML_DEBUG_ENABLED
|
||||
XMLPUBFUN void
|
||||
xmlXPathDebugDumpObject (FILE *output,
|
||||
xmlXPathObjectPtr cur,
|
||||
int depth);
|
||||
XMLPUBFUN void
|
||||
xmlXPathDebugDumpCompExpr(FILE *output,
|
||||
xmlXPathCompExprPtr comp,
|
||||
int depth);
|
||||
#endif
|
||||
/**
|
||||
* NodeSet handling.
|
||||
*/
|
||||
XMLPUBFUN int
|
||||
xmlXPathNodeSetContains (xmlNodeSetPtr cur,
|
||||
xmlNodePtr val);
|
||||
XMLPUBFUN xmlNodeSetPtr
|
||||
xmlXPathDifference (xmlNodeSetPtr nodes1,
|
||||
xmlNodeSetPtr nodes2);
|
||||
XMLPUBFUN xmlNodeSetPtr
|
||||
xmlXPathIntersection (xmlNodeSetPtr nodes1,
|
||||
xmlNodeSetPtr nodes2);
|
||||
|
||||
XMLPUBFUN xmlNodeSetPtr
|
||||
xmlXPathDistinctSorted (xmlNodeSetPtr nodes);
|
||||
XMLPUBFUN xmlNodeSetPtr
|
||||
xmlXPathDistinct (xmlNodeSetPtr nodes);
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlXPathHasSameNodes (xmlNodeSetPtr nodes1,
|
||||
xmlNodeSetPtr nodes2);
|
||||
|
||||
XMLPUBFUN xmlNodeSetPtr
|
||||
xmlXPathNodeLeadingSorted (xmlNodeSetPtr nodes,
|
||||
xmlNodePtr node);
|
||||
XMLPUBFUN xmlNodeSetPtr
|
||||
xmlXPathLeadingSorted (xmlNodeSetPtr nodes1,
|
||||
xmlNodeSetPtr nodes2);
|
||||
XMLPUBFUN xmlNodeSetPtr
|
||||
xmlXPathNodeLeading (xmlNodeSetPtr nodes,
|
||||
xmlNodePtr node);
|
||||
XMLPUBFUN xmlNodeSetPtr
|
||||
xmlXPathLeading (xmlNodeSetPtr nodes1,
|
||||
xmlNodeSetPtr nodes2);
|
||||
|
||||
XMLPUBFUN xmlNodeSetPtr
|
||||
xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes,
|
||||
xmlNodePtr node);
|
||||
XMLPUBFUN xmlNodeSetPtr
|
||||
xmlXPathTrailingSorted (xmlNodeSetPtr nodes1,
|
||||
xmlNodeSetPtr nodes2);
|
||||
XMLPUBFUN xmlNodeSetPtr
|
||||
xmlXPathNodeTrailing (xmlNodeSetPtr nodes,
|
||||
xmlNodePtr node);
|
||||
XMLPUBFUN xmlNodeSetPtr
|
||||
xmlXPathTrailing (xmlNodeSetPtr nodes1,
|
||||
xmlNodeSetPtr nodes2);
|
||||
|
||||
|
||||
/**
|
||||
* Extending a context.
|
||||
*/
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlXPathRegisterNs (xmlXPathContextPtr ctxt,
|
||||
const xmlChar *prefix,
|
||||
const xmlChar *ns_uri);
|
||||
XMLPUBFUN const xmlChar *
|
||||
xmlXPathNsLookup (xmlXPathContextPtr ctxt,
|
||||
const xmlChar *prefix);
|
||||
XMLPUBFUN void
|
||||
xmlXPathRegisteredNsCleanup (xmlXPathContextPtr ctxt);
|
||||
|
||||
XMLPUBFUN int
|
||||
xmlXPathRegisterFunc (xmlXPathContextPtr ctxt,
|
||||
const xmlChar *name,
|
||||
xmlXPathFunction f);
|
||||
XMLPUBFUN int
|
||||
xmlXPathRegisterFuncNS (xmlXPathContextPtr ctxt,
|
||||
const xmlChar *name,
|
||||
const xmlChar *ns_uri,
|
||||
xmlXPathFunction f);
|
||||
XMLPUBFUN int
|
||||
xmlXPathRegisterVariable (xmlXPathContextPtr ctxt,
|
||||
const xmlChar *name,
|
||||
xmlXPathObjectPtr value);
|
||||
XMLPUBFUN int
|
||||
xmlXPathRegisterVariableNS (xmlXPathContextPtr ctxt,
|
||||
const xmlChar *name,
|
||||
const xmlChar *ns_uri,
|
||||
xmlXPathObjectPtr value);
|
||||
XMLPUBFUN xmlXPathFunction
|
||||
xmlXPathFunctionLookup (xmlXPathContextPtr ctxt,
|
||||
const xmlChar *name);
|
||||
XMLPUBFUN xmlXPathFunction
|
||||
xmlXPathFunctionLookupNS (xmlXPathContextPtr ctxt,
|
||||
const xmlChar *name,
|
||||
const xmlChar *ns_uri);
|
||||
XMLPUBFUN void
|
||||
xmlXPathRegisteredFuncsCleanup (xmlXPathContextPtr ctxt);
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPathVariableLookup (xmlXPathContextPtr ctxt,
|
||||
const xmlChar *name);
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPathVariableLookupNS (xmlXPathContextPtr ctxt,
|
||||
const xmlChar *name,
|
||||
const xmlChar *ns_uri);
|
||||
XMLPUBFUN void
|
||||
xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt);
|
||||
|
||||
/**
|
||||
* Utilities to extend XPath.
|
||||
*/
|
||||
XMLPUBFUN xmlXPathParserContextPtr
|
||||
xmlXPathNewParserContext (const xmlChar *str,
|
||||
xmlXPathContextPtr ctxt);
|
||||
XMLPUBFUN void
|
||||
xmlXPathFreeParserContext (xmlXPathParserContextPtr ctxt);
|
||||
|
||||
/* TODO: remap to xmlXPathValuePop and Push. */
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
valuePop (xmlXPathParserContextPtr ctxt);
|
||||
XMLPUBFUN int
|
||||
valuePush (xmlXPathParserContextPtr ctxt,
|
||||
xmlXPathObjectPtr value);
|
||||
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPathNewString (const xmlChar *val);
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPathNewCString (const char *val);
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPathWrapString (xmlChar *val);
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPathWrapCString (char * val);
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPathNewFloat (double val);
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPathNewBoolean (int val);
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPathNewNodeSet (xmlNodePtr val);
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPathNewValueTree (xmlNodePtr val);
|
||||
XMLPUBFUN int
|
||||
xmlXPathNodeSetAdd (xmlNodeSetPtr cur,
|
||||
xmlNodePtr val);
|
||||
XMLPUBFUN int
|
||||
xmlXPathNodeSetAddUnique (xmlNodeSetPtr cur,
|
||||
xmlNodePtr val);
|
||||
XMLPUBFUN int
|
||||
xmlXPathNodeSetAddNs (xmlNodeSetPtr cur,
|
||||
xmlNodePtr node,
|
||||
xmlNsPtr ns);
|
||||
XMLPUBFUN void
|
||||
xmlXPathNodeSetSort (xmlNodeSetPtr set);
|
||||
|
||||
XMLPUBFUN void
|
||||
xmlXPathRoot (xmlXPathParserContextPtr ctxt);
|
||||
XMLPUBFUN void
|
||||
xmlXPathEvalExpr (xmlXPathParserContextPtr ctxt);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlXPathParseName (xmlXPathParserContextPtr ctxt);
|
||||
XMLPUBFUN xmlChar *
|
||||
xmlXPathParseNCName (xmlXPathParserContextPtr ctxt);
|
||||
|
||||
/*
|
||||
* Existing functions.
|
||||
*/
|
||||
XMLPUBFUN double
|
||||
xmlXPathStringEvalNumber (const xmlChar *str);
|
||||
XMLPUBFUN int
|
||||
xmlXPathEvaluatePredicateResult (xmlXPathParserContextPtr ctxt,
|
||||
xmlXPathObjectPtr res);
|
||||
XMLPUBFUN void
|
||||
xmlXPathRegisterAllFunctions (xmlXPathContextPtr ctxt);
|
||||
XMLPUBFUN xmlNodeSetPtr
|
||||
xmlXPathNodeSetMerge (xmlNodeSetPtr val1,
|
||||
xmlNodeSetPtr val2);
|
||||
XMLPUBFUN void
|
||||
xmlXPathNodeSetDel (xmlNodeSetPtr cur,
|
||||
xmlNodePtr val);
|
||||
XMLPUBFUN void
|
||||
xmlXPathNodeSetRemove (xmlNodeSetPtr cur,
|
||||
int val);
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPathNewNodeSetList (xmlNodeSetPtr val);
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPathWrapNodeSet (xmlNodeSetPtr val);
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPathWrapExternal (void *val);
|
||||
|
||||
XMLPUBFUN int xmlXPathEqualValues(xmlXPathParserContextPtr ctxt);
|
||||
XMLPUBFUN int xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt);
|
||||
XMLPUBFUN int xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict);
|
||||
XMLPUBFUN void xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt);
|
||||
XMLPUBFUN void xmlXPathAddValues(xmlXPathParserContextPtr ctxt);
|
||||
XMLPUBFUN void xmlXPathSubValues(xmlXPathParserContextPtr ctxt);
|
||||
XMLPUBFUN void xmlXPathMultValues(xmlXPathParserContextPtr ctxt);
|
||||
XMLPUBFUN void xmlXPathDivValues(xmlXPathParserContextPtr ctxt);
|
||||
XMLPUBFUN void xmlXPathModValues(xmlXPathParserContextPtr ctxt);
|
||||
|
||||
XMLPUBFUN int xmlXPathIsNodeType(const xmlChar *name);
|
||||
|
||||
/*
|
||||
* Some of the axis navigation routines.
|
||||
*/
|
||||
XMLPUBFUN xmlNodePtr xmlXPathNextSelf(xmlXPathParserContextPtr ctxt,
|
||||
xmlNodePtr cur);
|
||||
XMLPUBFUN xmlNodePtr xmlXPathNextChild(xmlXPathParserContextPtr ctxt,
|
||||
xmlNodePtr cur);
|
||||
XMLPUBFUN xmlNodePtr xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt,
|
||||
xmlNodePtr cur);
|
||||
XMLPUBFUN xmlNodePtr xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt,
|
||||
xmlNodePtr cur);
|
||||
XMLPUBFUN xmlNodePtr xmlXPathNextParent(xmlXPathParserContextPtr ctxt,
|
||||
xmlNodePtr cur);
|
||||
XMLPUBFUN xmlNodePtr xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt,
|
||||
xmlNodePtr cur);
|
||||
XMLPUBFUN xmlNodePtr xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt,
|
||||
xmlNodePtr cur);
|
||||
XMLPUBFUN xmlNodePtr xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt,
|
||||
xmlNodePtr cur);
|
||||
XMLPUBFUN xmlNodePtr xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt,
|
||||
xmlNodePtr cur);
|
||||
XMLPUBFUN xmlNodePtr xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt,
|
||||
xmlNodePtr cur);
|
||||
XMLPUBFUN xmlNodePtr xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt,
|
||||
xmlNodePtr cur);
|
||||
XMLPUBFUN xmlNodePtr xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt,
|
||||
xmlNodePtr cur);
|
||||
XMLPUBFUN xmlNodePtr xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt,
|
||||
xmlNodePtr cur);
|
||||
/*
|
||||
* The official core of XPath functions.
|
||||
*/
|
||||
XMLPUBFUN void xmlXPathLastFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
||||
XMLPUBFUN void xmlXPathPositionFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
||||
XMLPUBFUN void xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
||||
XMLPUBFUN void xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
||||
XMLPUBFUN void xmlXPathLocalNameFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
||||
XMLPUBFUN void xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
||||
XMLPUBFUN void xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
||||
XMLPUBFUN void xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
||||
XMLPUBFUN void xmlXPathConcatFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
||||
XMLPUBFUN void xmlXPathContainsFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
||||
XMLPUBFUN void xmlXPathStartsWithFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
||||
XMLPUBFUN void xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
||||
XMLPUBFUN void xmlXPathSubstringBeforeFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
||||
XMLPUBFUN void xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
||||
XMLPUBFUN void xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
||||
XMLPUBFUN void xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
||||
XMLPUBFUN void xmlXPathNotFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
||||
XMLPUBFUN void xmlXPathTrueFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
||||
XMLPUBFUN void xmlXPathFalseFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
||||
XMLPUBFUN void xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
||||
XMLPUBFUN void xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
||||
XMLPUBFUN void xmlXPathSumFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
||||
XMLPUBFUN void xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
||||
XMLPUBFUN void xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
||||
XMLPUBFUN void xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
||||
XMLPUBFUN void xmlXPathBooleanFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
||||
|
||||
/**
|
||||
* Really internal functions
|
||||
*/
|
||||
XMLPUBFUN void xmlXPathNodeSetFreeNs(xmlNsPtr ns);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_XPATH_ENABLED */
|
||||
#endif /* ! __XML_XPATH_INTERNALS_H__ */
|
||||
+138
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* Summary: API to handle XML Pointers
|
||||
* Description: API to handle XML Pointers
|
||||
* Base implementation was made accordingly to
|
||||
* W3C Candidate Recommendation 7 June 2000
|
||||
* http://www.w3.org/TR/2000/CR-xptr-20000607
|
||||
*
|
||||
* Added support for the element() scheme described in:
|
||||
* W3C Proposed Recommendation 13 November 2002
|
||||
* http://www.w3.org/TR/2002/PR-xptr-element-20021113/
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_XPTR_H__
|
||||
#define __XML_XPTR_H__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#ifdef LIBXML_XPTR_ENABLED
|
||||
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/xpath.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_XPTR_LOCS_ENABLED)
|
||||
/*
|
||||
* A Location Set
|
||||
*/
|
||||
typedef struct _xmlLocationSet xmlLocationSet;
|
||||
typedef xmlLocationSet *xmlLocationSetPtr;
|
||||
struct _xmlLocationSet {
|
||||
int locNr; /* number of locations in the set */
|
||||
int locMax; /* size of the array as allocated */
|
||||
xmlXPathObjectPtr *locTab;/* array of locations */
|
||||
};
|
||||
|
||||
/*
|
||||
* Handling of location sets.
|
||||
*/
|
||||
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlLocationSetPtr
|
||||
xmlXPtrLocationSetCreate (xmlXPathObjectPtr val);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlXPtrFreeLocationSet (xmlLocationSetPtr obj);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlLocationSetPtr
|
||||
xmlXPtrLocationSetMerge (xmlLocationSetPtr val1,
|
||||
xmlLocationSetPtr val2);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPtrNewRange (xmlNodePtr start,
|
||||
int startindex,
|
||||
xmlNodePtr end,
|
||||
int endindex);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPtrNewRangePoints (xmlXPathObjectPtr start,
|
||||
xmlXPathObjectPtr end);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPtrNewRangeNodePoint (xmlNodePtr start,
|
||||
xmlXPathObjectPtr end);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPtrNewRangePointNode (xmlXPathObjectPtr start,
|
||||
xmlNodePtr end);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPtrNewRangeNodes (xmlNodePtr start,
|
||||
xmlNodePtr end);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPtrNewLocationSetNodes (xmlNodePtr start,
|
||||
xmlNodePtr end);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPtrNewRangeNodeObject (xmlNodePtr start,
|
||||
xmlXPathObjectPtr end);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPtrNewCollapsedRange (xmlNodePtr start);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlXPtrLocationSetAdd (xmlLocationSetPtr cur,
|
||||
xmlXPathObjectPtr val);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPtrWrapLocationSet (xmlLocationSetPtr val);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlXPtrLocationSetDel (xmlLocationSetPtr cur,
|
||||
xmlXPathObjectPtr val);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlXPtrLocationSetRemove (xmlLocationSetPtr cur,
|
||||
int val);
|
||||
#endif /* defined(LIBXML_XPTR_LOCS_ENABLED) */
|
||||
|
||||
/*
|
||||
* Functions.
|
||||
*/
|
||||
XMLPUBFUN xmlXPathContextPtr
|
||||
xmlXPtrNewContext (xmlDocPtr doc,
|
||||
xmlNodePtr here,
|
||||
xmlNodePtr origin);
|
||||
XMLPUBFUN xmlXPathObjectPtr
|
||||
xmlXPtrEval (const xmlChar *str,
|
||||
xmlXPathContextPtr ctx);
|
||||
|
||||
#if defined(LIBXML_XPTR_LOCS_ENABLED)
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlXPtrRangeToFunction (xmlXPathParserContextPtr ctxt,
|
||||
int nargs);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlNodePtr
|
||||
xmlXPtrBuildNodeList (xmlXPathObjectPtr obj);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlXPtrEvalRangePredicate (xmlXPathParserContextPtr ctxt);
|
||||
#endif /* defined(LIBXML_XPTR_LOCS_ENABLED) */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_XPTR_ENABLED */
|
||||
#endif /* __XML_XPTR_H__ */
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Summary: interface for the XSLT attribute handling
|
||||
* Description: this module handles the specificities of attribute
|
||||
* and attribute groups processing.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_XSLT_ATTRIBUTES_H__
|
||||
#define __XML_XSLT_ATTRIBUTES_H__
|
||||
|
||||
#include <libxml/tree.h>
|
||||
#include "xsltexports.h"
|
||||
#include "xsltInternals.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltParseStylesheetAttributeSet (xsltStylesheetPtr style,
|
||||
xmlNodePtr cur);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltFreeAttributeSetsHashes (xsltStylesheetPtr style);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltApplyAttributeSet (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr inst,
|
||||
const xmlChar *attributes);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltResolveStylesheetAttributeSet(xsltStylesheetPtr style);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XML_XSLT_ATTRIBUTES_H__ */
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Summary: interface for the document handling
|
||||
* Description: implements document loading and cache (multiple
|
||||
* document() reference for the same resources must
|
||||
* be equal.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_XSLT_DOCUMENTS_H__
|
||||
#define __XML_XSLT_DOCUMENTS_H__
|
||||
|
||||
#include <libxml/tree.h>
|
||||
#include "xsltexports.h"
|
||||
#include "xsltInternals.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
XSLTPUBFUN xsltDocumentPtr XSLTCALL
|
||||
xsltNewDocument (xsltTransformContextPtr ctxt,
|
||||
xmlDocPtr doc);
|
||||
XSLTPUBFUN xsltDocumentPtr XSLTCALL
|
||||
xsltLoadDocument (xsltTransformContextPtr ctxt,
|
||||
const xmlChar *URI);
|
||||
XSLTPUBFUN xsltDocumentPtr XSLTCALL
|
||||
xsltFindDocument (xsltTransformContextPtr ctxt,
|
||||
xmlDocPtr doc);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltFreeDocuments (xsltTransformContextPtr ctxt);
|
||||
|
||||
XSLTPUBFUN xsltDocumentPtr XSLTCALL
|
||||
xsltLoadStyleDocument (xsltStylesheetPtr style,
|
||||
const xmlChar *URI);
|
||||
XSLTPUBFUN xsltDocumentPtr XSLTCALL
|
||||
xsltNewStyleDocument (xsltStylesheetPtr style,
|
||||
xmlDocPtr doc);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltFreeStyleDocuments (xsltStylesheetPtr style);
|
||||
|
||||
/*
|
||||
* Hooks for document loading
|
||||
*/
|
||||
|
||||
/**
|
||||
* xsltLoadType:
|
||||
*
|
||||
* Enum defining the kind of loader requirement.
|
||||
*/
|
||||
typedef enum {
|
||||
XSLT_LOAD_START = 0, /* loading for a top stylesheet */
|
||||
XSLT_LOAD_STYLESHEET = 1, /* loading for a stylesheet include/import */
|
||||
XSLT_LOAD_DOCUMENT = 2 /* loading document at transformation time */
|
||||
} xsltLoadType;
|
||||
|
||||
/**
|
||||
* xsltDocLoaderFunc:
|
||||
* @URI: the URI of the document to load
|
||||
* @dict: the dictionary to use when parsing that document
|
||||
* @options: parsing options, a set of xmlParserOption
|
||||
* @ctxt: the context, either a stylesheet or a transformation context
|
||||
* @type: the xsltLoadType indicating the kind of loading required
|
||||
*
|
||||
* An xsltDocLoaderFunc is a signature for a function which can be
|
||||
* registered to load document not provided by the compilation or
|
||||
* transformation API themselve, for example when an xsl:import,
|
||||
* xsl:include is found at compilation time or when a document()
|
||||
* call is made at runtime.
|
||||
*
|
||||
* Returns the pointer to the document (which will be modified and
|
||||
* freed by the engine later), or NULL in case of error.
|
||||
*/
|
||||
typedef xmlDocPtr (*xsltDocLoaderFunc) (const xmlChar *URI,
|
||||
xmlDictPtr dict,
|
||||
int options,
|
||||
void *ctxt,
|
||||
xsltLoadType type);
|
||||
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltSetLoaderFunc (xsltDocLoaderFunc f);
|
||||
|
||||
/* the loader may be needed by extension libraries so it is exported */
|
||||
XSLTPUBVAR xsltDocLoaderFunc xsltDocDefaultLoader;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XML_XSLT_DOCUMENTS_H__ */
|
||||
|
||||
@@ -0,0 +1,262 @@
|
||||
/*
|
||||
* Summary: interface for the extension support
|
||||
* Description: This provide the API needed for simple and module
|
||||
* extension support.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_XSLT_EXTENSION_H__
|
||||
#define __XML_XSLT_EXTENSION_H__
|
||||
|
||||
#include <libxml/xpath.h>
|
||||
#include "xsltexports.h"
|
||||
#include "xsltInternals.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Extension Modules API.
|
||||
*/
|
||||
|
||||
/**
|
||||
* xsltInitGlobals:
|
||||
*
|
||||
* Initialize the global variables for extensions
|
||||
*
|
||||
*/
|
||||
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltInitGlobals (void);
|
||||
|
||||
/**
|
||||
* xsltStyleExtInitFunction:
|
||||
* @ctxt: an XSLT stylesheet
|
||||
* @URI: the namespace URI for the extension
|
||||
*
|
||||
* A function called at initialization time of an XSLT extension module.
|
||||
*
|
||||
* Returns a pointer to the module specific data for this transformation.
|
||||
*/
|
||||
typedef void * (*xsltStyleExtInitFunction) (xsltStylesheetPtr style,
|
||||
const xmlChar *URI);
|
||||
|
||||
/**
|
||||
* xsltStyleExtShutdownFunction:
|
||||
* @ctxt: an XSLT stylesheet
|
||||
* @URI: the namespace URI for the extension
|
||||
* @data: the data associated to this module
|
||||
*
|
||||
* A function called at shutdown time of an XSLT extension module.
|
||||
*/
|
||||
typedef void (*xsltStyleExtShutdownFunction) (xsltStylesheetPtr style,
|
||||
const xmlChar *URI,
|
||||
void *data);
|
||||
|
||||
/**
|
||||
* xsltExtInitFunction:
|
||||
* @ctxt: an XSLT transformation context
|
||||
* @URI: the namespace URI for the extension
|
||||
*
|
||||
* A function called at initialization time of an XSLT extension module.
|
||||
*
|
||||
* Returns a pointer to the module specific data for this transformation.
|
||||
*/
|
||||
typedef void * (*xsltExtInitFunction) (xsltTransformContextPtr ctxt,
|
||||
const xmlChar *URI);
|
||||
|
||||
/**
|
||||
* xsltExtShutdownFunction:
|
||||
* @ctxt: an XSLT transformation context
|
||||
* @URI: the namespace URI for the extension
|
||||
* @data: the data associated to this module
|
||||
*
|
||||
* A function called at shutdown time of an XSLT extension module.
|
||||
*/
|
||||
typedef void (*xsltExtShutdownFunction) (xsltTransformContextPtr ctxt,
|
||||
const xmlChar *URI,
|
||||
void *data);
|
||||
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltRegisterExtModule (const xmlChar *URI,
|
||||
xsltExtInitFunction initFunc,
|
||||
xsltExtShutdownFunction shutdownFunc);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltRegisterExtModuleFull
|
||||
(const xmlChar * URI,
|
||||
xsltExtInitFunction initFunc,
|
||||
xsltExtShutdownFunction shutdownFunc,
|
||||
xsltStyleExtInitFunction styleInitFunc,
|
||||
xsltStyleExtShutdownFunction styleShutdownFunc);
|
||||
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltUnregisterExtModule (const xmlChar * URI);
|
||||
|
||||
XSLTPUBFUN void * XSLTCALL
|
||||
xsltGetExtData (xsltTransformContextPtr ctxt,
|
||||
const xmlChar *URI);
|
||||
|
||||
XSLTPUBFUN void * XSLTCALL
|
||||
xsltStyleGetExtData (xsltStylesheetPtr style,
|
||||
const xmlChar *URI);
|
||||
#ifdef XSLT_REFACTORED
|
||||
XSLTPUBFUN void * XSLTCALL
|
||||
xsltStyleStylesheetLevelGetExtData(
|
||||
xsltStylesheetPtr style,
|
||||
const xmlChar * URI);
|
||||
#endif
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltShutdownCtxtExts (xsltTransformContextPtr ctxt);
|
||||
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltShutdownExts (xsltStylesheetPtr style);
|
||||
|
||||
XSLTPUBFUN xsltTransformContextPtr XSLTCALL
|
||||
xsltXPathGetTransformContext
|
||||
(xmlXPathParserContextPtr ctxt);
|
||||
|
||||
/*
|
||||
* extension functions
|
||||
*/
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltRegisterExtModuleFunction
|
||||
(const xmlChar *name,
|
||||
const xmlChar *URI,
|
||||
xmlXPathFunction function);
|
||||
XSLTPUBFUN xmlXPathFunction XSLTCALL
|
||||
xsltExtModuleFunctionLookup (const xmlChar *name,
|
||||
const xmlChar *URI);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltUnregisterExtModuleFunction
|
||||
(const xmlChar *name,
|
||||
const xmlChar *URI);
|
||||
|
||||
/*
|
||||
* extension elements
|
||||
*/
|
||||
typedef xsltElemPreCompPtr (*xsltPreComputeFunction)
|
||||
(xsltStylesheetPtr style,
|
||||
xmlNodePtr inst,
|
||||
xsltTransformFunction function);
|
||||
|
||||
XSLTPUBFUN xsltElemPreCompPtr XSLTCALL
|
||||
xsltNewElemPreComp (xsltStylesheetPtr style,
|
||||
xmlNodePtr inst,
|
||||
xsltTransformFunction function);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltInitElemPreComp (xsltElemPreCompPtr comp,
|
||||
xsltStylesheetPtr style,
|
||||
xmlNodePtr inst,
|
||||
xsltTransformFunction function,
|
||||
xsltElemPreCompDeallocator freeFunc);
|
||||
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltRegisterExtModuleElement
|
||||
(const xmlChar *name,
|
||||
const xmlChar *URI,
|
||||
xsltPreComputeFunction precomp,
|
||||
xsltTransformFunction transform);
|
||||
XSLTPUBFUN xsltTransformFunction XSLTCALL
|
||||
xsltExtElementLookup (xsltTransformContextPtr ctxt,
|
||||
const xmlChar *name,
|
||||
const xmlChar *URI);
|
||||
XSLTPUBFUN xsltTransformFunction XSLTCALL
|
||||
xsltExtModuleElementLookup
|
||||
(const xmlChar *name,
|
||||
const xmlChar *URI);
|
||||
XSLTPUBFUN xsltPreComputeFunction XSLTCALL
|
||||
xsltExtModuleElementPreComputeLookup
|
||||
(const xmlChar *name,
|
||||
const xmlChar *URI);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltUnregisterExtModuleElement
|
||||
(const xmlChar *name,
|
||||
const xmlChar *URI);
|
||||
|
||||
/*
|
||||
* top-level elements
|
||||
*/
|
||||
typedef void (*xsltTopLevelFunction) (xsltStylesheetPtr style,
|
||||
xmlNodePtr inst);
|
||||
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltRegisterExtModuleTopLevel
|
||||
(const xmlChar *name,
|
||||
const xmlChar *URI,
|
||||
xsltTopLevelFunction function);
|
||||
XSLTPUBFUN xsltTopLevelFunction XSLTCALL
|
||||
xsltExtModuleTopLevelLookup
|
||||
(const xmlChar *name,
|
||||
const xmlChar *URI);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltUnregisterExtModuleTopLevel
|
||||
(const xmlChar *name,
|
||||
const xmlChar *URI);
|
||||
|
||||
|
||||
/* These 2 functions are deprecated for use within modules. */
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltRegisterExtFunction (xsltTransformContextPtr ctxt,
|
||||
const xmlChar *name,
|
||||
const xmlChar *URI,
|
||||
xmlXPathFunction function);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltRegisterExtElement (xsltTransformContextPtr ctxt,
|
||||
const xmlChar *name,
|
||||
const xmlChar *URI,
|
||||
xsltTransformFunction function);
|
||||
|
||||
/*
|
||||
* Extension Prefix handling API.
|
||||
* Those are used by the XSLT (pre)processor.
|
||||
*/
|
||||
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltRegisterExtPrefix (xsltStylesheetPtr style,
|
||||
const xmlChar *prefix,
|
||||
const xmlChar *URI);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltCheckExtPrefix (xsltStylesheetPtr style,
|
||||
const xmlChar *URI);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltCheckExtURI (xsltStylesheetPtr style,
|
||||
const xmlChar *URI);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltInitCtxtExts (xsltTransformContextPtr ctxt);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltFreeCtxtExts (xsltTransformContextPtr ctxt);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltFreeExts (xsltStylesheetPtr style);
|
||||
|
||||
XSLTPUBFUN xsltElemPreCompPtr XSLTCALL
|
||||
xsltPreComputeExtModuleElement
|
||||
(xsltStylesheetPtr style,
|
||||
xmlNodePtr inst);
|
||||
/*
|
||||
* Extension Infos access.
|
||||
* Used by exslt initialisation
|
||||
*/
|
||||
|
||||
XSLTPUBFUN xmlHashTablePtr XSLTCALL
|
||||
xsltGetExtInfo (xsltStylesheetPtr style,
|
||||
const xmlChar *URI);
|
||||
|
||||
/**
|
||||
* Test of the extension module API
|
||||
*/
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltRegisterTestModule (void);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltDebugDumpExtensions (FILE * output);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XML_XSLT_EXTENSION_H__ */
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Summary: interface for the non-standard features
|
||||
* Description: implement some extension outside the XSLT namespace
|
||||
* but not EXSLT with is in a different library.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_XSLT_EXTRA_H__
|
||||
#define __XML_XSLT_EXTRA_H__
|
||||
|
||||
#include <libxml/xpath.h>
|
||||
#include "xsltexports.h"
|
||||
#include "xsltInternals.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* XSLT_LIBXSLT_NAMESPACE:
|
||||
*
|
||||
* This is the libxslt namespace for specific extensions.
|
||||
*/
|
||||
#define XSLT_LIBXSLT_NAMESPACE ((xmlChar *) "http://xmlsoft.org/XSLT/namespace")
|
||||
|
||||
/**
|
||||
* XSLT_SAXON_NAMESPACE:
|
||||
*
|
||||
* This is Michael Kay's Saxon processor namespace for extensions.
|
||||
*/
|
||||
#define XSLT_SAXON_NAMESPACE ((xmlChar *) "http://icl.com/saxon")
|
||||
|
||||
/**
|
||||
* XSLT_XT_NAMESPACE:
|
||||
*
|
||||
* This is James Clark's XT processor namespace for extensions.
|
||||
*/
|
||||
#define XSLT_XT_NAMESPACE ((xmlChar *) "http://www.jclark.com/xt")
|
||||
|
||||
/**
|
||||
* XSLT_XALAN_NAMESPACE:
|
||||
*
|
||||
* This is the Apache project XALAN processor namespace for extensions.
|
||||
*/
|
||||
#define XSLT_XALAN_NAMESPACE ((xmlChar *) \
|
||||
"org.apache.xalan.xslt.extensions.Redirect")
|
||||
|
||||
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltFunctionNodeSet (xmlXPathParserContextPtr ctxt,
|
||||
int nargs);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltDebug (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr inst,
|
||||
xsltElemPreCompPtr comp);
|
||||
|
||||
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltRegisterExtras (xsltTransformContextPtr ctxt);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltRegisterAllExtras (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XML_XSLT_EXTRA_H__ */
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Summary: interface for the XSLT functions not from XPath
|
||||
* Description: a set of extra functions coming from XSLT but not in XPath
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard and Bjorn Reese <breese@users.sourceforge.net>
|
||||
*/
|
||||
|
||||
#ifndef __XML_XSLT_FUNCTIONS_H__
|
||||
#define __XML_XSLT_FUNCTIONS_H__
|
||||
|
||||
#include <libxml/xpath.h>
|
||||
#include <libxml/xpathInternals.h>
|
||||
#include "xsltexports.h"
|
||||
#include "xsltInternals.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* XSLT_REGISTER_FUNCTION_LOOKUP:
|
||||
*
|
||||
* Registering macro, not general purpose at all but used in different modules.
|
||||
*/
|
||||
#define XSLT_REGISTER_FUNCTION_LOOKUP(ctxt) \
|
||||
xmlXPathRegisterFuncLookup((ctxt)->xpathCtxt, \
|
||||
xsltXPathFunctionLookup, \
|
||||
(void *)(ctxt->xpathCtxt));
|
||||
|
||||
XSLTPUBFUN xmlXPathFunction XSLTCALL
|
||||
xsltXPathFunctionLookup (void *vctxt,
|
||||
const xmlChar *name,
|
||||
const xmlChar *ns_uri);
|
||||
|
||||
/*
|
||||
* Interfaces for the functions implementations.
|
||||
*/
|
||||
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltDocumentFunction (xmlXPathParserContextPtr ctxt,
|
||||
int nargs);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltKeyFunction (xmlXPathParserContextPtr ctxt,
|
||||
int nargs);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltUnparsedEntityURIFunction (xmlXPathParserContextPtr ctxt,
|
||||
int nargs);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltFormatNumberFunction (xmlXPathParserContextPtr ctxt,
|
||||
int nargs);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltGenerateIdFunction (xmlXPathParserContextPtr ctxt,
|
||||
int nargs);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltSystemPropertyFunction (xmlXPathParserContextPtr ctxt,
|
||||
int nargs);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltElementAvailableFunction (xmlXPathParserContextPtr ctxt,
|
||||
int nargs);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltFunctionAvailableFunction (xmlXPathParserContextPtr ctxt,
|
||||
int nargs);
|
||||
|
||||
/*
|
||||
* And the registration
|
||||
*/
|
||||
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltRegisterAllFunctions (xmlXPathContextPtr ctxt);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XML_XSLT_FUNCTIONS_H__ */
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Summary: interface for the XSLT import support
|
||||
* Description: macros and fuctions needed to implement and
|
||||
* access the import tree
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_XSLT_IMPORTS_H__
|
||||
#define __XML_XSLT_IMPORTS_H__
|
||||
|
||||
#include <libxml/tree.h>
|
||||
#include "xsltexports.h"
|
||||
#include "xsltInternals.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* XSLT_GET_IMPORT_PTR:
|
||||
*
|
||||
* A macro to import pointers from the stylesheet cascading order.
|
||||
*/
|
||||
#define XSLT_GET_IMPORT_PTR(res, style, name) { \
|
||||
xsltStylesheetPtr st = style; \
|
||||
res = NULL; \
|
||||
while (st != NULL) { \
|
||||
if (st->name != NULL) { res = st->name; break; } \
|
||||
st = xsltNextImport(st); \
|
||||
}}
|
||||
|
||||
/**
|
||||
* XSLT_GET_IMPORT_INT:
|
||||
*
|
||||
* A macro to import intergers from the stylesheet cascading order.
|
||||
*/
|
||||
#define XSLT_GET_IMPORT_INT(res, style, name) { \
|
||||
xsltStylesheetPtr st = style; \
|
||||
res = -1; \
|
||||
while (st != NULL) { \
|
||||
if (st->name != -1) { res = st->name; break; } \
|
||||
st = xsltNextImport(st); \
|
||||
}}
|
||||
|
||||
/*
|
||||
* Module interfaces
|
||||
*/
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltParseStylesheetImport(xsltStylesheetPtr style,
|
||||
xmlNodePtr cur);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltParseStylesheetInclude
|
||||
(xsltStylesheetPtr style,
|
||||
xmlNodePtr cur);
|
||||
XSLTPUBFUN xsltStylesheetPtr XSLTCALL
|
||||
xsltNextImport (xsltStylesheetPtr style);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltNeedElemSpaceHandling(xsltTransformContextPtr ctxt);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltFindElemSpaceHandling(xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node);
|
||||
XSLTPUBFUN xsltTemplatePtr XSLTCALL
|
||||
xsltFindTemplate (xsltTransformContextPtr ctxt,
|
||||
const xmlChar *name,
|
||||
const xmlChar *nameURI);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XML_XSLT_IMPORTS_H__ */
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Summary: interface for the key matching used in key() and template matches.
|
||||
* Description: implementation of the key mechanims.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_XSLT_KEY_H__
|
||||
#define __XML_XSLT_KEY_H__
|
||||
|
||||
#include <libxml/xpath.h>
|
||||
#include "xsltexports.h"
|
||||
#include "xsltInternals.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* NODE_IS_KEYED:
|
||||
*
|
||||
* check for bit 15 set
|
||||
*/
|
||||
#define NODE_IS_KEYED (1 >> 15)
|
||||
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltAddKey (xsltStylesheetPtr style,
|
||||
const xmlChar *name,
|
||||
const xmlChar *nameURI,
|
||||
const xmlChar *match,
|
||||
const xmlChar *use,
|
||||
xmlNodePtr inst);
|
||||
XSLTPUBFUN xmlNodeSetPtr XSLTCALL
|
||||
xsltGetKey (xsltTransformContextPtr ctxt,
|
||||
const xmlChar *name,
|
||||
const xmlChar *nameURI,
|
||||
const xmlChar *value);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltInitCtxtKeys (xsltTransformContextPtr ctxt,
|
||||
xsltDocumentPtr doc);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltFreeKeys (xsltStylesheetPtr style);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltFreeDocumentKeys (xsltDocumentPtr doc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XML_XSLT_H__ */
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Summary: interface for the XSLT namespace handling
|
||||
* Description: set of function easing the processing and generation
|
||||
* of namespace nodes in XSLT.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_XSLT_NAMESPACES_H__
|
||||
#define __XML_XSLT_NAMESPACES_H__
|
||||
|
||||
#include <libxml/tree.h>
|
||||
#include "xsltexports.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Used within nsAliases hashtable when the default namespace is required
|
||||
* but it's not been explicitly defined
|
||||
*/
|
||||
/**
|
||||
* UNDEFINED_DEFAULT_NS:
|
||||
*
|
||||
* Special value for undefined namespace, internal
|
||||
*/
|
||||
#define UNDEFINED_DEFAULT_NS (const xmlChar *) -1L
|
||||
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltNamespaceAlias (xsltStylesheetPtr style,
|
||||
xmlNodePtr node);
|
||||
XSLTPUBFUN xmlNsPtr XSLTCALL
|
||||
xsltGetNamespace (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr cur,
|
||||
xmlNsPtr ns,
|
||||
xmlNodePtr out);
|
||||
XSLTPUBFUN xmlNsPtr XSLTCALL
|
||||
xsltGetPlainNamespace (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr cur,
|
||||
xmlNsPtr ns,
|
||||
xmlNodePtr out);
|
||||
XSLTPUBFUN xmlNsPtr XSLTCALL
|
||||
xsltGetSpecialNamespace (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr cur,
|
||||
const xmlChar *URI,
|
||||
const xmlChar *prefix,
|
||||
xmlNodePtr out);
|
||||
XSLTPUBFUN xmlNsPtr XSLTCALL
|
||||
xsltCopyNamespace (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr elem,
|
||||
xmlNsPtr ns);
|
||||
XSLTPUBFUN xmlNsPtr XSLTCALL
|
||||
xsltCopyNamespaceList (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
xmlNsPtr cur);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltFreeNamespaceAliasHashes
|
||||
(xsltStylesheetPtr style);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XML_XSLT_NAMESPACES_H__ */
|
||||
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Summary: Implementation of the XSLT number functions
|
||||
* Description: Implementation of the XSLT number functions
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Bjorn Reese <breese@users.sourceforge.net> and Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_XSLT_NUMBERSINTERNALS_H__
|
||||
#define __XML_XSLT_NUMBERSINTERNALS_H__
|
||||
|
||||
#include <libxml/tree.h>
|
||||
#include "xsltexports.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _xsltCompMatch;
|
||||
|
||||
/**
|
||||
* xsltNumberData:
|
||||
*
|
||||
* This data structure is just a wrapper to pass xsl:number data in.
|
||||
*/
|
||||
typedef struct _xsltNumberData xsltNumberData;
|
||||
typedef xsltNumberData *xsltNumberDataPtr;
|
||||
|
||||
struct _xsltNumberData {
|
||||
const xmlChar *level;
|
||||
const xmlChar *count;
|
||||
const xmlChar *from;
|
||||
const xmlChar *value;
|
||||
const xmlChar *format;
|
||||
int has_format;
|
||||
int digitsPerGroup;
|
||||
int groupingCharacter;
|
||||
int groupingCharacterLen;
|
||||
xmlDocPtr doc;
|
||||
xmlNodePtr node;
|
||||
struct _xsltCompMatch *countPat;
|
||||
struct _xsltCompMatch *fromPat;
|
||||
|
||||
/*
|
||||
* accelerators
|
||||
*/
|
||||
};
|
||||
|
||||
/**
|
||||
* xsltFormatNumberInfo,:
|
||||
*
|
||||
* This data structure lists the various parameters needed to format numbers.
|
||||
*/
|
||||
typedef struct _xsltFormatNumberInfo xsltFormatNumberInfo;
|
||||
typedef xsltFormatNumberInfo *xsltFormatNumberInfoPtr;
|
||||
|
||||
struct _xsltFormatNumberInfo {
|
||||
int integer_hash; /* Number of '#' in integer part */
|
||||
int integer_digits; /* Number of '0' in integer part */
|
||||
int frac_digits; /* Number of '0' in fractional part */
|
||||
int frac_hash; /* Number of '#' in fractional part */
|
||||
int group; /* Number of chars per display 'group' */
|
||||
int multiplier; /* Scaling for percent or permille */
|
||||
char add_decimal; /* Flag for whether decimal point appears in pattern */
|
||||
char is_multiplier_set; /* Flag to catch multiple occurences of percent/permille */
|
||||
char is_negative_pattern;/* Flag for processing -ve prefix/suffix */
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __XML_XSLT_NUMBERSINTERNALS_H__ */
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Summary: interface for the pattern matching used in template matches.
|
||||
* Description: the implementation of the lookup of the right template
|
||||
* for a given node must be really fast in order to keep
|
||||
* decent performances.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_XSLT_PATTERN_H__
|
||||
#define __XML_XSLT_PATTERN_H__
|
||||
|
||||
#include "xsltInternals.h"
|
||||
#include "xsltexports.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* xsltCompMatch:
|
||||
*
|
||||
* Data structure used for the implementation of patterns.
|
||||
* It is kept private (in pattern.c).
|
||||
*/
|
||||
typedef struct _xsltCompMatch xsltCompMatch;
|
||||
typedef xsltCompMatch *xsltCompMatchPtr;
|
||||
|
||||
/*
|
||||
* Pattern related interfaces.
|
||||
*/
|
||||
|
||||
XSLTPUBFUN xsltCompMatchPtr XSLTCALL
|
||||
xsltCompilePattern (const xmlChar *pattern,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr node,
|
||||
xsltStylesheetPtr style,
|
||||
xsltTransformContextPtr runtime);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltFreeCompMatchList (xsltCompMatchPtr comp);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltTestCompMatchList (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
xsltCompMatchPtr comp);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltCompMatchClearCache (xsltTransformContextPtr ctxt,
|
||||
xsltCompMatchPtr comp);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltNormalizeCompSteps (void *payload,
|
||||
void *data,
|
||||
const xmlChar *name);
|
||||
|
||||
/*
|
||||
* Template related interfaces.
|
||||
*/
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltAddTemplate (xsltStylesheetPtr style,
|
||||
xsltTemplatePtr cur,
|
||||
const xmlChar *mode,
|
||||
const xmlChar *modeURI);
|
||||
XSLTPUBFUN xsltTemplatePtr XSLTCALL
|
||||
xsltGetTemplate (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
xsltStylesheetPtr style);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltFreeTemplateHashes (xsltStylesheetPtr style);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltCleanupTemplates (xsltStylesheetPtr style);
|
||||
|
||||
#if 0
|
||||
int xsltMatchPattern (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
const xmlChar *pattern,
|
||||
xmlDocPtr ctxtdoc,
|
||||
xmlNodePtr ctxtnode);
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XML_XSLT_PATTERN_H__ */
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Summary: precomputing stylesheets
|
||||
* Description: this is the compilation phase, where most of the
|
||||
* stylesheet is "compiled" into faster to use data.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_XSLT_PRECOMP_H__
|
||||
#define __XML_XSLT_PRECOMP_H__
|
||||
|
||||
#include <libxml/tree.h>
|
||||
#include "xsltexports.h"
|
||||
#include "xsltInternals.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Interfaces
|
||||
*/
|
||||
XSLTPUBVAR const xmlChar *xsltExtMarker;
|
||||
|
||||
XSLTPUBFUN xsltElemPreCompPtr XSLTCALL
|
||||
xsltDocumentComp (xsltStylesheetPtr style,
|
||||
xmlNodePtr inst,
|
||||
xsltTransformFunction function);
|
||||
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltStylePreCompute (xsltStylesheetPtr style,
|
||||
xmlNodePtr inst);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltFreeStylePreComps (xsltStylesheetPtr style);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XML_XSLT_PRECOMP_H__ */
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Summary: interface for the libxslt security framework
|
||||
* Description: the libxslt security framework allow to restrict
|
||||
* the access to new resources (file or URL) from
|
||||
* the stylesheet at runtime.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_XSLT_SECURITY_H__
|
||||
#define __XML_XSLT_SECURITY_H__
|
||||
|
||||
#include <libxml/tree.h>
|
||||
#include "xsltexports.h"
|
||||
#include "xsltInternals.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* xsltSecurityPref:
|
||||
*
|
||||
* structure to indicate the preferences for security in the XSLT
|
||||
* transformation.
|
||||
*/
|
||||
typedef struct _xsltSecurityPrefs xsltSecurityPrefs;
|
||||
typedef xsltSecurityPrefs *xsltSecurityPrefsPtr;
|
||||
|
||||
/**
|
||||
* xsltSecurityOption:
|
||||
*
|
||||
* the set of option that can be configured
|
||||
*/
|
||||
typedef enum {
|
||||
XSLT_SECPREF_READ_FILE = 1,
|
||||
XSLT_SECPREF_WRITE_FILE,
|
||||
XSLT_SECPREF_CREATE_DIRECTORY,
|
||||
XSLT_SECPREF_READ_NETWORK,
|
||||
XSLT_SECPREF_WRITE_NETWORK
|
||||
} xsltSecurityOption;
|
||||
|
||||
/**
|
||||
* xsltSecurityCheck:
|
||||
*
|
||||
* User provided function to check the value of a string like a file
|
||||
* path or an URL ...
|
||||
*/
|
||||
typedef int (*xsltSecurityCheck) (xsltSecurityPrefsPtr sec,
|
||||
xsltTransformContextPtr ctxt,
|
||||
const char *value);
|
||||
|
||||
/*
|
||||
* Module interfaces
|
||||
*/
|
||||
XSLTPUBFUN xsltSecurityPrefsPtr XSLTCALL
|
||||
xsltNewSecurityPrefs (void);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltFreeSecurityPrefs (xsltSecurityPrefsPtr sec);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltSetSecurityPrefs (xsltSecurityPrefsPtr sec,
|
||||
xsltSecurityOption option,
|
||||
xsltSecurityCheck func);
|
||||
XSLTPUBFUN xsltSecurityCheck XSLTCALL
|
||||
xsltGetSecurityPrefs (xsltSecurityPrefsPtr sec,
|
||||
xsltSecurityOption option);
|
||||
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltSetDefaultSecurityPrefs (xsltSecurityPrefsPtr sec);
|
||||
XSLTPUBFUN xsltSecurityPrefsPtr XSLTCALL
|
||||
xsltGetDefaultSecurityPrefs (void);
|
||||
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltSetCtxtSecurityPrefs (xsltSecurityPrefsPtr sec,
|
||||
xsltTransformContextPtr ctxt);
|
||||
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltSecurityAllow (xsltSecurityPrefsPtr sec,
|
||||
xsltTransformContextPtr ctxt,
|
||||
const char *value);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltSecurityForbid (xsltSecurityPrefsPtr sec,
|
||||
xsltTransformContextPtr ctxt,
|
||||
const char *value);
|
||||
/*
|
||||
* internal interfaces
|
||||
*/
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltCheckWrite (xsltSecurityPrefsPtr sec,
|
||||
xsltTransformContextPtr ctxt,
|
||||
const xmlChar *URL);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltCheckRead (xsltSecurityPrefsPtr sec,
|
||||
xsltTransformContextPtr ctxt,
|
||||
const xmlChar *URL);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XML_XSLT_SECURITY_H__ */
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Summary: interface for the template processing
|
||||
* Description: This set of routine encapsulates XPath calls
|
||||
* and Attribute Value Templates evaluation.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_XSLT_TEMPLATES_H__
|
||||
#define __XML_XSLT_TEMPLATES_H__
|
||||
|
||||
#include <libxml/xpath.h>
|
||||
#include <libxml/xpathInternals.h>
|
||||
#include "xsltexports.h"
|
||||
#include "xsltInternals.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltEvalXPathPredicate (xsltTransformContextPtr ctxt,
|
||||
xmlXPathCompExprPtr comp,
|
||||
xmlNsPtr *nsList,
|
||||
int nsNr);
|
||||
XSLTPUBFUN xmlChar * XSLTCALL
|
||||
xsltEvalTemplateString (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr contextNode,
|
||||
xmlNodePtr inst);
|
||||
XSLTPUBFUN xmlChar * XSLTCALL
|
||||
xsltEvalAttrValueTemplate (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
const xmlChar *name,
|
||||
const xmlChar *ns);
|
||||
XSLTPUBFUN const xmlChar * XSLTCALL
|
||||
xsltEvalStaticAttrValueTemplate (xsltStylesheetPtr style,
|
||||
xmlNodePtr node,
|
||||
const xmlChar *name,
|
||||
const xmlChar *ns,
|
||||
int *found);
|
||||
|
||||
/* TODO: this is obviously broken ... the namespaces should be passed too ! */
|
||||
XSLTPUBFUN xmlChar * XSLTCALL
|
||||
xsltEvalXPathString (xsltTransformContextPtr ctxt,
|
||||
xmlXPathCompExprPtr comp);
|
||||
XSLTPUBFUN xmlChar * XSLTCALL
|
||||
xsltEvalXPathStringNs (xsltTransformContextPtr ctxt,
|
||||
xmlXPathCompExprPtr comp,
|
||||
int nsNr,
|
||||
xmlNsPtr *nsList);
|
||||
|
||||
XSLTPUBFUN xmlNodePtr * XSLTCALL
|
||||
xsltTemplateProcess (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node);
|
||||
XSLTPUBFUN xmlAttrPtr XSLTCALL
|
||||
xsltAttrListTemplateProcess (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr target,
|
||||
xmlAttrPtr cur);
|
||||
XSLTPUBFUN xmlAttrPtr XSLTCALL
|
||||
xsltAttrTemplateProcess (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr target,
|
||||
xmlAttrPtr attr);
|
||||
XSLTPUBFUN xmlChar * XSLTCALL
|
||||
xsltAttrTemplateValueProcess (xsltTransformContextPtr ctxt,
|
||||
const xmlChar* attr);
|
||||
XSLTPUBFUN xmlChar * XSLTCALL
|
||||
xsltAttrTemplateValueProcessNode(xsltTransformContextPtr ctxt,
|
||||
const xmlChar* str,
|
||||
xmlNodePtr node);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XML_XSLT_TEMPLATES_H__ */
|
||||
|
||||
@@ -0,0 +1,207 @@
|
||||
/*
|
||||
* Summary: the XSLT engine transformation part.
|
||||
* Description: This module implements the bulk of the actual
|
||||
* transformation processing. Most of the xsl: element
|
||||
* constructs are implemented in this module.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_XSLT_TRANSFORM_H__
|
||||
#define __XML_XSLT_TRANSFORM_H__
|
||||
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/xmlIO.h>
|
||||
#include "xsltexports.h"
|
||||
#include <libxslt/xsltInternals.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* XInclude default processing.
|
||||
*/
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltSetXIncludeDefault (int xinclude);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltGetXIncludeDefault (void);
|
||||
|
||||
/**
|
||||
* Export context to users.
|
||||
*/
|
||||
XSLTPUBFUN xsltTransformContextPtr XSLTCALL
|
||||
xsltNewTransformContext (xsltStylesheetPtr style,
|
||||
xmlDocPtr doc);
|
||||
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltFreeTransformContext(xsltTransformContextPtr ctxt);
|
||||
|
||||
XSLTPUBFUN xmlDocPtr XSLTCALL
|
||||
xsltApplyStylesheetUser (xsltStylesheetPtr style,
|
||||
xmlDocPtr doc,
|
||||
const char **params,
|
||||
const char *output,
|
||||
FILE * profile,
|
||||
xsltTransformContextPtr userCtxt);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltProcessOneNode (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
xsltStackElemPtr params);
|
||||
/**
|
||||
* Private Interfaces.
|
||||
*/
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltApplyStripSpaces (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node);
|
||||
XSLTPUBFUN xmlDocPtr XSLTCALL
|
||||
xsltApplyStylesheet (xsltStylesheetPtr style,
|
||||
xmlDocPtr doc,
|
||||
const char **params);
|
||||
XSLTPUBFUN xmlDocPtr XSLTCALL
|
||||
xsltProfileStylesheet (xsltStylesheetPtr style,
|
||||
xmlDocPtr doc,
|
||||
const char **params,
|
||||
FILE * output);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltRunStylesheet (xsltStylesheetPtr style,
|
||||
xmlDocPtr doc,
|
||||
const char **params,
|
||||
const char *output,
|
||||
xmlSAXHandlerPtr SAX,
|
||||
xmlOutputBufferPtr IObuf);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltRunStylesheetUser (xsltStylesheetPtr style,
|
||||
xmlDocPtr doc,
|
||||
const char **params,
|
||||
const char *output,
|
||||
xmlSAXHandlerPtr SAX,
|
||||
xmlOutputBufferPtr IObuf,
|
||||
FILE * profile,
|
||||
xsltTransformContextPtr userCtxt);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltApplyOneTemplate (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr list,
|
||||
xsltTemplatePtr templ,
|
||||
xsltStackElemPtr params);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltDocumentElem (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr inst,
|
||||
xsltElemPreCompPtr comp);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltSort (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr inst,
|
||||
xsltElemPreCompPtr comp);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltCopy (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr inst,
|
||||
xsltElemPreCompPtr comp);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltText (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr inst,
|
||||
xsltElemPreCompPtr comp);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltElement (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr inst,
|
||||
xsltElemPreCompPtr comp);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltComment (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr inst,
|
||||
xsltElemPreCompPtr comp);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltAttribute (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr inst,
|
||||
xsltElemPreCompPtr comp);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltProcessingInstruction(xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr inst,
|
||||
xsltElemPreCompPtr comp);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltCopyOf (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr inst,
|
||||
xsltElemPreCompPtr comp);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltValueOf (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr inst,
|
||||
xsltElemPreCompPtr comp);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltNumber (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr inst,
|
||||
xsltElemPreCompPtr comp);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltApplyImports (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr inst,
|
||||
xsltElemPreCompPtr comp);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltCallTemplate (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr inst,
|
||||
xsltElemPreCompPtr comp);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltApplyTemplates (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr inst,
|
||||
xsltElemPreCompPtr comp);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltChoose (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr inst,
|
||||
xsltElemPreCompPtr comp);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltIf (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr inst,
|
||||
xsltElemPreCompPtr comp);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltForEach (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr inst,
|
||||
xsltElemPreCompPtr comp);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltRegisterAllElement (xsltTransformContextPtr ctxt);
|
||||
|
||||
XSLTPUBFUN xmlNodePtr XSLTCALL
|
||||
xsltCopyTextString (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr target,
|
||||
const xmlChar *string,
|
||||
int noescape);
|
||||
|
||||
/* Following 2 functions needed for libexslt/functions.c */
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltLocalVariablePop (xsltTransformContextPtr ctxt,
|
||||
int limitNr,
|
||||
int level);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltLocalVariablePush (xsltTransformContextPtr ctxt,
|
||||
xsltStackElemPtr variable,
|
||||
int level);
|
||||
/*
|
||||
* Hook for the debugger if activated.
|
||||
*/
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xslHandleDebugger (xmlNodePtr cur,
|
||||
xmlNodePtr node,
|
||||
xsltTemplatePtr templ,
|
||||
xsltTransformContextPtr ctxt);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XML_XSLT_TRANSFORM_H__ */
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Summary: interface for the variable matching and lookup.
|
||||
* Description: interface for the variable matching and lookup.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_XSLT_VARIABLES_H__
|
||||
#define __XML_XSLT_VARIABLES_H__
|
||||
|
||||
#include <libxml/xpath.h>
|
||||
#include <libxml/xpathInternals.h>
|
||||
#include "xsltexports.h"
|
||||
#include "xsltInternals.h"
|
||||
#include "functions.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* XSLT_REGISTER_VARIABLE_LOOKUP:
|
||||
*
|
||||
* Registering macro, not general purpose at all but used in different modules.
|
||||
*/
|
||||
|
||||
#define XSLT_REGISTER_VARIABLE_LOOKUP(ctxt) \
|
||||
xmlXPathRegisterVariableLookup((ctxt)->xpathCtxt, \
|
||||
xsltXPathVariableLookup, (void *)(ctxt)); \
|
||||
xsltRegisterAllFunctions((ctxt)->xpathCtxt); \
|
||||
xsltRegisterAllElement(ctxt); \
|
||||
(ctxt)->xpathCtxt->extra = ctxt
|
||||
|
||||
/*
|
||||
* Flags for memory management of RVTs
|
||||
*/
|
||||
|
||||
/**
|
||||
* XSLT_RVT_LOCAL:
|
||||
*
|
||||
* RVT is destroyed after the current instructions ends.
|
||||
*/
|
||||
#define XSLT_RVT_LOCAL 1
|
||||
|
||||
/**
|
||||
* XSLT_RVT_FUNC_RESULT:
|
||||
*
|
||||
* RVT is part of results returned with func:result. The RVT won't be
|
||||
* destroyed after exiting a template and will be reset to XSLT_RVT_LOCAL or
|
||||
* XSLT_RVT_VARIABLE in the template that receives the return value.
|
||||
*/
|
||||
#define XSLT_RVT_FUNC_RESULT 2
|
||||
|
||||
/**
|
||||
* XSLT_RVT_GLOBAL:
|
||||
*
|
||||
* RVT is part of a global variable.
|
||||
*/
|
||||
#define XSLT_RVT_GLOBAL 3
|
||||
|
||||
/*
|
||||
* Interfaces for the variable module.
|
||||
*/
|
||||
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltEvalGlobalVariables (xsltTransformContextPtr ctxt);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltEvalUserParams (xsltTransformContextPtr ctxt,
|
||||
const char **params);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltQuoteUserParams (xsltTransformContextPtr ctxt,
|
||||
const char **params);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltEvalOneUserParam (xsltTransformContextPtr ctxt,
|
||||
const xmlChar * name,
|
||||
const xmlChar * value);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltQuoteOneUserParam (xsltTransformContextPtr ctxt,
|
||||
const xmlChar * name,
|
||||
const xmlChar * value);
|
||||
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltParseGlobalVariable (xsltStylesheetPtr style,
|
||||
xmlNodePtr cur);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltParseGlobalParam (xsltStylesheetPtr style,
|
||||
xmlNodePtr cur);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltParseStylesheetVariable (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr cur);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltParseStylesheetParam (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr cur);
|
||||
XSLTPUBFUN xsltStackElemPtr XSLTCALL
|
||||
xsltParseStylesheetCallerParam (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr cur);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltAddStackElemList (xsltTransformContextPtr ctxt,
|
||||
xsltStackElemPtr elems);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltFreeGlobalVariables (xsltTransformContextPtr ctxt);
|
||||
XSLTPUBFUN xmlXPathObjectPtr XSLTCALL
|
||||
xsltVariableLookup (xsltTransformContextPtr ctxt,
|
||||
const xmlChar *name,
|
||||
const xmlChar *ns_uri);
|
||||
XSLTPUBFUN xmlXPathObjectPtr XSLTCALL
|
||||
xsltXPathVariableLookup (void *ctxt,
|
||||
const xmlChar *name,
|
||||
const xmlChar *ns_uri);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XML_XSLT_VARIABLES_H__ */
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Summary: Interfaces, constants and types related to the XSLT engine
|
||||
* Description: Interfaces, constants and types related to the XSLT engine
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_XSLT_H__
|
||||
#define __XML_XSLT_H__
|
||||
|
||||
#include <libxml/tree.h>
|
||||
#include "xsltexports.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* XSLT_DEFAULT_VERSION:
|
||||
*
|
||||
* The default version of XSLT supported.
|
||||
*/
|
||||
#define XSLT_DEFAULT_VERSION "1.0"
|
||||
|
||||
/**
|
||||
* XSLT_DEFAULT_VENDOR:
|
||||
*
|
||||
* The XSLT "vendor" string for this processor.
|
||||
*/
|
||||
#define XSLT_DEFAULT_VENDOR "libxslt"
|
||||
|
||||
/**
|
||||
* XSLT_DEFAULT_URL:
|
||||
*
|
||||
* The XSLT "vendor" URL for this processor.
|
||||
*/
|
||||
#define XSLT_DEFAULT_URL "http://xmlsoft.org/XSLT/"
|
||||
|
||||
/**
|
||||
* XSLT_NAMESPACE:
|
||||
*
|
||||
* The XSLT specification namespace.
|
||||
*/
|
||||
#define XSLT_NAMESPACE ((const xmlChar *)"http://www.w3.org/1999/XSL/Transform")
|
||||
|
||||
/**
|
||||
* XSLT_PARSE_OPTIONS:
|
||||
*
|
||||
* The set of options to pass to an xmlReadxxx when loading files for
|
||||
* XSLT consumption.
|
||||
*/
|
||||
#define XSLT_PARSE_OPTIONS \
|
||||
XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_NOCDATA
|
||||
|
||||
/**
|
||||
* xsltMaxDepth:
|
||||
*
|
||||
* This value is used to detect templates loops.
|
||||
*/
|
||||
XSLTPUBVAR int xsltMaxDepth;
|
||||
|
||||
/**
|
||||
* * xsltMaxVars:
|
||||
* *
|
||||
* * This value is used to detect templates loops.
|
||||
* */
|
||||
XSLTPUBVAR int xsltMaxVars;
|
||||
|
||||
/**
|
||||
* xsltEngineVersion:
|
||||
*
|
||||
* The version string for libxslt.
|
||||
*/
|
||||
XSLTPUBVAR const char *xsltEngineVersion;
|
||||
|
||||
/**
|
||||
* xsltLibxsltVersion:
|
||||
*
|
||||
* The version of libxslt compiled.
|
||||
*/
|
||||
XSLTPUBVAR const int xsltLibxsltVersion;
|
||||
|
||||
/**
|
||||
* xsltLibxmlVersion:
|
||||
*
|
||||
* The version of libxml libxslt was compiled against.
|
||||
*/
|
||||
XSLTPUBVAR const int xsltLibxmlVersion;
|
||||
|
||||
/*
|
||||
* Global initialization function.
|
||||
*/
|
||||
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltInit (void);
|
||||
|
||||
/*
|
||||
* Global cleanup function.
|
||||
*/
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltCleanupGlobals (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XML_XSLT_H__ */
|
||||
|
||||
+1995
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* Summary: compile-time version information for the XSLT engine
|
||||
* Description: compile-time version information for the XSLT engine
|
||||
* this module is autogenerated.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_XSLTCONFIG_H__
|
||||
#define __XML_XSLTCONFIG_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXSLT_DOTTED_VERSION:
|
||||
*
|
||||
* the version string like "1.2.3"
|
||||
*/
|
||||
#define LIBXSLT_DOTTED_VERSION "1.1.42"
|
||||
|
||||
/**
|
||||
* LIBXSLT_VERSION:
|
||||
*
|
||||
* the version number: 1.2.3 value is 10203
|
||||
*/
|
||||
#define LIBXSLT_VERSION 10142
|
||||
|
||||
/**
|
||||
* LIBXSLT_VERSION_STRING:
|
||||
*
|
||||
* the version number string, 1.2.3 value is "10203"
|
||||
*/
|
||||
#define LIBXSLT_VERSION_STRING "10142"
|
||||
|
||||
/**
|
||||
* LIBXSLT_VERSION_EXTRA:
|
||||
*
|
||||
* extra version information, used to show a Git commit description
|
||||
*/
|
||||
#define LIBXSLT_VERSION_EXTRA ""
|
||||
|
||||
/**
|
||||
* WITH_XSLT_DEBUG:
|
||||
*
|
||||
* Activate the compilation of the debug reporting. Speed penalty
|
||||
* is insignifiant and being able to run xsltpoc -v is useful. On
|
||||
* by default unless --without-debug is passed to configure
|
||||
*/
|
||||
#if 1
|
||||
#define WITH_XSLT_DEBUG
|
||||
#endif
|
||||
|
||||
/**
|
||||
* XSLT_NEED_TRIO:
|
||||
*
|
||||
* should be activated if the existing libc library lacks some of the
|
||||
* string formatting function, in that case reuse the Trio ones already
|
||||
* compiled in the libxml2 library.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
#define XSLT_NEED_TRIO
|
||||
#endif
|
||||
#ifdef __VMS
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
#ifndef XSLT_NEED_TRIO
|
||||
#define XSLT_NEED_TRIO
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef XSLT_NEED_TRIO
|
||||
#define TRIO_REPLACE_STDIO
|
||||
#endif
|
||||
|
||||
/**
|
||||
* WITH_XSLT_DEBUGGER:
|
||||
*
|
||||
* Activate the compilation of the debugger support. Speed penalty
|
||||
* is insignifiant.
|
||||
* On by default unless --without-debugger is passed to configure
|
||||
*/
|
||||
#if 1
|
||||
#ifndef WITH_DEBUGGER
|
||||
#define WITH_DEBUGGER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* WITH_PROFILER:
|
||||
*
|
||||
* Activate the compilation of the profiler. Speed penalty
|
||||
* is insignifiant.
|
||||
* On by default unless --without-profiler is passed to configure
|
||||
*/
|
||||
#if 1
|
||||
#ifndef WITH_PROFILER
|
||||
#define WITH_PROFILER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* WITH_MODULES:
|
||||
*
|
||||
* Whether module support is configured into libxslt
|
||||
* Note: no default module path for win32 platforms
|
||||
*/
|
||||
#if 0
|
||||
#ifndef WITH_MODULES
|
||||
#define WITH_MODULES
|
||||
#endif
|
||||
#define LIBXSLT_DEFAULT_PLUGINS_PATH() "/home/flavorjones/code/oss/nokogiri/ports/x86_64-linux-gnu/libxslt/1.1.42/lib/libxslt-plugins"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXSLT_ATTR_FORMAT:
|
||||
*
|
||||
* This macro is used to indicate to GCC the parameters are printf-like
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
#define LIBXSLT_ATTR_FORMAT(fmt,args) __attribute__((__format__(__printf__,fmt,args)))
|
||||
#else
|
||||
#define LIBXSLT_ATTR_FORMAT(fmt,args)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXSLT_PUBLIC:
|
||||
*
|
||||
* This macro is used to declare PUBLIC variables for Cygwin and for MSC on Windows
|
||||
*/
|
||||
#if !defined LIBXSLT_PUBLIC
|
||||
#if (defined(__CYGWIN__) || defined _MSC_VER) && !defined IN_LIBXSLT && !defined LIBXSLT_STATIC
|
||||
#define LIBXSLT_PUBLIC __declspec(dllimport)
|
||||
#else
|
||||
#define LIBXSLT_PUBLIC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XML_XSLTCONFIG_H__ */
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Summary: macros for marking symbols as exportable/importable.
|
||||
* Description: macros for marking symbols as exportable/importable.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*/
|
||||
|
||||
#ifndef __XSLT_EXPORTS_H__
|
||||
#define __XSLT_EXPORTS_H__
|
||||
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
/** DOC_DISABLE */
|
||||
|
||||
#ifdef LIBXSLT_STATIC
|
||||
#define XSLTPUBLIC
|
||||
#elif defined(IN_LIBXSLT)
|
||||
#define XSLTPUBLIC __declspec(dllexport)
|
||||
#else
|
||||
#define XSLTPUBLIC __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#define XSLTCALL __cdecl
|
||||
|
||||
/** DOC_ENABLE */
|
||||
#else /* not Windows */
|
||||
|
||||
/**
|
||||
* XSLTPUBLIC:
|
||||
*
|
||||
* Macro which declares a public symbol
|
||||
*/
|
||||
#define XSLTPUBLIC
|
||||
|
||||
/**
|
||||
* XSLTCALL:
|
||||
*
|
||||
* Macro which declares the calling convention for exported functions
|
||||
*/
|
||||
#define XSLTCALL
|
||||
|
||||
#endif /* platform switch */
|
||||
|
||||
/*
|
||||
* XSLTPUBFUN:
|
||||
*
|
||||
* Macro which declares an exportable function
|
||||
*/
|
||||
#define XSLTPUBFUN XSLTPUBLIC
|
||||
|
||||
/**
|
||||
* XSLTPUBVAR:
|
||||
*
|
||||
* Macro which declares an exportable variable
|
||||
*/
|
||||
#define XSLTPUBVAR XSLTPUBLIC extern
|
||||
|
||||
/* Compatibility */
|
||||
#if !defined(LIBXSLT_PUBLIC)
|
||||
#define LIBXSLT_PUBLIC XSLTPUBVAR
|
||||
#endif
|
||||
|
||||
#endif /* __XSLT_EXPORTS_H__ */
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Summary: Locale handling
|
||||
* Description: Interfaces for locale handling. Needed for language dependent
|
||||
* sorting.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Nick Wellnhofer
|
||||
*/
|
||||
|
||||
#ifndef __XML_XSLTLOCALE_H__
|
||||
#define __XML_XSLTLOCALE_H__
|
||||
|
||||
#include <libxml/xmlstring.h>
|
||||
#include "xsltexports.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
XSLTPUBFUN void * XSLTCALL
|
||||
xsltNewLocale (const xmlChar *langName,
|
||||
int lowerFirst);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltFreeLocale (void *locale);
|
||||
XSLTPUBFUN xmlChar * XSLTCALL
|
||||
xsltStrxfrm (void *locale,
|
||||
const xmlChar *string);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltFreeLocales (void);
|
||||
|
||||
/* Backward compatibility */
|
||||
typedef void *xsltLocale;
|
||||
typedef xmlChar xsltLocaleChar;
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltLocaleStrcmp (void *locale,
|
||||
const xmlChar *str1,
|
||||
const xmlChar *str2);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XML_XSLTLOCALE_H__ */
|
||||
@@ -0,0 +1,343 @@
|
||||
/*
|
||||
* Summary: set of utilities for the XSLT engine
|
||||
* Description: interfaces for the utilities module of the XSLT engine.
|
||||
* things like message handling, profiling, and other
|
||||
* generally useful routines.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_XSLTUTILS_H__
|
||||
#define __XML_XSLTUTILS_H__
|
||||
|
||||
#include <libxslt/xsltconfig.h>
|
||||
#include <libxml/xpath.h>
|
||||
#include <libxml/dict.h>
|
||||
#include <libxml/xmlerror.h>
|
||||
#include "xsltexports.h"
|
||||
#include "xsltInternals.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* XSLT_TODO:
|
||||
*
|
||||
* Macro to flag unimplemented blocks.
|
||||
*/
|
||||
#define XSLT_TODO \
|
||||
xsltGenericError(xsltGenericErrorContext, \
|
||||
"Unimplemented block at %s:%d\n", \
|
||||
__FILE__, __LINE__);
|
||||
|
||||
/**
|
||||
* XSLT_STRANGE:
|
||||
*
|
||||
* Macro to flag that a problem was detected internally.
|
||||
*/
|
||||
#define XSLT_STRANGE \
|
||||
xsltGenericError(xsltGenericErrorContext, \
|
||||
"Internal error at %s:%d\n", \
|
||||
__FILE__, __LINE__);
|
||||
|
||||
/**
|
||||
* IS_XSLT_ELEM:
|
||||
*
|
||||
* Checks that the element pertains to XSLT namespace.
|
||||
*/
|
||||
#define IS_XSLT_ELEM(n) \
|
||||
(((n) != NULL) && ((n)->type == XML_ELEMENT_NODE) && \
|
||||
((n)->ns != NULL) && (xmlStrEqual((n)->ns->href, XSLT_NAMESPACE)))
|
||||
|
||||
/**
|
||||
* IS_XSLT_NAME:
|
||||
*
|
||||
* Checks the value of an element in XSLT namespace.
|
||||
*/
|
||||
#define IS_XSLT_NAME(n, val) \
|
||||
(xmlStrEqual((n)->name, (const xmlChar *) (val)))
|
||||
|
||||
/**
|
||||
* IS_XSLT_REAL_NODE:
|
||||
*
|
||||
* Check that a node is a 'real' one: document, element, text or attribute.
|
||||
*/
|
||||
#define IS_XSLT_REAL_NODE(n) \
|
||||
(((n) != NULL) && \
|
||||
(((n)->type == XML_ELEMENT_NODE) || \
|
||||
((n)->type == XML_TEXT_NODE) || \
|
||||
((n)->type == XML_CDATA_SECTION_NODE) || \
|
||||
((n)->type == XML_ATTRIBUTE_NODE) || \
|
||||
((n)->type == XML_DOCUMENT_NODE) || \
|
||||
((n)->type == XML_HTML_DOCUMENT_NODE) || \
|
||||
((n)->type == XML_COMMENT_NODE) || \
|
||||
((n)->type == XML_PI_NODE)))
|
||||
|
||||
/*
|
||||
* Our own version of namespaced attributes lookup.
|
||||
*/
|
||||
XSLTPUBFUN xmlChar * XSLTCALL
|
||||
xsltGetNsProp (xmlNodePtr node,
|
||||
const xmlChar *name,
|
||||
const xmlChar *nameSpace);
|
||||
XSLTPUBFUN const xmlChar * XSLTCALL
|
||||
xsltGetCNsProp (xsltStylesheetPtr style,
|
||||
xmlNodePtr node,
|
||||
const xmlChar *name,
|
||||
const xmlChar *nameSpace);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltGetUTF8Char (const unsigned char *utf,
|
||||
int *len);
|
||||
#ifdef IN_LIBXSLT
|
||||
/** DOC_DISABLE */
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltGetUTF8CharZ (const unsigned char *utf,
|
||||
int *len);
|
||||
/** DOC_ENABLE */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XSLT Debug Tracing Tracing Types
|
||||
*/
|
||||
typedef enum {
|
||||
XSLT_TRACE_ALL = -1,
|
||||
XSLT_TRACE_NONE = 0,
|
||||
XSLT_TRACE_COPY_TEXT = 1<<0,
|
||||
XSLT_TRACE_PROCESS_NODE = 1<<1,
|
||||
XSLT_TRACE_APPLY_TEMPLATE = 1<<2,
|
||||
XSLT_TRACE_COPY = 1<<3,
|
||||
XSLT_TRACE_COMMENT = 1<<4,
|
||||
XSLT_TRACE_PI = 1<<5,
|
||||
XSLT_TRACE_COPY_OF = 1<<6,
|
||||
XSLT_TRACE_VALUE_OF = 1<<7,
|
||||
XSLT_TRACE_CALL_TEMPLATE = 1<<8,
|
||||
XSLT_TRACE_APPLY_TEMPLATES = 1<<9,
|
||||
XSLT_TRACE_CHOOSE = 1<<10,
|
||||
XSLT_TRACE_IF = 1<<11,
|
||||
XSLT_TRACE_FOR_EACH = 1<<12,
|
||||
XSLT_TRACE_STRIP_SPACES = 1<<13,
|
||||
XSLT_TRACE_TEMPLATES = 1<<14,
|
||||
XSLT_TRACE_KEYS = 1<<15,
|
||||
XSLT_TRACE_VARIABLES = 1<<16
|
||||
} xsltDebugTraceCodes;
|
||||
|
||||
/**
|
||||
* XSLT_TRACE:
|
||||
*
|
||||
* Control the type of xsl debugtrace messages emitted.
|
||||
*/
|
||||
#define XSLT_TRACE(ctxt,code,call) \
|
||||
if (ctxt->traceCode && (*(ctxt->traceCode) & code)) \
|
||||
call
|
||||
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltDebugSetDefaultTrace(xsltDebugTraceCodes val);
|
||||
XSLTPUBFUN xsltDebugTraceCodes XSLTCALL
|
||||
xsltDebugGetDefaultTrace(void);
|
||||
|
||||
/*
|
||||
* XSLT specific error and debug reporting functions.
|
||||
*/
|
||||
XSLTPUBVAR xmlGenericErrorFunc xsltGenericError;
|
||||
XSLTPUBVAR void *xsltGenericErrorContext;
|
||||
XSLTPUBVAR xmlGenericErrorFunc xsltGenericDebug;
|
||||
XSLTPUBVAR void *xsltGenericDebugContext;
|
||||
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltPrintErrorContext (xsltTransformContextPtr ctxt,
|
||||
xsltStylesheetPtr style,
|
||||
xmlNodePtr node);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltMessage (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr inst);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltSetGenericErrorFunc (void *ctx,
|
||||
xmlGenericErrorFunc handler);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltSetGenericDebugFunc (void *ctx,
|
||||
xmlGenericErrorFunc handler);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltSetTransformErrorFunc (xsltTransformContextPtr ctxt,
|
||||
void *ctx,
|
||||
xmlGenericErrorFunc handler);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltTransformError (xsltTransformContextPtr ctxt,
|
||||
xsltStylesheetPtr style,
|
||||
xmlNodePtr node,
|
||||
const char *msg,
|
||||
...) LIBXSLT_ATTR_FORMAT(4,5);
|
||||
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltSetCtxtParseOptions (xsltTransformContextPtr ctxt,
|
||||
int options);
|
||||
/*
|
||||
* Sorting.
|
||||
*/
|
||||
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltDocumentSortFunction (xmlNodeSetPtr list);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltSetSortFunc (xsltSortFunc handler);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltSetCtxtSortFunc (xsltTransformContextPtr ctxt,
|
||||
xsltSortFunc handler);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltSetCtxtLocaleHandlers (xsltTransformContextPtr ctxt,
|
||||
xsltNewLocaleFunc newLocale,
|
||||
xsltFreeLocaleFunc freeLocale,
|
||||
xsltGenSortKeyFunc genSortKey);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltDefaultSortFunction (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr *sorts,
|
||||
int nbsorts);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltDoSortFunction (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr * sorts,
|
||||
int nbsorts);
|
||||
XSLTPUBFUN xmlXPathObjectPtr * XSLTCALL
|
||||
xsltComputeSortResult (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr sort);
|
||||
|
||||
/*
|
||||
* QNames handling.
|
||||
*/
|
||||
|
||||
XSLTPUBFUN const xmlChar * XSLTCALL
|
||||
xsltSplitQName (xmlDictPtr dict,
|
||||
const xmlChar *name,
|
||||
const xmlChar **prefix);
|
||||
XSLTPUBFUN const xmlChar * XSLTCALL
|
||||
xsltGetQNameURI (xmlNodePtr node,
|
||||
xmlChar **name);
|
||||
|
||||
XSLTPUBFUN const xmlChar * XSLTCALL
|
||||
xsltGetQNameURI2 (xsltStylesheetPtr style,
|
||||
xmlNodePtr node,
|
||||
const xmlChar **name);
|
||||
|
||||
/*
|
||||
* Output, reuse libxml I/O buffers.
|
||||
*/
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltSaveResultTo (xmlOutputBufferPtr buf,
|
||||
xmlDocPtr result,
|
||||
xsltStylesheetPtr style);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltSaveResultToFilename (const char *URI,
|
||||
xmlDocPtr result,
|
||||
xsltStylesheetPtr style,
|
||||
int compression);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltSaveResultToFile (FILE *file,
|
||||
xmlDocPtr result,
|
||||
xsltStylesheetPtr style);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltSaveResultToFd (int fd,
|
||||
xmlDocPtr result,
|
||||
xsltStylesheetPtr style);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltSaveResultToString (xmlChar **doc_txt_ptr,
|
||||
int * doc_txt_len,
|
||||
xmlDocPtr result,
|
||||
xsltStylesheetPtr style);
|
||||
|
||||
/*
|
||||
* XPath interface
|
||||
*/
|
||||
XSLTPUBFUN xmlXPathCompExprPtr XSLTCALL
|
||||
xsltXPathCompile (xsltStylesheetPtr style,
|
||||
const xmlChar *str);
|
||||
XSLTPUBFUN xmlXPathCompExprPtr XSLTCALL
|
||||
xsltXPathCompileFlags (xsltStylesheetPtr style,
|
||||
const xmlChar *str,
|
||||
int flags);
|
||||
|
||||
#ifdef IN_LIBXSLT
|
||||
/** DOC_DISABLE */
|
||||
#define XSLT_SOURCE_NODE_MASK 15u
|
||||
#define XSLT_SOURCE_NODE_HAS_KEY 1u
|
||||
#define XSLT_SOURCE_NODE_HAS_ID 2u
|
||||
int
|
||||
xsltGetSourceNodeFlags(xmlNodePtr node);
|
||||
int
|
||||
xsltSetSourceNodeFlags(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
int flags);
|
||||
int
|
||||
xsltClearSourceNodeFlags(xmlNodePtr node, int flags);
|
||||
void **
|
||||
xsltGetPSVIPtr(xmlNodePtr cur);
|
||||
/** DOC_ENABLE */
|
||||
#endif
|
||||
|
||||
#ifdef WITH_PROFILER
|
||||
/*
|
||||
* Profiling.
|
||||
*/
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltSaveProfiling (xsltTransformContextPtr ctxt,
|
||||
FILE *output);
|
||||
XSLTPUBFUN xmlDocPtr XSLTCALL
|
||||
xsltGetProfileInformation (xsltTransformContextPtr ctxt);
|
||||
|
||||
XSLTPUBFUN long XSLTCALL
|
||||
xsltTimestamp (void);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltCalibrateAdjust (long delta);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* XSLT_TIMESTAMP_TICS_PER_SEC:
|
||||
*
|
||||
* Sampling precision for profiling
|
||||
*/
|
||||
#define XSLT_TIMESTAMP_TICS_PER_SEC 100000l
|
||||
|
||||
/*
|
||||
* Hooks for the debugger.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
XSLT_DEBUG_NONE = 0, /* no debugging allowed */
|
||||
XSLT_DEBUG_INIT,
|
||||
XSLT_DEBUG_STEP,
|
||||
XSLT_DEBUG_STEPOUT,
|
||||
XSLT_DEBUG_NEXT,
|
||||
XSLT_DEBUG_STOP,
|
||||
XSLT_DEBUG_CONT,
|
||||
XSLT_DEBUG_RUN,
|
||||
XSLT_DEBUG_RUN_RESTART,
|
||||
XSLT_DEBUG_QUIT
|
||||
} xsltDebugStatusCodes;
|
||||
|
||||
XSLTPUBVAR int xslDebugStatus;
|
||||
|
||||
typedef void (*xsltHandleDebuggerCallback) (xmlNodePtr cur, xmlNodePtr node,
|
||||
xsltTemplatePtr templ, xsltTransformContextPtr ctxt);
|
||||
typedef int (*xsltAddCallCallback) (xsltTemplatePtr templ, xmlNodePtr source);
|
||||
typedef void (*xsltDropCallCallback) (void);
|
||||
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltGetDebuggerStatus (void);
|
||||
#ifdef WITH_DEBUGGER
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltSetDebuggerStatus (int value);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltSetDebuggerCallbacks (int no, void *block);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xslAddCall (xsltTemplatePtr templ,
|
||||
xmlNodePtr source);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xslDropCall (void);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XML_XSLTUTILS_H__ */
|
||||
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
#include <nokogiri.h>
|
||||
|
||||
#ifndef HAVE_XMLCTXTSETOPTIONS
|
||||
/* based on libxml2-2.14.0-dev (1d8bd126) parser.c xmlCtxtSetInternalOptions */
|
||||
int
|
||||
xmlCtxtSetOptions(xmlParserCtxtPtr ctxt, int options)
|
||||
{
|
||||
int keepMask = 0;
|
||||
int allMask;
|
||||
|
||||
if (ctxt == NULL) {
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* XInclude options aren't handled by the parser.
|
||||
*
|
||||
* XML_PARSE_XINCLUDE
|
||||
* XML_PARSE_NOXINCNODE
|
||||
* XML_PARSE_NOBASEFIX
|
||||
*/
|
||||
allMask = XML_PARSE_RECOVER |
|
||||
XML_PARSE_NOENT |
|
||||
XML_PARSE_DTDLOAD |
|
||||
XML_PARSE_DTDATTR |
|
||||
XML_PARSE_DTDVALID |
|
||||
XML_PARSE_NOERROR |
|
||||
XML_PARSE_NOWARNING |
|
||||
XML_PARSE_PEDANTIC |
|
||||
XML_PARSE_NOBLANKS |
|
||||
#ifdef LIBXML_SAX1_ENABLED
|
||||
XML_PARSE_SAX1 |
|
||||
#endif
|
||||
XML_PARSE_NONET |
|
||||
XML_PARSE_NODICT |
|
||||
XML_PARSE_NSCLEAN |
|
||||
XML_PARSE_NOCDATA |
|
||||
XML_PARSE_COMPACT |
|
||||
XML_PARSE_OLD10 |
|
||||
XML_PARSE_HUGE |
|
||||
XML_PARSE_OLDSAX |
|
||||
XML_PARSE_IGNORE_ENC |
|
||||
XML_PARSE_BIG_LINES;
|
||||
|
||||
ctxt->options = (ctxt->options & keepMask) | (options & allMask);
|
||||
|
||||
/*
|
||||
* For some options, struct members are historically the source
|
||||
* of truth. The values are initalized from global variables and
|
||||
* old code could also modify them directly. Several older API
|
||||
* functions that don't take an options argument rely on these
|
||||
* deprecated mechanisms.
|
||||
*
|
||||
* Once public access to struct members and the globals are
|
||||
* disabled, we can use the options bitmask as source of
|
||||
* truth, making all these struct members obsolete.
|
||||
*
|
||||
* The XML_DETECT_IDS flags is misnamed. It simply enables
|
||||
* loading of the external subset.
|
||||
*/
|
||||
ctxt->recovery = (options & XML_PARSE_RECOVER) ? 1 : 0;
|
||||
ctxt->replaceEntities = (options & XML_PARSE_NOENT) ? 1 : 0;
|
||||
ctxt->loadsubset = (options & XML_PARSE_DTDLOAD) ? XML_DETECT_IDS : 0;
|
||||
ctxt->loadsubset |= (options & XML_PARSE_DTDATTR) ? XML_COMPLETE_ATTRS : 0;
|
||||
ctxt->validate = (options & XML_PARSE_DTDVALID) ? 1 : 0;
|
||||
ctxt->pedantic = (options & XML_PARSE_PEDANTIC) ? 1 : 0;
|
||||
ctxt->keepBlanks = (options & XML_PARSE_NOBLANKS) ? 0 : 1;
|
||||
ctxt->dictNames = (options & XML_PARSE_NODICT) ? 0 : 1;
|
||||
|
||||
/*
|
||||
* Changing SAX callbacks is a bad idea. This should be fixed.
|
||||
*/
|
||||
if (options & XML_PARSE_NOBLANKS) {
|
||||
ctxt->sax->ignorableWhitespace = xmlSAX2IgnorableWhitespace;
|
||||
}
|
||||
if (options & XML_PARSE_NOCDATA) {
|
||||
ctxt->sax->cdataBlock = NULL;
|
||||
}
|
||||
if (options & XML_PARSE_HUGE) {
|
||||
if (ctxt->dict != NULL) {
|
||||
xmlDictSetLimit(ctxt->dict, 0);
|
||||
}
|
||||
}
|
||||
|
||||
ctxt->linenumbers = 1;
|
||||
|
||||
return (options & ~allMask);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_XMLCTXTGETOPTIONS
|
||||
int
|
||||
xmlCtxtGetOptions(xmlParserCtxtPtr ctxt)
|
||||
{
|
||||
return (ctxt->options);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_XMLSWITCHENCODINGNAME
|
||||
int
|
||||
xmlSwitchEncodingName(xmlParserCtxtPtr ctxt, const char *encoding)
|
||||
{
|
||||
if (ctxt == NULL) {
|
||||
return (-1);
|
||||
}
|
||||
|
||||
xmlCharEncodingHandlerPtr handler = xmlFindCharEncodingHandler(encoding);
|
||||
if (handler == NULL) {
|
||||
return (-1);
|
||||
}
|
||||
|
||||
return (xmlSwitchToEncoding(ctxt, handler));
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,294 @@
|
||||
#include <nokogiri.h>
|
||||
|
||||
VALUE mNokogiri ;
|
||||
VALUE mNokogiriGumbo ;
|
||||
VALUE mNokogiriHtml4 ;
|
||||
VALUE mNokogiriHtml4Sax ;
|
||||
VALUE mNokogiriHtml5 ;
|
||||
VALUE mNokogiriXml ;
|
||||
VALUE mNokogiriXmlSax ;
|
||||
VALUE mNokogiriXmlXpath ;
|
||||
VALUE mNokogiriXslt ;
|
||||
|
||||
VALUE cNokogiriSyntaxError;
|
||||
VALUE cNokogiriXmlCharacterData;
|
||||
VALUE cNokogiriXmlElement;
|
||||
VALUE cNokogiriXmlXpathSyntaxError;
|
||||
|
||||
void noko_init_xml_attr(void);
|
||||
void noko_init_xml_attribute_decl(void);
|
||||
void noko_init_xml_cdata(void);
|
||||
void noko_init_xml_comment(void);
|
||||
void noko_init_xml_document(void);
|
||||
void noko_init_xml_document_fragment(void);
|
||||
void noko_init_xml_dtd(void);
|
||||
void noko_init_xml_element_content(void);
|
||||
void noko_init_xml_element_decl(void);
|
||||
void noko_init_xml_encoding_handler(void);
|
||||
void noko_init_xml_entity_decl(void);
|
||||
void noko_init_xml_entity_reference(void);
|
||||
void noko_init_xml_namespace(void);
|
||||
void noko_init_xml_node(void);
|
||||
void noko_init_xml_node_set(void);
|
||||
void noko_init_xml_processing_instruction(void);
|
||||
void noko_init_xml_reader(void);
|
||||
void noko_init_xml_relax_ng(void);
|
||||
void noko_init_xml_sax_parser(void);
|
||||
void noko_init_xml_sax_parser_context(void);
|
||||
void noko_init_xml_sax_push_parser(void);
|
||||
void noko_init_xml_schema(void);
|
||||
void noko_init_xml_syntax_error(void);
|
||||
void noko_init_xml_text(void);
|
||||
void noko_init_xml_xpath_context(void);
|
||||
void noko_init_xslt_stylesheet(void);
|
||||
void noko_init_html_document(void);
|
||||
void noko_init_html_element_description(void);
|
||||
void noko_init_html_entity_lookup(void);
|
||||
void noko_init_html_sax_parser_context(void);
|
||||
void noko_init_html_sax_push_parser(void);
|
||||
void noko_init_html4_sax_parser(void);
|
||||
void noko_init_gumbo(void);
|
||||
void noko_init_test_global_handlers(void);
|
||||
|
||||
static ID id_read, id_write, id_external_encoding;
|
||||
|
||||
|
||||
static VALUE
|
||||
noko_io_read_check(VALUE val)
|
||||
{
|
||||
VALUE *args = (VALUE *)val;
|
||||
return rb_funcall(args[0], id_read, 1, args[1]);
|
||||
}
|
||||
|
||||
|
||||
static VALUE
|
||||
noko_io_read_failed(VALUE arg, VALUE exc)
|
||||
{
|
||||
return Qundef;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
noko_io_read(void *io, char *c_buffer, int c_buffer_len)
|
||||
{
|
||||
VALUE rb_io = (VALUE)io;
|
||||
VALUE rb_read_string, rb_args[2];
|
||||
size_t n_bytes_read, safe_len;
|
||||
|
||||
rb_args[0] = rb_io;
|
||||
rb_args[1] = INT2NUM(c_buffer_len);
|
||||
|
||||
rb_read_string = rb_rescue(noko_io_read_check, (VALUE)rb_args, noko_io_read_failed, 0);
|
||||
|
||||
if (NIL_P(rb_read_string)) { return 0; }
|
||||
if (rb_read_string == Qundef) { return -1; }
|
||||
if (TYPE(rb_read_string) != T_STRING) { return -1; }
|
||||
|
||||
n_bytes_read = (size_t)RSTRING_LEN(rb_read_string);
|
||||
safe_len = (n_bytes_read > (size_t)c_buffer_len) ? (size_t)c_buffer_len : n_bytes_read;
|
||||
memcpy(c_buffer, StringValuePtr(rb_read_string), safe_len);
|
||||
|
||||
return (int)safe_len;
|
||||
}
|
||||
|
||||
|
||||
static VALUE
|
||||
noko_io_write_check(VALUE rb_args)
|
||||
{
|
||||
VALUE rb_io = ((VALUE *)rb_args)[0];
|
||||
VALUE rb_output = ((VALUE *)rb_args)[1];
|
||||
return rb_funcall(rb_io, id_write, 1, rb_output);
|
||||
}
|
||||
|
||||
|
||||
static VALUE
|
||||
noko_io_write_failed(VALUE arg, VALUE exc)
|
||||
{
|
||||
return Qundef;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
noko_io_write(void *io, char *c_buffer, int c_buffer_len)
|
||||
{
|
||||
VALUE rb_args[2], rb_n_bytes_written;
|
||||
VALUE rb_io = (VALUE)io;
|
||||
VALUE rb_enc = Qnil;
|
||||
rb_encoding *io_encoding;
|
||||
|
||||
if (rb_respond_to(rb_io, id_external_encoding)) {
|
||||
rb_enc = rb_funcall(rb_io, id_external_encoding, 0);
|
||||
}
|
||||
io_encoding = RB_NIL_P(rb_enc) ? rb_ascii8bit_encoding() : rb_to_encoding(rb_enc);
|
||||
|
||||
rb_args[0] = rb_io;
|
||||
rb_args[1] = rb_enc_str_new(c_buffer, (long)c_buffer_len, io_encoding);
|
||||
|
||||
rb_n_bytes_written = rb_rescue(noko_io_write_check, (VALUE)rb_args, noko_io_write_failed, 0);
|
||||
if (rb_n_bytes_written == Qundef) { return -1; }
|
||||
|
||||
return NUM2INT(rb_n_bytes_written);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
noko_io_close(void *io)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#if defined(_WIN32) && !defined(NOKOGIRI_PACKAGED_LIBRARIES)
|
||||
# define NOKOGIRI_WINDOWS_DLLS 1
|
||||
#else
|
||||
# define NOKOGIRI_WINDOWS_DLLS 0
|
||||
#endif
|
||||
|
||||
//
|
||||
// | dlls || true | false |
|
||||
// | nlmm || | |
|
||||
// |-----------++---------+---------|
|
||||
// | NULL || default | ruby |
|
||||
// | "random" || default | ruby |
|
||||
// | "ruby" || ruby | ruby |
|
||||
// | "default" || default | default |
|
||||
//
|
||||
// We choose *not* to use Ruby's memory management functions with windows DLLs because of this
|
||||
// issue: https://github.com/sparklemotion/nokogiri/issues/2241
|
||||
//
|
||||
static void
|
||||
set_libxml_memory_management(void)
|
||||
{
|
||||
const char *nlmm = getenv("NOKOGIRI_LIBXML_MEMORY_MANAGEMENT");
|
||||
if (nlmm) {
|
||||
if (strcmp(nlmm, "default") == 0) {
|
||||
goto libxml_uses_default_memory_management;
|
||||
} else if (strcmp(nlmm, "ruby") == 0) {
|
||||
goto libxml_uses_ruby_memory_management;
|
||||
}
|
||||
}
|
||||
if (NOKOGIRI_WINDOWS_DLLS) {
|
||||
libxml_uses_default_memory_management:
|
||||
rb_const_set(mNokogiri, rb_intern("LIBXML_MEMORY_MANAGEMENT"), NOKOGIRI_STR_NEW2("default"));
|
||||
return;
|
||||
} else {
|
||||
libxml_uses_ruby_memory_management:
|
||||
rb_const_set(mNokogiri, rb_intern("LIBXML_MEMORY_MANAGEMENT"), NOKOGIRI_STR_NEW2("ruby"));
|
||||
xmlMemSetup((xmlFreeFunc)ruby_xfree, (xmlMallocFunc)ruby_xmalloc, (xmlReallocFunc)ruby_xrealloc, ruby_strdup);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Init_nokogiri(void)
|
||||
{
|
||||
mNokogiri = rb_define_module("Nokogiri");
|
||||
mNokogiriGumbo = rb_define_module_under(mNokogiri, "Gumbo");
|
||||
mNokogiriHtml4 = rb_define_module_under(mNokogiri, "HTML4");
|
||||
mNokogiriHtml4Sax = rb_define_module_under(mNokogiriHtml4, "SAX");
|
||||
mNokogiriHtml5 = rb_define_module_under(mNokogiri, "HTML5");
|
||||
mNokogiriXml = rb_define_module_under(mNokogiri, "XML");
|
||||
mNokogiriXmlSax = rb_define_module_under(mNokogiriXml, "SAX");
|
||||
mNokogiriXmlXpath = rb_define_module_under(mNokogiriXml, "XPath");
|
||||
mNokogiriXslt = rb_define_module_under(mNokogiri, "XSLT");
|
||||
|
||||
set_libxml_memory_management(); /* must be before any function calls that might invoke xmlInitParser() */
|
||||
xmlInitParser();
|
||||
exsltRegisterAll();
|
||||
|
||||
rb_const_set(mNokogiri, rb_intern("LIBXML_COMPILED_VERSION"), NOKOGIRI_STR_NEW2(LIBXML_DOTTED_VERSION));
|
||||
rb_const_set(mNokogiri, rb_intern("LIBXML_LOADED_VERSION"), NOKOGIRI_STR_NEW2(xmlParserVersion));
|
||||
|
||||
rb_const_set(mNokogiri, rb_intern("LIBXSLT_COMPILED_VERSION"), NOKOGIRI_STR_NEW2(LIBXSLT_DOTTED_VERSION));
|
||||
rb_const_set(mNokogiri, rb_intern("LIBXSLT_LOADED_VERSION"), NOKOGIRI_STR_NEW2(xsltEngineVersion));
|
||||
|
||||
rb_const_set(mNokogiri, rb_intern("LIBXML_ZLIB_ENABLED"),
|
||||
xmlHasFeature(XML_WITH_ZLIB) == 1 ? Qtrue : Qfalse);
|
||||
|
||||
#ifdef NOKOGIRI_PACKAGED_LIBRARIES
|
||||
rb_const_set(mNokogiri, rb_intern("PACKAGED_LIBRARIES"), Qtrue);
|
||||
# ifdef NOKOGIRI_PRECOMPILED_LIBRARIES
|
||||
rb_const_set(mNokogiri, rb_intern("PRECOMPILED_LIBRARIES"), Qtrue);
|
||||
# else
|
||||
rb_const_set(mNokogiri, rb_intern("PRECOMPILED_LIBRARIES"), Qfalse);
|
||||
# endif
|
||||
rb_const_set(mNokogiri, rb_intern("LIBXML2_PATCHES"), rb_str_split(NOKOGIRI_STR_NEW2(NOKOGIRI_LIBXML2_PATCHES), " "));
|
||||
rb_const_set(mNokogiri, rb_intern("LIBXSLT_PATCHES"), rb_str_split(NOKOGIRI_STR_NEW2(NOKOGIRI_LIBXSLT_PATCHES), " "));
|
||||
#else
|
||||
rb_const_set(mNokogiri, rb_intern("PACKAGED_LIBRARIES"), Qfalse);
|
||||
rb_const_set(mNokogiri, rb_intern("PRECOMPILED_LIBRARIES"), Qfalse);
|
||||
rb_const_set(mNokogiri, rb_intern("LIBXML2_PATCHES"), Qnil);
|
||||
rb_const_set(mNokogiri, rb_intern("LIBXSLT_PATCHES"), Qnil);
|
||||
#endif
|
||||
|
||||
#ifdef LIBXML_ICONV_ENABLED
|
||||
rb_const_set(mNokogiri, rb_intern("LIBXML_ICONV_ENABLED"), Qtrue);
|
||||
#else
|
||||
rb_const_set(mNokogiri, rb_intern("LIBXML_ICONV_ENABLED"), Qfalse);
|
||||
#endif
|
||||
|
||||
#ifdef NOKOGIRI_OTHER_LIBRARY_VERSIONS
|
||||
rb_const_set(mNokogiri, rb_intern("OTHER_LIBRARY_VERSIONS"), NOKOGIRI_STR_NEW2(NOKOGIRI_OTHER_LIBRARY_VERSIONS));
|
||||
#endif
|
||||
|
||||
if (xsltExtModuleFunctionLookup((const xmlChar *)"date-time", EXSLT_DATE_NAMESPACE)) {
|
||||
rb_const_set(mNokogiri, rb_intern("LIBXSLT_DATETIME_ENABLED"), Qtrue);
|
||||
} else {
|
||||
rb_const_set(mNokogiri, rb_intern("LIBXSLT_DATETIME_ENABLED"), Qfalse);
|
||||
}
|
||||
|
||||
cNokogiriSyntaxError = rb_define_class_under(mNokogiri, "SyntaxError", rb_eStandardError);
|
||||
noko_init_xml_syntax_error();
|
||||
assert(cNokogiriXmlSyntaxError);
|
||||
cNokogiriXmlXpathSyntaxError = rb_define_class_under(mNokogiriXmlXpath, "SyntaxError", cNokogiriXmlSyntaxError);
|
||||
|
||||
noko_init_xml_element_content();
|
||||
noko_init_xml_encoding_handler();
|
||||
noko_init_xml_namespace();
|
||||
noko_init_xml_node_set();
|
||||
noko_init_xml_reader();
|
||||
|
||||
noko_init_xml_sax_parser();
|
||||
noko_init_html4_sax_parser();
|
||||
|
||||
noko_init_xml_xpath_context();
|
||||
noko_init_xslt_stylesheet();
|
||||
noko_init_html_element_description();
|
||||
noko_init_html_entity_lookup();
|
||||
|
||||
noko_init_xml_schema();
|
||||
noko_init_xml_relax_ng();
|
||||
|
||||
noko_init_xml_sax_parser_context();
|
||||
noko_init_html_sax_parser_context();
|
||||
|
||||
noko_init_xml_sax_push_parser();
|
||||
noko_init_html_sax_push_parser();
|
||||
|
||||
noko_init_xml_node();
|
||||
noko_init_xml_attr();
|
||||
noko_init_xml_attribute_decl();
|
||||
noko_init_xml_dtd();
|
||||
noko_init_xml_element_decl();
|
||||
noko_init_xml_entity_decl();
|
||||
noko_init_xml_entity_reference();
|
||||
noko_init_xml_processing_instruction();
|
||||
assert(cNokogiriXmlNode);
|
||||
cNokogiriXmlElement = rb_define_class_under(mNokogiriXml, "Element", cNokogiriXmlNode);
|
||||
cNokogiriXmlCharacterData = rb_define_class_under(mNokogiriXml, "CharacterData", cNokogiriXmlNode);
|
||||
noko_init_xml_comment();
|
||||
noko_init_xml_text();
|
||||
noko_init_xml_cdata();
|
||||
|
||||
noko_init_xml_document_fragment();
|
||||
noko_init_xml_document();
|
||||
noko_init_html_document();
|
||||
noko_init_gumbo();
|
||||
|
||||
noko_init_test_global_handlers();
|
||||
|
||||
id_read = rb_intern("read");
|
||||
id_write = rb_intern("write");
|
||||
id_external_encoding = rb_intern("external_encoding");
|
||||
}
|
||||
@@ -0,0 +1,238 @@
|
||||
#ifndef NOKOGIRI_NATIVE
|
||||
#define NOKOGIRI_NATIVE
|
||||
|
||||
#include <ruby/defines.h> // https://github.com/sparklemotion/nokogiri/issues/2696
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# endif /* WIN32_LEAN_AND_MEAN */
|
||||
|
||||
# ifndef WIN32
|
||||
# define WIN32
|
||||
# endif /* WIN32 */
|
||||
|
||||
# include <winsock2.h>
|
||||
# include <ws2tcpip.h>
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# define NOKOPUBFUN __declspec(dllexport)
|
||||
# define NOKOPUBVAR __declspec(dllexport) extern
|
||||
#else
|
||||
# define NOKOPUBFUN
|
||||
# define NOKOPUBVAR extern
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/entities.h>
|
||||
#include <libxml/xpath.h>
|
||||
#include <libxml/xmlreader.h>
|
||||
#include <libxml/xmlsave.h>
|
||||
#include <libxml/xmlschemas.h>
|
||||
#include <libxml/HTMLparser.h>
|
||||
#include <libxml/HTMLtree.h>
|
||||
#include <libxml/relaxng.h>
|
||||
#include <libxml/xinclude.h>
|
||||
#include <libxml/c14n.h>
|
||||
#include <libxml/parserInternals.h>
|
||||
#include <libxml/xpathInternals.h>
|
||||
|
||||
#include <libxslt/extensions.h>
|
||||
#include <libxslt/xsltconfig.h>
|
||||
#include <libxslt/xsltutils.h>
|
||||
#include <libxslt/transform.h>
|
||||
#include <libxslt/imports.h>
|
||||
#include <libxslt/xsltInternals.h>
|
||||
|
||||
#include <libexslt/exslt.h>
|
||||
|
||||
/* libxml2_polyfill.c */
|
||||
#ifndef HAVE_XMLCTXTSETOPTIONS
|
||||
int xmlCtxtSetOptions(xmlParserCtxtPtr ctxt, int options);
|
||||
#endif
|
||||
#ifndef HAVE_XMLCTXTGETOPTIONS
|
||||
int xmlCtxtGetOptions(xmlParserCtxtPtr ctxt);
|
||||
#endif
|
||||
#ifndef HAVE_XMLSWITCHENCODINGNAME
|
||||
int xmlSwitchEncodingName(xmlParserCtxtPtr ctxt, const char *encoding);
|
||||
#endif
|
||||
|
||||
#define XMLNS_PREFIX "xmlns"
|
||||
#define XMLNS_PREFIX_LEN 6 /* including either colon or \0 */
|
||||
|
||||
#ifndef xmlErrorConstPtr
|
||||
# if LIBXML_VERSION >= 21200
|
||||
# define xmlErrorConstPtr const xmlError *
|
||||
# else
|
||||
# define xmlErrorConstPtr xmlError *
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <ruby.h>
|
||||
#include <ruby/st.h>
|
||||
#include <ruby/encoding.h>
|
||||
#include <ruby/util.h>
|
||||
#include <ruby/version.h>
|
||||
|
||||
#define NOKOGIRI_STR_NEW2(str) NOKOGIRI_STR_NEW(str, strlen((const char *)(str)))
|
||||
#define NOKOGIRI_STR_NEW(str, len) rb_external_str_new_with_enc((const char *)(str), (long)(len), rb_utf8_encoding())
|
||||
#define RBSTR_OR_QNIL(_str) (_str ? NOKOGIRI_STR_NEW2(_str) : Qnil)
|
||||
|
||||
#ifndef NORETURN_DECL
|
||||
# if defined(__GNUC__)
|
||||
# define NORETURN_DECL __attribute__ ((noreturn))
|
||||
# else
|
||||
# define NORETURN_DECL
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef PRINTFLIKE_DECL
|
||||
# if defined(__GNUC__)
|
||||
# define PRINTFLIKE_DECL(stringidx, argidx) __attribute__ ((format(printf,stringidx,argidx)))
|
||||
# else
|
||||
# define PRINTFLIKE_DECL(stringidx, argidx)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(TRUFFLERUBY) && !defined(NOKOGIRI_PACKAGED_LIBRARIES)
|
||||
# define TRUFFLERUBY_NOKOGIRI_SYSTEM_LIBRARIES
|
||||
#endif
|
||||
|
||||
NOKOPUBVAR VALUE mNokogiri ;
|
||||
NOKOPUBVAR VALUE mNokogiriGumbo ;
|
||||
NOKOPUBVAR VALUE mNokogiriHtml4 ;
|
||||
NOKOPUBVAR VALUE mNokogiriHtml4Sax ;
|
||||
NOKOPUBVAR VALUE mNokogiriHtml5 ;
|
||||
NOKOPUBVAR VALUE mNokogiriXml ;
|
||||
NOKOPUBVAR VALUE mNokogiriXmlSax ;
|
||||
NOKOPUBVAR VALUE mNokogiriXmlXpath ;
|
||||
NOKOPUBVAR VALUE mNokogiriXslt ;
|
||||
|
||||
NOKOPUBVAR VALUE cNokogiriEncodingHandler;
|
||||
NOKOPUBVAR VALUE cNokogiriSyntaxError;
|
||||
NOKOPUBVAR VALUE cNokogiriXmlAttr;
|
||||
NOKOPUBVAR VALUE cNokogiriXmlAttributeDecl;
|
||||
NOKOPUBVAR VALUE cNokogiriXmlCData;
|
||||
NOKOPUBVAR VALUE cNokogiriXmlCharacterData;
|
||||
NOKOPUBVAR VALUE cNokogiriXmlComment;
|
||||
NOKOPUBVAR VALUE cNokogiriXmlDocument ;
|
||||
NOKOPUBVAR VALUE cNokogiriXmlDocumentFragment;
|
||||
NOKOPUBVAR VALUE cNokogiriXmlDtd;
|
||||
NOKOPUBVAR VALUE cNokogiriXmlElement ;
|
||||
NOKOPUBVAR VALUE cNokogiriXmlElementContent;
|
||||
NOKOPUBVAR VALUE cNokogiriXmlElementDecl;
|
||||
NOKOPUBVAR VALUE cNokogiriXmlEntityDecl;
|
||||
NOKOPUBVAR VALUE cNokogiriXmlEntityReference;
|
||||
NOKOPUBVAR VALUE cNokogiriXmlNamespace ;
|
||||
NOKOPUBVAR VALUE cNokogiriXmlNode ;
|
||||
NOKOPUBVAR VALUE cNokogiriXmlNodeSet ;
|
||||
NOKOPUBVAR VALUE cNokogiriXmlProcessingInstruction;
|
||||
NOKOPUBVAR VALUE cNokogiriXmlReader;
|
||||
NOKOPUBVAR VALUE cNokogiriXmlRelaxNG;
|
||||
NOKOPUBVAR VALUE cNokogiriXmlSaxParser ;
|
||||
NOKOPUBVAR VALUE cNokogiriXmlSaxParserContext;
|
||||
NOKOPUBVAR VALUE cNokogiriXmlSaxPushParser ;
|
||||
NOKOPUBVAR VALUE cNokogiriXmlSchema;
|
||||
NOKOPUBVAR VALUE cNokogiriXmlSyntaxError;
|
||||
NOKOPUBVAR VALUE cNokogiriXmlText ;
|
||||
NOKOPUBVAR VALUE cNokogiriXmlXpathContext;
|
||||
NOKOPUBVAR VALUE cNokogiriXmlXpathSyntaxError;
|
||||
NOKOPUBVAR VALUE cNokogiriXsltStylesheet ;
|
||||
|
||||
NOKOPUBVAR VALUE cNokogiriHtml4Document ;
|
||||
NOKOPUBVAR VALUE cNokogiriHtml4SaxPushParser ;
|
||||
NOKOPUBVAR VALUE cNokogiriHtml4ElementDescription ;
|
||||
NOKOPUBVAR VALUE cNokogiriHtml4SaxParser;
|
||||
NOKOPUBVAR VALUE cNokogiriHtml4SaxParserContext;
|
||||
NOKOPUBVAR VALUE cNokogiriHtml5Document ;
|
||||
|
||||
typedef struct _nokogiriTuple {
|
||||
VALUE doc;
|
||||
st_table *unlinkedNodes;
|
||||
VALUE node_cache;
|
||||
} nokogiriTuple;
|
||||
typedef nokogiriTuple *nokogiriTuplePtr;
|
||||
|
||||
typedef struct _libxmlStructuredErrorHandlerState {
|
||||
void *user_data;
|
||||
xmlStructuredErrorFunc handler;
|
||||
} libxmlStructuredErrorHandlerState ;
|
||||
|
||||
typedef struct _nokogiriXsltStylesheetTuple {
|
||||
xsltStylesheetPtr ss;
|
||||
VALUE func_instances;
|
||||
} nokogiriXsltStylesheetTuple;
|
||||
|
||||
void noko_xml_document_pin_node(xmlNodePtr);
|
||||
void noko_xml_document_pin_namespace(xmlNsPtr, xmlDocPtr);
|
||||
int noko_xml_document_has_wrapped_blank_nodes_p(xmlDocPtr c_document);
|
||||
|
||||
int noko_io_read(void *ctx, char *buffer, int len);
|
||||
int noko_io_write(void *ctx, char *buffer, int len);
|
||||
int noko_io_close(void *ctx);
|
||||
|
||||
#define Noko_Node_Get_Struct(obj,type,sval) ((sval) = (type*)DATA_PTR(obj))
|
||||
#define Noko_Namespace_Get_Struct(obj,type,sval) ((sval) = (type*)DATA_PTR(obj))
|
||||
|
||||
VALUE noko_xml_node_wrap(VALUE klass, xmlNodePtr node) ;
|
||||
VALUE noko_xml_node_wrap_node_set_result(xmlNodePtr node, VALUE node_set) ;
|
||||
VALUE noko_xml_node_attrs(xmlNodePtr node) ;
|
||||
|
||||
VALUE noko_xml_namespace_wrap(xmlNsPtr node, xmlDocPtr doc);
|
||||
VALUE noko_xml_namespace_wrap_xpath_copy(xmlNsPtr node);
|
||||
|
||||
VALUE noko_xml_element_content_wrap(VALUE doc, xmlElementContentPtr element);
|
||||
|
||||
VALUE noko_xml_node_set_wrap(xmlNodeSetPtr node_set, VALUE document) ;
|
||||
xmlNodeSetPtr noko_xml_node_set_unwrap(VALUE rb_node_set) ;
|
||||
|
||||
VALUE noko_xml_document_wrap_with_init_args(VALUE klass, xmlDocPtr doc, int argc, VALUE *argv);
|
||||
VALUE noko_xml_document_wrap(VALUE klass, xmlDocPtr doc);
|
||||
xmlDocPtr noko_xml_document_unwrap(VALUE rb_document);
|
||||
NOKOPUBFUN VALUE Nokogiri_wrap_xml_document(VALUE klass,
|
||||
xmlDocPtr doc); /* deprecated. use noko_xml_document_wrap() instead. */
|
||||
|
||||
xmlSAXHandlerPtr noko_xml_sax_parser_unwrap(VALUE rb_sax_handler);
|
||||
|
||||
xmlParserCtxtPtr noko_xml_sax_push_parser_unwrap(VALUE rb_parser);
|
||||
|
||||
VALUE noko_xml_sax_parser_context_wrap(VALUE klass, xmlParserCtxtPtr c_context);
|
||||
xmlParserCtxtPtr noko_xml_sax_parser_context_unwrap(VALUE rb_context);
|
||||
void noko_xml_sax_parser_context_set_encoding(xmlParserCtxtPtr c_context, VALUE rb_encoding);
|
||||
|
||||
#define DOC_RUBY_OBJECT_TEST(x) ((nokogiriTuplePtr)(x->_private))
|
||||
#define DOC_RUBY_OBJECT(x) (((nokogiriTuplePtr)(x->_private))->doc)
|
||||
#define DOC_UNLINKED_NODE_HASH(x) (((nokogiriTuplePtr)(x->_private))->unlinkedNodes)
|
||||
#define DOC_NODE_CACHE(x) (((nokogiriTuplePtr)(x->_private))->node_cache)
|
||||
#define NOKOGIRI_NAMESPACE_EH(node) ((node)->type == XML_NAMESPACE_DECL)
|
||||
|
||||
#define DISCARD_CONST_QUAL(t, v) ((t)(uintptr_t)(v))
|
||||
#define DISCARD_CONST_QUAL_XMLCHAR(v) DISCARD_CONST_QUAL(xmlChar *, v)
|
||||
|
||||
#if HAVE_RB_CATEGORY_WARNING
|
||||
# define NOKO_WARN_DEPRECATION(message...) rb_category_warning(RB_WARN_CATEGORY_DEPRECATED, message)
|
||||
#else
|
||||
# define NOKO_WARN_DEPRECATION(message...) rb_warning(message)
|
||||
#endif
|
||||
|
||||
void noko__structured_error_func_save(libxmlStructuredErrorHandlerState *handler_state);
|
||||
void noko__structured_error_func_save_and_set(libxmlStructuredErrorHandlerState *handler_state, void *user_data,
|
||||
xmlStructuredErrorFunc handler);
|
||||
void noko__structured_error_func_restore(libxmlStructuredErrorHandlerState *handler_state);
|
||||
VALUE noko_xml_syntax_error__wrap(xmlErrorConstPtr error);
|
||||
void noko__error_array_pusher(void *ctx, xmlErrorConstPtr error);
|
||||
NORETURN_DECL void noko__error_raise(void *ctx, xmlErrorConstPtr error);
|
||||
void Nokogiri_marshal_xpath_funcall_and_return_values(xmlXPathParserContextPtr ctx, int nargs, VALUE handler,
|
||||
const char *function_name) ;
|
||||
|
||||
#endif /* NOKOGIRI_NATIVE */
|
||||
@@ -0,0 +1,40 @@
|
||||
#include <nokogiri.h>
|
||||
|
||||
static VALUE foreign_error_handler_block = Qnil;
|
||||
|
||||
static void
|
||||
foreign_error_handler(void *user_data, xmlErrorConstPtr c_error)
|
||||
{
|
||||
rb_funcall(foreign_error_handler_block, rb_intern("call"), 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* __foreign_error_handler { ... } -> nil
|
||||
*
|
||||
* Override libxml2's global error handlers to call the block. This method thus has very little
|
||||
* value except to test that Nokogiri is properly setting error handlers elsewhere in the code. See
|
||||
* test/helper.rb for how this is being used.
|
||||
*/
|
||||
static VALUE
|
||||
rb_foreign_error_handler(VALUE klass)
|
||||
{
|
||||
rb_need_block();
|
||||
foreign_error_handler_block = rb_block_proc();
|
||||
xmlSetStructuredErrorFunc(NULL, foreign_error_handler);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
/*
|
||||
* Document-module: Nokogiri::Test
|
||||
*
|
||||
* The Nokogiri::Test module should only be used for testing Nokogiri.
|
||||
* Do NOT use this outside of the Nokogiri test suite.
|
||||
*/
|
||||
void
|
||||
noko_init_test_global_handlers(void)
|
||||
{
|
||||
VALUE mNokogiriTest = rb_define_module_under(mNokogiri, "Test");
|
||||
|
||||
rb_define_singleton_method(mNokogiriTest, "__foreign_error_handler", rb_foreign_error_handler, 0);
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
#include <nokogiri.h>
|
||||
|
||||
VALUE cNokogiriXmlAttr;
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* value=(content)
|
||||
*
|
||||
* Set the value for this Attr to +content+. Use +nil+ to remove the value
|
||||
* (e.g., a HTML boolean attribute).
|
||||
*/
|
||||
static VALUE
|
||||
set_value(VALUE self, VALUE content)
|
||||
{
|
||||
xmlAttrPtr attr;
|
||||
xmlChar *value;
|
||||
xmlNode *cur;
|
||||
|
||||
Noko_Node_Get_Struct(self, xmlAttr, attr);
|
||||
|
||||
if (attr->children) {
|
||||
xmlFreeNodeList(attr->children);
|
||||
}
|
||||
attr->children = attr->last = NULL;
|
||||
|
||||
if (content == Qnil) {
|
||||
return content;
|
||||
}
|
||||
|
||||
value = xmlEncodeEntitiesReentrant(attr->doc, (unsigned char *)StringValueCStr(content));
|
||||
if (xmlStrlen(value) == 0) {
|
||||
attr->children = xmlNewDocText(attr->doc, value);
|
||||
} else {
|
||||
attr->children = xmlStringGetNodeList(attr->doc, value);
|
||||
}
|
||||
xmlFree(value);
|
||||
|
||||
for (cur = attr->children; cur; cur = cur->next) {
|
||||
cur->parent = (xmlNode *)attr;
|
||||
cur->doc = attr->doc;
|
||||
if (cur->next == NULL) {
|
||||
attr->last = cur;
|
||||
}
|
||||
}
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* new(document, name)
|
||||
*
|
||||
* Create a new Attr element on the +document+ with +name+
|
||||
*/
|
||||
static VALUE
|
||||
new (int argc, VALUE *argv, VALUE klass)
|
||||
{
|
||||
xmlDocPtr xml_doc;
|
||||
VALUE document;
|
||||
VALUE name;
|
||||
VALUE rest;
|
||||
xmlAttrPtr node;
|
||||
VALUE rb_node;
|
||||
|
||||
rb_scan_args(argc, argv, "2*", &document, &name, &rest);
|
||||
|
||||
if (! rb_obj_is_kind_of(document, cNokogiriXmlDocument)) {
|
||||
rb_raise(rb_eArgError, "parameter must be a Nokogiri::XML::Document");
|
||||
}
|
||||
|
||||
xml_doc = noko_xml_document_unwrap(document);
|
||||
|
||||
node = xmlNewDocProp(
|
||||
xml_doc,
|
||||
(const xmlChar *)StringValueCStr(name),
|
||||
NULL
|
||||
);
|
||||
|
||||
noko_xml_document_pin_node((xmlNodePtr)node);
|
||||
|
||||
rb_node = noko_xml_node_wrap(klass, (xmlNodePtr)node);
|
||||
rb_obj_call_init(rb_node, argc, argv);
|
||||
|
||||
if (rb_block_given_p()) {
|
||||
rb_yield(rb_node);
|
||||
}
|
||||
|
||||
return rb_node;
|
||||
}
|
||||
|
||||
void
|
||||
noko_init_xml_attr(void)
|
||||
{
|
||||
assert(cNokogiriXmlNode);
|
||||
/*
|
||||
* Attr represents a Attr node in an xml document.
|
||||
*/
|
||||
cNokogiriXmlAttr = rb_define_class_under(mNokogiriXml, "Attr", cNokogiriXmlNode);
|
||||
|
||||
rb_define_singleton_method(cNokogiriXmlAttr, "new", new, -1);
|
||||
|
||||
rb_define_method(cNokogiriXmlAttr, "value=", set_value, 1);
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
#include <nokogiri.h>
|
||||
|
||||
VALUE cNokogiriXmlAttributeDecl;
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* attribute_type
|
||||
*
|
||||
* The attribute_type for this AttributeDecl
|
||||
*/
|
||||
static VALUE
|
||||
attribute_type(VALUE self)
|
||||
{
|
||||
xmlAttributePtr node;
|
||||
Noko_Node_Get_Struct(self, xmlAttribute, node);
|
||||
return INT2NUM(node->atype);
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* default
|
||||
*
|
||||
* The default value
|
||||
*/
|
||||
static VALUE
|
||||
default_value(VALUE self)
|
||||
{
|
||||
xmlAttributePtr node;
|
||||
Noko_Node_Get_Struct(self, xmlAttribute, node);
|
||||
|
||||
if (node->defaultValue) { return NOKOGIRI_STR_NEW2(node->defaultValue); }
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* enumeration
|
||||
*
|
||||
* An enumeration of possible values
|
||||
*/
|
||||
static VALUE
|
||||
enumeration(VALUE self)
|
||||
{
|
||||
xmlAttributePtr node;
|
||||
xmlEnumerationPtr enm;
|
||||
VALUE list;
|
||||
|
||||
Noko_Node_Get_Struct(self, xmlAttribute, node);
|
||||
|
||||
list = rb_ary_new();
|
||||
enm = node->tree;
|
||||
|
||||
while (enm) {
|
||||
rb_ary_push(list, NOKOGIRI_STR_NEW2(enm->name));
|
||||
enm = enm->next;
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
void
|
||||
noko_init_xml_attribute_decl(void)
|
||||
{
|
||||
assert(cNokogiriXmlNode);
|
||||
cNokogiriXmlAttributeDecl = rb_define_class_under(mNokogiriXml, "AttributeDecl", cNokogiriXmlNode);
|
||||
|
||||
rb_define_method(cNokogiriXmlAttributeDecl, "attribute_type", attribute_type, 0);
|
||||
rb_define_method(cNokogiriXmlAttributeDecl, "default", default_value, 0);
|
||||
rb_define_method(cNokogiriXmlAttributeDecl, "enumeration", enumeration, 0);
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
#include <nokogiri.h>
|
||||
|
||||
VALUE cNokogiriXmlCData;
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* new(document, content)
|
||||
*
|
||||
* Create a new CDATA element on the +document+ with +content+
|
||||
*
|
||||
* If +content+ cannot be implicitly converted to a string, this method will
|
||||
* raise a TypeError exception.
|
||||
*/
|
||||
static VALUE
|
||||
rb_xml_cdata_s_new(int argc, VALUE *argv, VALUE klass)
|
||||
{
|
||||
xmlDocPtr c_document;
|
||||
xmlNodePtr c_node;
|
||||
VALUE rb_document;
|
||||
VALUE rb_content;
|
||||
VALUE rb_rest;
|
||||
VALUE rb_node;
|
||||
|
||||
rb_scan_args(argc, argv, "2*", &rb_document, &rb_content, &rb_rest);
|
||||
|
||||
Check_Type(rb_content, T_STRING);
|
||||
if (!rb_obj_is_kind_of(rb_document, cNokogiriXmlNode)) {
|
||||
rb_raise(rb_eTypeError,
|
||||
"expected first parameter to be a Nokogiri::XML::Document, received %"PRIsVALUE,
|
||||
rb_obj_class(rb_document));
|
||||
}
|
||||
|
||||
if (!rb_obj_is_kind_of(rb_document, cNokogiriXmlDocument)) {
|
||||
xmlNodePtr deprecated_node_type_arg;
|
||||
NOKO_WARN_DEPRECATION("Passing a Node as the first parameter to CDATA.new is deprecated. Please pass a Document instead. This will become an error in Nokogiri v1.17.0."); // TODO: deprecated in v1.15.3, remove in v1.17.0
|
||||
Noko_Node_Get_Struct(rb_document, xmlNode, deprecated_node_type_arg);
|
||||
c_document = deprecated_node_type_arg->doc;
|
||||
} else {
|
||||
c_document = noko_xml_document_unwrap(rb_document);
|
||||
}
|
||||
|
||||
c_node = xmlNewCDataBlock(c_document, (xmlChar *)StringValueCStr(rb_content), RSTRING_LENINT(rb_content));
|
||||
noko_xml_document_pin_node(c_node);
|
||||
rb_node = noko_xml_node_wrap(klass, c_node);
|
||||
rb_obj_call_init(rb_node, argc, argv);
|
||||
|
||||
if (rb_block_given_p()) { rb_yield(rb_node); }
|
||||
|
||||
return rb_node;
|
||||
}
|
||||
|
||||
void
|
||||
noko_init_xml_cdata(void)
|
||||
{
|
||||
assert(cNokogiriXmlText);
|
||||
/*
|
||||
* CData represents a CData node in an xml document.
|
||||
*/
|
||||
cNokogiriXmlCData = rb_define_class_under(mNokogiriXml, "CDATA", cNokogiriXmlText);
|
||||
|
||||
rb_define_singleton_method(cNokogiriXmlCData, "new", rb_xml_cdata_s_new, -1);
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
#include <nokogiri.h>
|
||||
|
||||
VALUE cNokogiriXmlComment;
|
||||
|
||||
static ID document_id ;
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* new(document_or_node, content)
|
||||
*
|
||||
* Create a new Comment element on the +document+ with +content+.
|
||||
* Alternatively, if a +node+ is passed, the +node+'s document is used.
|
||||
*/
|
||||
static VALUE
|
||||
new (int argc, VALUE *argv, VALUE klass)
|
||||
{
|
||||
xmlDocPtr xml_doc;
|
||||
xmlNodePtr node;
|
||||
VALUE document;
|
||||
VALUE content;
|
||||
VALUE rest;
|
||||
VALUE rb_node;
|
||||
|
||||
rb_scan_args(argc, argv, "2*", &document, &content, &rest);
|
||||
|
||||
Check_Type(content, T_STRING);
|
||||
if (rb_obj_is_kind_of(document, cNokogiriXmlNode)) {
|
||||
document = rb_funcall(document, document_id, 0);
|
||||
} else if (!rb_obj_is_kind_of(document, cNokogiriXmlDocument)
|
||||
&& !rb_obj_is_kind_of(document, cNokogiriXmlDocumentFragment)) {
|
||||
rb_raise(rb_eArgError, "first argument must be a XML::Document or XML::Node");
|
||||
}
|
||||
xml_doc = noko_xml_document_unwrap(document);
|
||||
|
||||
node = xmlNewDocComment(xml_doc, (const xmlChar *)StringValueCStr(content));
|
||||
noko_xml_document_pin_node(node);
|
||||
rb_node = noko_xml_node_wrap(klass, node);
|
||||
rb_obj_call_init(rb_node, argc, argv);
|
||||
|
||||
if (rb_block_given_p()) { rb_yield(rb_node); }
|
||||
|
||||
return rb_node;
|
||||
}
|
||||
|
||||
void
|
||||
noko_init_xml_comment(void)
|
||||
{
|
||||
assert(cNokogiriXmlCharacterData);
|
||||
/*
|
||||
* Comment represents a comment node in an xml document.
|
||||
*/
|
||||
cNokogiriXmlComment = rb_define_class_under(mNokogiriXml, "Comment", cNokogiriXmlCharacterData);
|
||||
|
||||
rb_define_singleton_method(cNokogiriXmlComment, "new", new, -1);
|
||||
|
||||
document_id = rb_intern("document");
|
||||
}
|
||||
@@ -0,0 +1,784 @@
|
||||
#include <nokogiri.h>
|
||||
|
||||
VALUE cNokogiriXmlDocument ;
|
||||
|
||||
static int
|
||||
dealloc_node_i2(xmlNodePtr key, xmlNodePtr node, xmlDocPtr doc)
|
||||
{
|
||||
switch (node->type) {
|
||||
case XML_ATTRIBUTE_NODE:
|
||||
xmlFreePropList((xmlAttrPtr)node);
|
||||
break;
|
||||
case XML_NAMESPACE_DECL:
|
||||
xmlFreeNs((xmlNsPtr)node);
|
||||
break;
|
||||
case XML_DTD_NODE:
|
||||
xmlFreeDtd((xmlDtdPtr)node);
|
||||
break;
|
||||
default:
|
||||
if (node->parent == NULL) {
|
||||
node->next = NULL;
|
||||
node->prev = NULL;
|
||||
xmlAddChild((xmlNodePtr)doc, node);
|
||||
}
|
||||
}
|
||||
return ST_CONTINUE;
|
||||
}
|
||||
|
||||
static int
|
||||
dealloc_node_i(st_data_t key, st_data_t node, st_data_t doc)
|
||||
{
|
||||
return dealloc_node_i2((xmlNodePtr)key, (xmlNodePtr)node, (xmlDocPtr)doc);
|
||||
}
|
||||
|
||||
static void
|
||||
remove_private(xmlNodePtr node)
|
||||
{
|
||||
xmlNodePtr child;
|
||||
|
||||
for (child = node->children; child; child = child->next) {
|
||||
remove_private(child);
|
||||
}
|
||||
|
||||
if ((node->type == XML_ELEMENT_NODE ||
|
||||
node->type == XML_XINCLUDE_START ||
|
||||
node->type == XML_XINCLUDE_END) &&
|
||||
node->properties) {
|
||||
for (child = (xmlNodePtr)node->properties; child; child = child->next) {
|
||||
remove_private(child);
|
||||
}
|
||||
}
|
||||
|
||||
node->_private = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
mark(void *data)
|
||||
{
|
||||
xmlDocPtr doc = (xmlDocPtr)data;
|
||||
nokogiriTuplePtr tuple = (nokogiriTuplePtr)doc->_private;
|
||||
if (tuple) {
|
||||
rb_gc_mark(tuple->doc);
|
||||
rb_gc_mark(tuple->node_cache);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dealloc(void *data)
|
||||
{
|
||||
xmlDocPtr doc = (xmlDocPtr)data;
|
||||
st_table *node_hash;
|
||||
|
||||
node_hash = DOC_UNLINKED_NODE_HASH(doc);
|
||||
|
||||
st_foreach(node_hash, dealloc_node_i, (st_data_t)doc);
|
||||
st_free_table(node_hash);
|
||||
|
||||
ruby_xfree(doc->_private);
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 5
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" // xmlDeregisterNodeDefault is deprecated as of libxml2 2.11.0
|
||||
#endif
|
||||
/*
|
||||
* libxml-ruby < 3.0.0 uses xmlDeregisterNodeDefault. If the user is using one of those older
|
||||
* versions, the registered callback from libxml-ruby will access the _private pointers set by
|
||||
* nokogiri, which will result in segfaults.
|
||||
*
|
||||
* To avoid this, we need to clear the _private pointers from all nodes in this document tree
|
||||
* before that callback gets invoked.
|
||||
*
|
||||
* libxml-ruby 3.0.0 was released in 2017-02, so at some point we can probably safely remove this
|
||||
* safeguard (though probably pairing with a runtime check on the libxml-ruby version).
|
||||
*/
|
||||
if (xmlDeregisterNodeDefaultValue) {
|
||||
remove_private((xmlNodePtr)doc);
|
||||
}
|
||||
#if defined(__GNUC__) && __GNUC__ >= 5
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
xmlFreeDoc(doc);
|
||||
}
|
||||
|
||||
static size_t
|
||||
memsize_node(const xmlNodePtr node)
|
||||
{
|
||||
/* note we don't count namespace definitions, just going for a good-enough number here */
|
||||
xmlNodePtr child;
|
||||
xmlAttrPtr property;
|
||||
size_t memsize = 0;
|
||||
|
||||
memsize += (size_t)xmlStrlen(node->name);
|
||||
|
||||
if (node->type == XML_ELEMENT_NODE) {
|
||||
for (property = node->properties; property; property = property->next) {
|
||||
memsize += sizeof(xmlAttr) + memsize_node((xmlNodePtr)property);
|
||||
}
|
||||
}
|
||||
if (node->type == XML_TEXT_NODE) {
|
||||
memsize += (size_t)xmlStrlen(node->content);
|
||||
}
|
||||
for (child = node->children; child; child = child->next) {
|
||||
memsize += sizeof(xmlNode) + memsize_node(child);
|
||||
}
|
||||
return memsize;
|
||||
}
|
||||
|
||||
static size_t
|
||||
memsize(const void *data)
|
||||
{
|
||||
xmlDocPtr doc = (const xmlDocPtr)data;
|
||||
size_t memsize = sizeof(xmlDoc);
|
||||
/* This may not account for all memory use */
|
||||
memsize += memsize_node((xmlNodePtr)doc);
|
||||
return memsize;
|
||||
}
|
||||
|
||||
static const rb_data_type_t xml_doc_type = {
|
||||
.wrap_struct_name = "xmlDoc",
|
||||
.function = {
|
||||
.dmark = mark,
|
||||
.dfree = dealloc,
|
||||
.dsize = memsize,
|
||||
},
|
||||
// .flags = RUBY_TYPED_FREE_IMMEDIATELY, // TODO see https://github.com/sparklemotion/nokogiri/issues/2822
|
||||
};
|
||||
|
||||
static VALUE
|
||||
_xml_document_alloc(VALUE klass)
|
||||
{
|
||||
return TypedData_Wrap_Struct(klass, &xml_doc_type, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_xml_document_data_ptr_set(VALUE rb_document, xmlDocPtr c_document)
|
||||
{
|
||||
nokogiriTuplePtr tuple;
|
||||
|
||||
assert(DATA_PTR(rb_document) == NULL);
|
||||
assert(c_document->_private == NULL);
|
||||
|
||||
DATA_PTR(rb_document) = c_document;
|
||||
|
||||
tuple = (nokogiriTuplePtr)ruby_xmalloc(sizeof(nokogiriTuple));
|
||||
tuple->doc = rb_document;
|
||||
tuple->unlinkedNodes = st_init_numtable_with_size(128);
|
||||
tuple->node_cache = rb_ary_new();
|
||||
|
||||
c_document->_private = tuple ;
|
||||
|
||||
rb_iv_set(rb_document, "@node_cache", tuple->node_cache);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* :nodoc: */
|
||||
static VALUE
|
||||
rb_xml_document_initialize_copy_with_args(VALUE rb_self, VALUE rb_other, VALUE rb_level)
|
||||
{
|
||||
xmlDocPtr c_other, c_self;
|
||||
int c_level;
|
||||
|
||||
c_other = noko_xml_document_unwrap(rb_other);
|
||||
c_level = (int)NUM2INT(rb_level);
|
||||
|
||||
c_self = xmlCopyDoc(c_other, c_level);
|
||||
if (c_self == NULL) { return Qnil; }
|
||||
|
||||
c_self->type = c_other->type;
|
||||
_xml_document_data_ptr_set(rb_self, c_self);
|
||||
|
||||
return rb_self ;
|
||||
}
|
||||
|
||||
static void
|
||||
recursively_remove_namespaces_from_node(xmlNodePtr node)
|
||||
{
|
||||
xmlNodePtr child ;
|
||||
xmlAttrPtr property ;
|
||||
|
||||
xmlSetNs(node, NULL);
|
||||
|
||||
for (child = node->children ; child ; child = child->next) {
|
||||
recursively_remove_namespaces_from_node(child);
|
||||
}
|
||||
|
||||
if (((node->type == XML_ELEMENT_NODE) ||
|
||||
(node->type == XML_XINCLUDE_START) ||
|
||||
(node->type == XML_XINCLUDE_END)) &&
|
||||
node->nsDef) {
|
||||
xmlNsPtr curr = node->nsDef;
|
||||
while (curr) {
|
||||
noko_xml_document_pin_namespace(curr, node->doc);
|
||||
curr = curr->next;
|
||||
}
|
||||
node->nsDef = NULL;
|
||||
}
|
||||
|
||||
if (node->type == XML_ELEMENT_NODE && node->properties != NULL) {
|
||||
property = node->properties ;
|
||||
while (property != NULL) {
|
||||
if (property->ns) { property->ns = NULL ; }
|
||||
property = property->next ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* url
|
||||
*
|
||||
* Get the url name for this document.
|
||||
*/
|
||||
static VALUE
|
||||
url(VALUE self)
|
||||
{
|
||||
xmlDocPtr doc = noko_xml_document_unwrap(self);
|
||||
|
||||
if (doc->URL) { return NOKOGIRI_STR_NEW2(doc->URL); }
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* root=
|
||||
*
|
||||
* Set the root element on this document
|
||||
*/
|
||||
static VALUE
|
||||
rb_xml_document_root_set(VALUE self, VALUE rb_new_root)
|
||||
{
|
||||
xmlDocPtr c_document;
|
||||
xmlNodePtr c_new_root = NULL, c_current_root;
|
||||
|
||||
c_document = noko_xml_document_unwrap(self);
|
||||
|
||||
c_current_root = xmlDocGetRootElement(c_document);
|
||||
if (c_current_root) {
|
||||
xmlUnlinkNode(c_current_root);
|
||||
noko_xml_document_pin_node(c_current_root);
|
||||
}
|
||||
|
||||
if (!NIL_P(rb_new_root)) {
|
||||
if (!rb_obj_is_kind_of(rb_new_root, cNokogiriXmlNode)) {
|
||||
rb_raise(rb_eArgError,
|
||||
"expected Nokogiri::XML::Node but received %"PRIsVALUE,
|
||||
rb_obj_class(rb_new_root));
|
||||
}
|
||||
|
||||
Noko_Node_Get_Struct(rb_new_root, xmlNode, c_new_root);
|
||||
|
||||
/* If the new root's document is not the same as the current document,
|
||||
* then we need to dup the node in to this document. */
|
||||
if (c_new_root->doc != c_document) {
|
||||
c_new_root = xmlDocCopyNode(c_new_root, c_document, 1);
|
||||
if (!c_new_root) {
|
||||
rb_raise(rb_eRuntimeError, "Could not reparent node (xmlDocCopyNode)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
xmlDocSetRootElement(c_document, c_new_root);
|
||||
|
||||
return rb_new_root;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* root
|
||||
*
|
||||
* Get the root node for this document.
|
||||
*/
|
||||
static VALUE
|
||||
rb_xml_document_root(VALUE self)
|
||||
{
|
||||
xmlDocPtr c_document;
|
||||
xmlNodePtr c_root;
|
||||
|
||||
c_document = noko_xml_document_unwrap(self);
|
||||
|
||||
c_root = xmlDocGetRootElement(c_document);
|
||||
if (!c_root) {
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
return noko_xml_node_wrap(Qnil, c_root) ;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* encoding= encoding
|
||||
*
|
||||
* Set the encoding string for this Document
|
||||
*/
|
||||
static VALUE
|
||||
set_encoding(VALUE self, VALUE encoding)
|
||||
{
|
||||
xmlDocPtr doc = noko_xml_document_unwrap(self);
|
||||
|
||||
if (doc->encoding) {
|
||||
xmlFree(DISCARD_CONST_QUAL_XMLCHAR(doc->encoding));
|
||||
}
|
||||
|
||||
doc->encoding = xmlStrdup((xmlChar *)StringValueCStr(encoding));
|
||||
|
||||
return encoding;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* encoding
|
||||
*
|
||||
* Get the encoding for this Document
|
||||
*/
|
||||
static VALUE
|
||||
encoding(VALUE self)
|
||||
{
|
||||
xmlDocPtr doc = noko_xml_document_unwrap(self);
|
||||
|
||||
if (!doc->encoding) { return Qnil; }
|
||||
return NOKOGIRI_STR_NEW2(doc->encoding);
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* version
|
||||
*
|
||||
* Get the XML version for this Document
|
||||
*/
|
||||
static VALUE
|
||||
version(VALUE self)
|
||||
{
|
||||
xmlDocPtr doc = noko_xml_document_unwrap(self);
|
||||
|
||||
if (!doc->version) { return Qnil; }
|
||||
return NOKOGIRI_STR_NEW2(doc->version);
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* read_io(io, url, encoding, options)
|
||||
*
|
||||
* Create a new document from an IO object
|
||||
*/
|
||||
static VALUE
|
||||
noko_xml_document_s_read_io(VALUE rb_class,
|
||||
VALUE rb_io,
|
||||
VALUE rb_url,
|
||||
VALUE rb_encoding,
|
||||
VALUE rb_options)
|
||||
{
|
||||
/* TODO: deprecate this method, parse should be the preferred entry point. then we can make this
|
||||
private. */
|
||||
libxmlStructuredErrorHandlerState handler_state;
|
||||
VALUE rb_errors = rb_ary_new();
|
||||
|
||||
noko__structured_error_func_save_and_set(&handler_state, (void *)rb_errors, noko__error_array_pusher);
|
||||
|
||||
const char *c_url = NIL_P(rb_url) ? NULL : StringValueCStr(rb_url);
|
||||
const char *c_enc = NIL_P(rb_encoding) ? NULL : StringValueCStr(rb_encoding);
|
||||
xmlDocPtr c_document = xmlReadIO(
|
||||
(xmlInputReadCallback)noko_io_read,
|
||||
(xmlInputCloseCallback)noko_io_close,
|
||||
(void *)rb_io,
|
||||
c_url,
|
||||
c_enc,
|
||||
(int)NUM2INT(rb_options)
|
||||
);
|
||||
|
||||
noko__structured_error_func_restore(&handler_state);
|
||||
|
||||
if (c_document == NULL) {
|
||||
xmlFreeDoc(c_document);
|
||||
|
||||
VALUE exception = rb_funcall(cNokogiriXmlSyntaxError, rb_intern("aggregate"), 1, rb_errors);
|
||||
if (RB_TEST(exception)) {
|
||||
rb_exc_raise(exception);
|
||||
} else {
|
||||
rb_raise(rb_eRuntimeError, "Could not parse document");
|
||||
}
|
||||
}
|
||||
|
||||
VALUE rb_document = noko_xml_document_wrap(rb_class, c_document);
|
||||
rb_iv_set(rb_document, "@errors", rb_errors);
|
||||
return rb_document;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* read_memory(string, url, encoding, options)
|
||||
*
|
||||
* Create a new document from a String
|
||||
*/
|
||||
static VALUE
|
||||
noko_xml_document_s_read_memory(VALUE rb_class,
|
||||
VALUE rb_input,
|
||||
VALUE rb_url,
|
||||
VALUE rb_encoding,
|
||||
VALUE rb_options)
|
||||
{
|
||||
/* TODO: deprecate this method, parse should be the preferred entry point. then we can make this
|
||||
private. */
|
||||
VALUE rb_errors = rb_ary_new();
|
||||
xmlSetStructuredErrorFunc((void *)rb_errors, noko__error_array_pusher);
|
||||
|
||||
const char *c_buffer = StringValuePtr(rb_input);
|
||||
const char *c_url = NIL_P(rb_url) ? NULL : StringValueCStr(rb_url);
|
||||
const char *c_enc = NIL_P(rb_encoding) ? NULL : StringValueCStr(rb_encoding);
|
||||
int c_buffer_len = (int)RSTRING_LEN(rb_input);
|
||||
xmlDocPtr c_document = xmlReadMemory(c_buffer, c_buffer_len, c_url, c_enc, (int)NUM2INT(rb_options));
|
||||
|
||||
xmlSetStructuredErrorFunc(NULL, NULL);
|
||||
|
||||
if (c_document == NULL) {
|
||||
VALUE exception = rb_funcall(cNokogiriXmlSyntaxError, rb_intern("aggregate"), 1, rb_errors);
|
||||
if (RB_TEST(exception)) {
|
||||
rb_exc_raise(exception);
|
||||
} else {
|
||||
rb_raise(rb_eRuntimeError, "Could not parse document");
|
||||
}
|
||||
}
|
||||
|
||||
VALUE document = noko_xml_document_wrap(rb_class, c_document);
|
||||
rb_iv_set(document, "@errors", rb_errors);
|
||||
return document;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* new(version = "1.0")
|
||||
*
|
||||
* Create a new empty document declaring XML version +version+.
|
||||
*/
|
||||
static VALUE
|
||||
new (int argc, VALUE *argv, VALUE klass)
|
||||
{
|
||||
xmlDocPtr doc;
|
||||
VALUE version, rest, rb_doc ;
|
||||
|
||||
rb_scan_args(argc, argv, "0*", &rest);
|
||||
version = rb_ary_entry(rest, (long)0);
|
||||
if (NIL_P(version)) { version = rb_str_new2("1.0"); }
|
||||
|
||||
doc = xmlNewDoc((xmlChar *)StringValueCStr(version));
|
||||
rb_doc = noko_xml_document_wrap_with_init_args(klass, doc, argc, argv);
|
||||
return rb_doc ;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* remove_namespaces!
|
||||
*
|
||||
* Remove all namespaces from all nodes in the document.
|
||||
*
|
||||
* This could be useful for developers who either don't understand namespaces
|
||||
* or don't care about them.
|
||||
*
|
||||
* The following example shows a use case, and you can decide for yourself
|
||||
* whether this is a good thing or not:
|
||||
*
|
||||
* doc = Nokogiri::XML <<-EOXML
|
||||
* <root>
|
||||
* <car xmlns:part="http://general-motors.com/">
|
||||
* <part:tire>Michelin Model XGV</part:tire>
|
||||
* </car>
|
||||
* <bicycle xmlns:part="http://schwinn.com/">
|
||||
* <part:tire>I'm a bicycle tire!</part:tire>
|
||||
* </bicycle>
|
||||
* </root>
|
||||
* EOXML
|
||||
*
|
||||
* doc.xpath("//tire").to_s # => ""
|
||||
* doc.xpath("//part:tire", "part" => "http://general-motors.com/").to_s # => "<part:tire>Michelin Model XGV</part:tire>"
|
||||
* doc.xpath("//part:tire", "part" => "http://schwinn.com/").to_s # => "<part:tire>I'm a bicycle tire!</part:tire>"
|
||||
*
|
||||
* doc.remove_namespaces!
|
||||
*
|
||||
* doc.xpath("//tire").to_s # => "<tire>Michelin Model XGV</tire><tire>I'm a bicycle tire!</tire>"
|
||||
* doc.xpath("//part:tire", "part" => "http://general-motors.com/").to_s # => ""
|
||||
* doc.xpath("//part:tire", "part" => "http://schwinn.com/").to_s # => ""
|
||||
*
|
||||
* For more information on why this probably is *not* a good thing in general,
|
||||
* please direct your browser to
|
||||
* http://tenderlovemaking.com/2009/04/23/namespaces-in-xml.html
|
||||
*/
|
||||
static VALUE
|
||||
remove_namespaces_bang(VALUE self)
|
||||
{
|
||||
xmlDocPtr doc = noko_xml_document_unwrap(self);
|
||||
|
||||
recursively_remove_namespaces_from_node((xmlNodePtr)doc);
|
||||
return self;
|
||||
}
|
||||
|
||||
/* call-seq:
|
||||
* doc.create_entity(name, type, external_id, system_id, content)
|
||||
*
|
||||
* Create a new entity named +name+.
|
||||
*
|
||||
* +type+ is an integer representing the type of entity to be created, and it defaults to
|
||||
* +Nokogiri::XML::EntityDecl::INTERNAL_GENERAL+. See the constants on Nokogiri::XML::EntityDecl for
|
||||
* more information.
|
||||
*
|
||||
* +external_id+, +system_id+, and +content+ set the External ID, System ID,
|
||||
* and content respectively. All of these parameters are optional.
|
||||
*/
|
||||
static VALUE
|
||||
noko_xml_document__create_entity(int argc, VALUE *argv, VALUE rb_document)
|
||||
{
|
||||
VALUE rb_name;
|
||||
VALUE rb_type;
|
||||
VALUE rb_ext_id;
|
||||
VALUE rb_sys_id;
|
||||
VALUE rb_content;
|
||||
|
||||
rb_scan_args(argc, argv, "14",
|
||||
&rb_name,
|
||||
&rb_type, &rb_ext_id, &rb_sys_id, &rb_content);
|
||||
|
||||
xmlDocPtr c_document = noko_xml_document_unwrap(rb_document);
|
||||
|
||||
libxmlStructuredErrorHandlerState handler_state;
|
||||
VALUE rb_errors = rb_ary_new();
|
||||
noko__structured_error_func_save_and_set(&handler_state, (void *)rb_errors, noko__error_array_pusher);
|
||||
|
||||
xmlEntityPtr c_entity = xmlAddDocEntity(
|
||||
c_document,
|
||||
(xmlChar *)(NIL_P(rb_name) ? NULL : StringValueCStr(rb_name)),
|
||||
(int)(NIL_P(rb_type) ? XML_INTERNAL_GENERAL_ENTITY : NUM2INT(rb_type)),
|
||||
(xmlChar *)(NIL_P(rb_ext_id) ? NULL : StringValueCStr(rb_ext_id)),
|
||||
(xmlChar *)(NIL_P(rb_sys_id) ? NULL : StringValueCStr(rb_sys_id)),
|
||||
(xmlChar *)(NIL_P(rb_content) ? NULL : StringValueCStr(rb_content))
|
||||
);
|
||||
|
||||
noko__structured_error_func_restore(&handler_state);
|
||||
|
||||
if (NULL == c_entity) {
|
||||
VALUE exception = rb_funcall(cNokogiriXmlSyntaxError, rb_intern("aggregate"), 1, rb_errors);
|
||||
if (RB_TEST(exception)) {
|
||||
rb_exc_raise(exception);
|
||||
} else {
|
||||
rb_raise(rb_eRuntimeError, "Could not create entity");
|
||||
}
|
||||
}
|
||||
|
||||
return noko_xml_node_wrap(cNokogiriXmlEntityDecl, (xmlNodePtr)c_entity);
|
||||
}
|
||||
|
||||
static int
|
||||
block_caller(void *ctx, xmlNodePtr c_node, xmlNodePtr c_parent_node)
|
||||
{
|
||||
VALUE block = (VALUE)ctx;
|
||||
VALUE rb_node;
|
||||
VALUE rb_parent_node;
|
||||
VALUE ret;
|
||||
|
||||
if (c_node->type == XML_NAMESPACE_DECL) {
|
||||
rb_node = noko_xml_namespace_wrap((xmlNsPtr)c_node, c_parent_node->doc);
|
||||
} else {
|
||||
rb_node = noko_xml_node_wrap(Qnil, c_node);
|
||||
}
|
||||
rb_parent_node = c_parent_node ? noko_xml_node_wrap(Qnil, c_parent_node) : Qnil;
|
||||
|
||||
ret = rb_funcall(block, rb_intern("call"), 2, rb_node, rb_parent_node);
|
||||
|
||||
return (Qfalse == ret || Qnil == ret) ? 0 : 1;
|
||||
}
|
||||
|
||||
/* call-seq:
|
||||
* doc.canonicalize(mode=XML_C14N_1_0,inclusive_namespaces=nil,with_comments=false)
|
||||
* doc.canonicalize { |obj, parent| ... }
|
||||
*
|
||||
* Canonicalize a document and return the results. Takes an optional block
|
||||
* that takes two parameters: the +obj+ and that node's +parent+.
|
||||
* The +obj+ will be either a Nokogiri::XML::Node, or a Nokogiri::XML::Namespace
|
||||
* The block must return a non-nil, non-false value if the +obj+ passed in
|
||||
* should be included in the canonicalized document.
|
||||
*/
|
||||
static VALUE
|
||||
rb_xml_document_canonicalize(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE rb_mode;
|
||||
VALUE rb_namespaces;
|
||||
VALUE rb_comments_p;
|
||||
int c_mode = 0;
|
||||
xmlChar **c_namespaces;
|
||||
|
||||
xmlDocPtr c_doc;
|
||||
xmlOutputBufferPtr c_obuf;
|
||||
xmlC14NIsVisibleCallback c_callback_wrapper = NULL;
|
||||
void *rb_callback = NULL;
|
||||
|
||||
VALUE rb_cStringIO;
|
||||
VALUE rb_io;
|
||||
|
||||
rb_scan_args(argc, argv, "03", &rb_mode, &rb_namespaces, &rb_comments_p);
|
||||
if (!NIL_P(rb_mode)) {
|
||||
Check_Type(rb_mode, T_FIXNUM);
|
||||
c_mode = NUM2INT(rb_mode);
|
||||
}
|
||||
if (!NIL_P(rb_namespaces)) {
|
||||
Check_Type(rb_namespaces, T_ARRAY);
|
||||
if (c_mode == XML_C14N_1_0 || c_mode == XML_C14N_1_1) {
|
||||
rb_raise(rb_eRuntimeError, "This canonicalizer does not support this operation");
|
||||
}
|
||||
}
|
||||
|
||||
c_doc = noko_xml_document_unwrap(self);
|
||||
|
||||
rb_cStringIO = rb_const_get_at(rb_cObject, rb_intern("StringIO"));
|
||||
rb_io = rb_class_new_instance(0, 0, rb_cStringIO);
|
||||
c_obuf = xmlAllocOutputBuffer(NULL);
|
||||
|
||||
c_obuf->writecallback = (xmlOutputWriteCallback)noko_io_write;
|
||||
c_obuf->closecallback = (xmlOutputCloseCallback)noko_io_close;
|
||||
c_obuf->context = (void *)rb_io;
|
||||
|
||||
if (rb_block_given_p()) {
|
||||
c_callback_wrapper = block_caller;
|
||||
rb_callback = (void *)rb_block_proc();
|
||||
}
|
||||
|
||||
if (NIL_P(rb_namespaces)) {
|
||||
c_namespaces = NULL;
|
||||
} else {
|
||||
long ns_len = RARRAY_LEN(rb_namespaces);
|
||||
c_namespaces = ruby_xcalloc((size_t)ns_len + 1, sizeof(xmlChar *));
|
||||
for (int j = 0 ; j < ns_len ; j++) {
|
||||
VALUE entry = rb_ary_entry(rb_namespaces, j);
|
||||
c_namespaces[j] = (xmlChar *)StringValueCStr(entry);
|
||||
}
|
||||
}
|
||||
|
||||
xmlC14NExecute(c_doc, c_callback_wrapper, rb_callback,
|
||||
c_mode,
|
||||
c_namespaces,
|
||||
(int)RTEST(rb_comments_p),
|
||||
c_obuf);
|
||||
|
||||
ruby_xfree(c_namespaces);
|
||||
xmlOutputBufferClose(c_obuf);
|
||||
|
||||
return rb_funcall(rb_io, rb_intern("string"), 0);
|
||||
}
|
||||
|
||||
VALUE
|
||||
noko_xml_document_wrap_with_init_args(VALUE klass, xmlDocPtr c_document, int argc, VALUE *argv)
|
||||
{
|
||||
VALUE rb_document;
|
||||
|
||||
if (!klass) {
|
||||
klass = cNokogiriXmlDocument;
|
||||
}
|
||||
|
||||
rb_document = _xml_document_alloc(klass);
|
||||
_xml_document_data_ptr_set(rb_document, c_document);
|
||||
|
||||
rb_iv_set(rb_document, "@decorators", Qnil);
|
||||
rb_iv_set(rb_document, "@errors", Qnil);
|
||||
|
||||
rb_obj_call_init(rb_document, argc, argv);
|
||||
|
||||
return rb_document ;
|
||||
}
|
||||
|
||||
|
||||
/* deprecated. use noko_xml_document_wrap() instead. */
|
||||
VALUE
|
||||
Nokogiri_wrap_xml_document(VALUE klass, xmlDocPtr doc)
|
||||
{
|
||||
/* TODO: deprecate this method in v2.0 */
|
||||
return noko_xml_document_wrap_with_init_args(klass, doc, 0, NULL);
|
||||
}
|
||||
|
||||
VALUE
|
||||
noko_xml_document_wrap(VALUE klass, xmlDocPtr doc)
|
||||
{
|
||||
return noko_xml_document_wrap_with_init_args(klass, doc, 0, NULL);
|
||||
}
|
||||
|
||||
xmlDocPtr
|
||||
noko_xml_document_unwrap(VALUE rb_document)
|
||||
{
|
||||
xmlDocPtr c_document;
|
||||
TypedData_Get_Struct(rb_document, xmlDoc, &xml_doc_type, c_document);
|
||||
return c_document;
|
||||
}
|
||||
|
||||
/* Schema creation will remove and deallocate "blank" nodes.
|
||||
* If those blank nodes have been exposed to Ruby, they could get freed
|
||||
* out from under the VALUE pointer. This function checks to see if any of
|
||||
* those nodes have been exposed to Ruby, and if so we should raise an exception.
|
||||
*/
|
||||
int
|
||||
noko_xml_document_has_wrapped_blank_nodes_p(xmlDocPtr c_document)
|
||||
{
|
||||
VALUE cache = DOC_NODE_CACHE(c_document);
|
||||
|
||||
if (NIL_P(cache)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (long jnode = 0; jnode < RARRAY_LEN(cache); jnode++) {
|
||||
xmlNodePtr node;
|
||||
VALUE element = rb_ary_entry(cache, jnode);
|
||||
|
||||
Noko_Node_Get_Struct(element, xmlNode, node);
|
||||
if (xmlIsBlankNode(node)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
noko_xml_document_pin_node(xmlNodePtr node)
|
||||
{
|
||||
xmlDocPtr doc;
|
||||
nokogiriTuplePtr tuple;
|
||||
|
||||
doc = node->doc;
|
||||
tuple = (nokogiriTuplePtr)doc->_private;
|
||||
st_insert(tuple->unlinkedNodes, (st_data_t)node, (st_data_t)node);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
noko_xml_document_pin_namespace(xmlNsPtr ns, xmlDocPtr doc)
|
||||
{
|
||||
nokogiriTuplePtr tuple;
|
||||
|
||||
tuple = (nokogiriTuplePtr)doc->_private;
|
||||
st_insert(tuple->unlinkedNodes, (st_data_t)ns, (st_data_t)ns);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
noko_init_xml_document(void)
|
||||
{
|
||||
assert(cNokogiriXmlNode);
|
||||
|
||||
cNokogiriXmlDocument = rb_define_class_under(mNokogiriXml, "Document", cNokogiriXmlNode);
|
||||
|
||||
rb_define_alloc_func(cNokogiriXmlDocument, _xml_document_alloc);
|
||||
|
||||
rb_define_singleton_method(cNokogiriXmlDocument, "read_memory", noko_xml_document_s_read_memory, 4);
|
||||
rb_define_singleton_method(cNokogiriXmlDocument, "read_io", noko_xml_document_s_read_io, 4);
|
||||
rb_define_singleton_method(cNokogiriXmlDocument, "new", new, -1);
|
||||
|
||||
rb_define_method(cNokogiriXmlDocument, "root", rb_xml_document_root, 0);
|
||||
rb_define_method(cNokogiriXmlDocument, "root=", rb_xml_document_root_set, 1);
|
||||
rb_define_method(cNokogiriXmlDocument, "encoding", encoding, 0);
|
||||
rb_define_method(cNokogiriXmlDocument, "encoding=", set_encoding, 1);
|
||||
rb_define_method(cNokogiriXmlDocument, "version", version, 0);
|
||||
rb_define_method(cNokogiriXmlDocument, "canonicalize", rb_xml_document_canonicalize, -1);
|
||||
rb_define_method(cNokogiriXmlDocument, "url", url, 0);
|
||||
rb_define_method(cNokogiriXmlDocument, "create_entity", noko_xml_document__create_entity, -1);
|
||||
rb_define_method(cNokogiriXmlDocument, "remove_namespaces!", remove_namespaces_bang, 0);
|
||||
|
||||
rb_define_protected_method(cNokogiriXmlDocument, "initialize_copy_with_args", rb_xml_document_initialize_copy_with_args,
|
||||
2);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
#include <nokogiri.h>
|
||||
|
||||
VALUE cNokogiriXmlDocumentFragment;
|
||||
|
||||
/* :nodoc: */
|
||||
static VALUE
|
||||
noko_xml_document_fragment_s_native_new(VALUE klass, VALUE rb_doc)
|
||||
{
|
||||
xmlDocPtr c_doc;
|
||||
xmlNodePtr c_node;
|
||||
VALUE rb_node;
|
||||
|
||||
c_doc = noko_xml_document_unwrap(rb_doc);
|
||||
c_node = xmlNewDocFragment(c_doc->doc);
|
||||
noko_xml_document_pin_node(c_node);
|
||||
rb_node = noko_xml_node_wrap(klass, c_node);
|
||||
|
||||
return rb_node;
|
||||
}
|
||||
|
||||
void
|
||||
noko_init_xml_document_fragment(void)
|
||||
{
|
||||
assert(cNokogiriXmlNode);
|
||||
|
||||
cNokogiriXmlDocumentFragment = rb_define_class_under(mNokogiriXml, "DocumentFragment", cNokogiriXmlNode);
|
||||
|
||||
rb_define_singleton_method(cNokogiriXmlDocumentFragment, "native_new", noko_xml_document_fragment_s_native_new, 1);
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
#include <nokogiri.h>
|
||||
|
||||
VALUE cNokogiriXmlDtd;
|
||||
|
||||
static void
|
||||
notation_copier(void *c_notation_ptr, void *rb_hash_ptr, const xmlChar *name)
|
||||
{
|
||||
VALUE rb_hash = (VALUE)rb_hash_ptr;
|
||||
xmlNotationPtr c_notation = (xmlNotationPtr)c_notation_ptr;
|
||||
VALUE rb_notation;
|
||||
VALUE cNokogiriXmlNotation;
|
||||
VALUE rb_constructor_args[3];
|
||||
|
||||
rb_constructor_args[0] = (c_notation->name ? NOKOGIRI_STR_NEW2(c_notation->name) : Qnil);
|
||||
rb_constructor_args[1] = (c_notation->PublicID ? NOKOGIRI_STR_NEW2(c_notation->PublicID) : Qnil);
|
||||
rb_constructor_args[2] = (c_notation->SystemID ? NOKOGIRI_STR_NEW2(c_notation->SystemID) : Qnil);
|
||||
|
||||
cNokogiriXmlNotation = rb_const_get_at(mNokogiriXml, rb_intern("Notation"));
|
||||
rb_notation = rb_class_new_instance(3, rb_constructor_args, cNokogiriXmlNotation);
|
||||
|
||||
rb_hash_aset(rb_hash, NOKOGIRI_STR_NEW2(name), rb_notation);
|
||||
}
|
||||
|
||||
static void
|
||||
element_copier(void *c_node_ptr, void *rb_hash_ptr, const xmlChar *c_name)
|
||||
{
|
||||
VALUE rb_hash = (VALUE)rb_hash_ptr;
|
||||
xmlNodePtr c_node = (xmlNodePtr)c_node_ptr;
|
||||
|
||||
VALUE rb_node = noko_xml_node_wrap(Qnil, c_node);
|
||||
|
||||
rb_hash_aset(rb_hash, NOKOGIRI_STR_NEW2(c_name), rb_node);
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* entities
|
||||
*
|
||||
* Get a hash of the elements for this DTD.
|
||||
*/
|
||||
static VALUE
|
||||
entities(VALUE self)
|
||||
{
|
||||
xmlDtdPtr dtd;
|
||||
VALUE hash;
|
||||
|
||||
Noko_Node_Get_Struct(self, xmlDtd, dtd);
|
||||
|
||||
if (!dtd->entities) { return Qnil; }
|
||||
|
||||
hash = rb_hash_new();
|
||||
|
||||
xmlHashScan((xmlHashTablePtr)dtd->entities, element_copier, (void *)hash);
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* notations() → Hash<name(String)⇒Notation>
|
||||
*
|
||||
* [Returns] All the notations for this DTD in a Hash of Notation +name+ to Notation.
|
||||
*/
|
||||
static VALUE
|
||||
notations(VALUE self)
|
||||
{
|
||||
xmlDtdPtr dtd;
|
||||
VALUE hash;
|
||||
|
||||
Noko_Node_Get_Struct(self, xmlDtd, dtd);
|
||||
|
||||
if (!dtd->notations) { return Qnil; }
|
||||
|
||||
hash = rb_hash_new();
|
||||
|
||||
xmlHashScan((xmlHashTablePtr)dtd->notations, notation_copier, (void *)hash);
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* attributes
|
||||
*
|
||||
* Get a hash of the attributes for this DTD.
|
||||
*/
|
||||
static VALUE
|
||||
attributes(VALUE self)
|
||||
{
|
||||
xmlDtdPtr dtd;
|
||||
VALUE hash;
|
||||
|
||||
Noko_Node_Get_Struct(self, xmlDtd, dtd);
|
||||
|
||||
hash = rb_hash_new();
|
||||
|
||||
if (!dtd->attributes) { return hash; }
|
||||
|
||||
xmlHashScan((xmlHashTablePtr)dtd->attributes, element_copier, (void *)hash);
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* elements
|
||||
*
|
||||
* Get a hash of the elements for this DTD.
|
||||
*/
|
||||
static VALUE
|
||||
elements(VALUE self)
|
||||
{
|
||||
xmlDtdPtr dtd;
|
||||
VALUE hash;
|
||||
|
||||
Noko_Node_Get_Struct(self, xmlDtd, dtd);
|
||||
|
||||
if (!dtd->elements) { return Qnil; }
|
||||
|
||||
hash = rb_hash_new();
|
||||
|
||||
xmlHashScan((xmlHashTablePtr)dtd->elements, element_copier, (void *)hash);
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* validate(document)
|
||||
*
|
||||
* Validate +document+ returning a list of errors
|
||||
*/
|
||||
static VALUE
|
||||
validate(VALUE self, VALUE document)
|
||||
{
|
||||
xmlDocPtr doc;
|
||||
xmlDtdPtr dtd;
|
||||
xmlValidCtxtPtr ctxt;
|
||||
VALUE error_list;
|
||||
|
||||
Noko_Node_Get_Struct(self, xmlDtd, dtd);
|
||||
doc = noko_xml_document_unwrap(document);
|
||||
error_list = rb_ary_new();
|
||||
|
||||
ctxt = xmlNewValidCtxt();
|
||||
|
||||
xmlSetStructuredErrorFunc((void *)error_list, noko__error_array_pusher);
|
||||
|
||||
xmlValidateDtd(ctxt, doc, dtd);
|
||||
|
||||
xmlSetStructuredErrorFunc(NULL, NULL);
|
||||
|
||||
xmlFreeValidCtxt(ctxt);
|
||||
|
||||
return error_list;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* system_id
|
||||
*
|
||||
* Get the System ID for this DTD
|
||||
*/
|
||||
static VALUE
|
||||
system_id(VALUE self)
|
||||
{
|
||||
xmlDtdPtr dtd;
|
||||
Noko_Node_Get_Struct(self, xmlDtd, dtd);
|
||||
|
||||
if (!dtd->SystemID) { return Qnil; }
|
||||
|
||||
return NOKOGIRI_STR_NEW2(dtd->SystemID);
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* external_id
|
||||
*
|
||||
* Get the External ID for this DTD
|
||||
*/
|
||||
static VALUE
|
||||
external_id(VALUE self)
|
||||
{
|
||||
xmlDtdPtr dtd;
|
||||
Noko_Node_Get_Struct(self, xmlDtd, dtd);
|
||||
|
||||
if (!dtd->ExternalID) { return Qnil; }
|
||||
|
||||
return NOKOGIRI_STR_NEW2(dtd->ExternalID);
|
||||
}
|
||||
|
||||
void
|
||||
noko_init_xml_dtd(void)
|
||||
{
|
||||
assert(cNokogiriXmlNode);
|
||||
/*
|
||||
* Nokogiri::XML::DTD wraps DTD nodes in an XML document
|
||||
*/
|
||||
cNokogiriXmlDtd = rb_define_class_under(mNokogiriXml, "DTD", cNokogiriXmlNode);
|
||||
|
||||
rb_define_method(cNokogiriXmlDtd, "notations", notations, 0);
|
||||
rb_define_method(cNokogiriXmlDtd, "elements", elements, 0);
|
||||
rb_define_method(cNokogiriXmlDtd, "entities", entities, 0);
|
||||
rb_define_method(cNokogiriXmlDtd, "validate", validate, 1);
|
||||
rb_define_method(cNokogiriXmlDtd, "attributes", attributes, 0);
|
||||
rb_define_method(cNokogiriXmlDtd, "system_id", system_id, 0);
|
||||
rb_define_method(cNokogiriXmlDtd, "external_id", external_id, 0);
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
#include <nokogiri.h>
|
||||
|
||||
VALUE cNokogiriXmlElementContent;
|
||||
|
||||
static const rb_data_type_t xml_element_content_type = {
|
||||
.wrap_struct_name = "xmlElementContent",
|
||||
.flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
|
||||
};
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* name → String
|
||||
*
|
||||
* [Returns] The content element's +name+
|
||||
*/
|
||||
static VALUE
|
||||
get_name(VALUE self)
|
||||
{
|
||||
xmlElementContentPtr elem;
|
||||
TypedData_Get_Struct(self, xmlElementContent, &xml_element_content_type, elem);
|
||||
|
||||
if (!elem->name) { return Qnil; }
|
||||
return NOKOGIRI_STR_NEW2(elem->name);
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* type → Integer
|
||||
*
|
||||
* [Returns] The content element's +type+. Possible values are +PCDATA+, +ELEMENT+, +SEQ+, or +OR+.
|
||||
*/
|
||||
static VALUE
|
||||
get_type(VALUE self)
|
||||
{
|
||||
xmlElementContentPtr elem;
|
||||
TypedData_Get_Struct(self, xmlElementContent, &xml_element_content_type, elem);
|
||||
|
||||
return INT2NUM(elem->type);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the first child.
|
||||
*/
|
||||
static VALUE
|
||||
get_c1(VALUE self)
|
||||
{
|
||||
xmlElementContentPtr elem;
|
||||
TypedData_Get_Struct(self, xmlElementContent, &xml_element_content_type, elem);
|
||||
|
||||
if (!elem->c1) { return Qnil; }
|
||||
return noko_xml_element_content_wrap(rb_iv_get(self, "@document"), elem->c1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the second child.
|
||||
*/
|
||||
static VALUE
|
||||
get_c2(VALUE self)
|
||||
{
|
||||
xmlElementContentPtr elem;
|
||||
TypedData_Get_Struct(self, xmlElementContent, &xml_element_content_type, elem);
|
||||
|
||||
if (!elem->c2) { return Qnil; }
|
||||
return noko_xml_element_content_wrap(rb_iv_get(self, "@document"), elem->c2);
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* occur → Integer
|
||||
*
|
||||
* [Returns] The content element's +occur+ flag. Possible values are +ONCE+, +OPT+, +MULT+ or +PLUS+.
|
||||
*/
|
||||
static VALUE
|
||||
get_occur(VALUE self)
|
||||
{
|
||||
xmlElementContentPtr elem;
|
||||
TypedData_Get_Struct(self, xmlElementContent, &xml_element_content_type, elem);
|
||||
|
||||
return INT2NUM(elem->ocur);
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* prefix → String
|
||||
*
|
||||
* [Returns] The content element's namespace +prefix+.
|
||||
*/
|
||||
static VALUE
|
||||
get_prefix(VALUE self)
|
||||
{
|
||||
xmlElementContentPtr elem;
|
||||
TypedData_Get_Struct(self, xmlElementContent, &xml_element_content_type, elem);
|
||||
|
||||
if (!elem->prefix) { return Qnil; }
|
||||
|
||||
return NOKOGIRI_STR_NEW2(elem->prefix);
|
||||
}
|
||||
|
||||
/*
|
||||
* create a Nokogiri::XML::ElementContent object around an +element+.
|
||||
*/
|
||||
VALUE
|
||||
noko_xml_element_content_wrap(VALUE rb_document, xmlElementContentPtr c_element_content)
|
||||
{
|
||||
VALUE elem = TypedData_Wrap_Struct(
|
||||
cNokogiriXmlElementContent,
|
||||
&xml_element_content_type,
|
||||
c_element_content
|
||||
);
|
||||
|
||||
/* keep a handle on the document for GC marking */
|
||||
rb_iv_set(elem, "@document", rb_document);
|
||||
|
||||
return elem;
|
||||
}
|
||||
|
||||
void
|
||||
noko_init_xml_element_content(void)
|
||||
{
|
||||
cNokogiriXmlElementContent = rb_define_class_under(mNokogiriXml, "ElementContent", rb_cObject);
|
||||
|
||||
rb_undef_alloc_func(cNokogiriXmlElementContent);
|
||||
|
||||
rb_define_method(cNokogiriXmlElementContent, "name", get_name, 0);
|
||||
rb_define_method(cNokogiriXmlElementContent, "type", get_type, 0);
|
||||
rb_define_method(cNokogiriXmlElementContent, "occur", get_occur, 0);
|
||||
rb_define_method(cNokogiriXmlElementContent, "prefix", get_prefix, 0);
|
||||
|
||||
rb_define_private_method(cNokogiriXmlElementContent, "c1", get_c1, 0);
|
||||
rb_define_private_method(cNokogiriXmlElementContent, "c2", get_c2, 0);
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
#include <nokogiri.h>
|
||||
|
||||
VALUE cNokogiriXmlElementDecl;
|
||||
|
||||
static ID id_document;
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* element_type → Integer
|
||||
*
|
||||
* The element_type
|
||||
*/
|
||||
static VALUE
|
||||
element_type(VALUE self)
|
||||
{
|
||||
xmlElementPtr node;
|
||||
Noko_Node_Get_Struct(self, xmlElement, node);
|
||||
return INT2NUM(node->etype);
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* content → Nokogiri::XML::ElementContent
|
||||
*
|
||||
* [Returns] The root of this element declaration's content tree.
|
||||
*/
|
||||
static VALUE
|
||||
content(VALUE self)
|
||||
{
|
||||
xmlElementPtr node;
|
||||
Noko_Node_Get_Struct(self, xmlElement, node);
|
||||
|
||||
if (!node->content) { return Qnil; }
|
||||
|
||||
return noko_xml_element_content_wrap(
|
||||
rb_funcall(self, id_document, 0),
|
||||
node->content
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* prefix → String
|
||||
*
|
||||
* [Returns] The namespace +prefix+ for this element declaration.
|
||||
*/
|
||||
static VALUE
|
||||
prefix(VALUE self)
|
||||
{
|
||||
xmlElementPtr node;
|
||||
Noko_Node_Get_Struct(self, xmlElement, node);
|
||||
|
||||
if (!node->prefix) { return Qnil; }
|
||||
|
||||
return NOKOGIRI_STR_NEW2(node->prefix);
|
||||
}
|
||||
|
||||
void
|
||||
noko_init_xml_element_decl(void)
|
||||
{
|
||||
assert(cNokogiriXmlNode);
|
||||
cNokogiriXmlElementDecl = rb_define_class_under(mNokogiriXml, "ElementDecl", cNokogiriXmlNode);
|
||||
|
||||
rb_define_method(cNokogiriXmlElementDecl, "element_type", element_type, 0);
|
||||
rb_define_method(cNokogiriXmlElementDecl, "content", content, 0);
|
||||
rb_define_method(cNokogiriXmlElementDecl, "prefix", prefix, 0);
|
||||
|
||||
id_document = rb_intern("document");
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
#include <nokogiri.h>
|
||||
|
||||
VALUE cNokogiriEncodingHandler;
|
||||
|
||||
static void
|
||||
xml_encoding_handler_dealloc(void *data)
|
||||
{
|
||||
/* make sure iconv handlers are cleaned up and freed */
|
||||
xmlCharEncodingHandlerPtr c_handler = data;
|
||||
xmlCharEncCloseFunc(c_handler);
|
||||
}
|
||||
|
||||
static const rb_data_type_t xml_char_encoding_handler_type = {
|
||||
.wrap_struct_name = "xmlCharEncodingHandler",
|
||||
.function = {
|
||||
.dfree = xml_encoding_handler_dealloc,
|
||||
},
|
||||
.flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* call-seq: Nokogiri::EncodingHandler.[](name)
|
||||
*
|
||||
* Get the encoding handler for +name+
|
||||
*/
|
||||
static VALUE
|
||||
rb_xml_encoding_handler_s_get(VALUE klass, VALUE key)
|
||||
{
|
||||
xmlCharEncodingHandlerPtr handler;
|
||||
|
||||
handler = xmlFindCharEncodingHandler(StringValueCStr(key));
|
||||
if (handler) {
|
||||
return TypedData_Wrap_Struct(klass, &xml_char_encoding_handler_type, handler);
|
||||
}
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* call-seq: Nokogiri::EncodingHandler.delete(name)
|
||||
*
|
||||
* Delete the encoding alias named +name+
|
||||
*/
|
||||
static VALUE
|
||||
rb_xml_encoding_handler_s_delete(VALUE klass, VALUE name)
|
||||
{
|
||||
if (xmlDelEncodingAlias(StringValueCStr(name))) { return Qnil; }
|
||||
|
||||
return Qtrue;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* call-seq: Nokogiri::EncodingHandler.alias(real_name, alias_name)
|
||||
*
|
||||
* Alias encoding handler with name +real_name+ to name +alias_name+
|
||||
*/
|
||||
static VALUE
|
||||
rb_xml_encoding_handler_s_alias(VALUE klass, VALUE from, VALUE to)
|
||||
{
|
||||
xmlAddEncodingAlias(StringValueCStr(from), StringValueCStr(to));
|
||||
|
||||
return to;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* call-seq: Nokogiri::EncodingHandler.clear_aliases!
|
||||
*
|
||||
* Remove all encoding aliases.
|
||||
*/
|
||||
static VALUE
|
||||
rb_xml_encoding_handler_s_clear_aliases(VALUE klass)
|
||||
{
|
||||
xmlCleanupEncodingAliases();
|
||||
|
||||
return klass;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* call-seq: name
|
||||
*
|
||||
* Get the name of this EncodingHandler
|
||||
*/
|
||||
static VALUE
|
||||
rb_xml_encoding_handler_name(VALUE self)
|
||||
{
|
||||
xmlCharEncodingHandlerPtr handler;
|
||||
|
||||
TypedData_Get_Struct(self, xmlCharEncodingHandler, &xml_char_encoding_handler_type, handler);
|
||||
|
||||
return NOKOGIRI_STR_NEW2(handler->name);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
noko_init_xml_encoding_handler(void)
|
||||
{
|
||||
cNokogiriEncodingHandler = rb_define_class_under(mNokogiri, "EncodingHandler", rb_cObject);
|
||||
|
||||
rb_undef_alloc_func(cNokogiriEncodingHandler);
|
||||
|
||||
rb_define_singleton_method(cNokogiriEncodingHandler, "[]", rb_xml_encoding_handler_s_get, 1);
|
||||
rb_define_singleton_method(cNokogiriEncodingHandler, "delete", rb_xml_encoding_handler_s_delete, 1);
|
||||
rb_define_singleton_method(cNokogiriEncodingHandler, "alias", rb_xml_encoding_handler_s_alias, 2);
|
||||
rb_define_singleton_method(cNokogiriEncodingHandler, "clear_aliases!", rb_xml_encoding_handler_s_clear_aliases, 0);
|
||||
|
||||
rb_define_method(cNokogiriEncodingHandler, "name", rb_xml_encoding_handler_name, 0);
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
#include <nokogiri.h>
|
||||
|
||||
VALUE cNokogiriXmlEntityDecl;
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* original_content
|
||||
*
|
||||
* Get the original_content before ref substitution
|
||||
*/
|
||||
static VALUE
|
||||
original_content(VALUE self)
|
||||
{
|
||||
xmlEntityPtr node;
|
||||
Noko_Node_Get_Struct(self, xmlEntity, node);
|
||||
|
||||
if (!node->orig) { return Qnil; }
|
||||
|
||||
return NOKOGIRI_STR_NEW2(node->orig);
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* content
|
||||
*
|
||||
* Get the content
|
||||
*/
|
||||
static VALUE
|
||||
get_content(VALUE self)
|
||||
{
|
||||
xmlEntityPtr node;
|
||||
Noko_Node_Get_Struct(self, xmlEntity, node);
|
||||
|
||||
if (!node->content) { return Qnil; }
|
||||
|
||||
return NOKOGIRI_STR_NEW(node->content, node->length);
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* entity_type
|
||||
*
|
||||
* Get the entity type
|
||||
*/
|
||||
static VALUE
|
||||
entity_type(VALUE self)
|
||||
{
|
||||
xmlEntityPtr node;
|
||||
Noko_Node_Get_Struct(self, xmlEntity, node);
|
||||
|
||||
return INT2NUM((int)node->etype);
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* external_id
|
||||
*
|
||||
* Get the external identifier for PUBLIC
|
||||
*/
|
||||
static VALUE
|
||||
external_id(VALUE self)
|
||||
{
|
||||
xmlEntityPtr node;
|
||||
Noko_Node_Get_Struct(self, xmlEntity, node);
|
||||
|
||||
if (!node->ExternalID) { return Qnil; }
|
||||
|
||||
return NOKOGIRI_STR_NEW2(node->ExternalID);
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* system_id
|
||||
*
|
||||
* Get the URI for a SYSTEM or PUBLIC Entity
|
||||
*/
|
||||
static VALUE
|
||||
system_id(VALUE self)
|
||||
{
|
||||
xmlEntityPtr node;
|
||||
Noko_Node_Get_Struct(self, xmlEntity, node);
|
||||
|
||||
if (!node->SystemID) { return Qnil; }
|
||||
|
||||
return NOKOGIRI_STR_NEW2(node->SystemID);
|
||||
}
|
||||
|
||||
void
|
||||
noko_init_xml_entity_decl(void)
|
||||
{
|
||||
assert(cNokogiriXmlNode);
|
||||
cNokogiriXmlEntityDecl = rb_define_class_under(mNokogiriXml, "EntityDecl", cNokogiriXmlNode);
|
||||
|
||||
rb_define_method(cNokogiriXmlEntityDecl, "original_content", original_content, 0);
|
||||
rb_define_method(cNokogiriXmlEntityDecl, "content", get_content, 0);
|
||||
rb_define_method(cNokogiriXmlEntityDecl, "entity_type", entity_type, 0);
|
||||
rb_define_method(cNokogiriXmlEntityDecl, "external_id", external_id, 0);
|
||||
rb_define_method(cNokogiriXmlEntityDecl, "system_id", system_id, 0);
|
||||
|
||||
rb_const_set(cNokogiriXmlEntityDecl, rb_intern("INTERNAL_GENERAL"),
|
||||
INT2NUM(XML_INTERNAL_GENERAL_ENTITY));
|
||||
rb_const_set(cNokogiriXmlEntityDecl, rb_intern("EXTERNAL_GENERAL_PARSED"),
|
||||
INT2NUM(XML_EXTERNAL_GENERAL_PARSED_ENTITY));
|
||||
rb_const_set(cNokogiriXmlEntityDecl, rb_intern("EXTERNAL_GENERAL_UNPARSED"),
|
||||
INT2NUM(XML_EXTERNAL_GENERAL_UNPARSED_ENTITY));
|
||||
rb_const_set(cNokogiriXmlEntityDecl, rb_intern("INTERNAL_PARAMETER"),
|
||||
INT2NUM(XML_INTERNAL_PARAMETER_ENTITY));
|
||||
rb_const_set(cNokogiriXmlEntityDecl, rb_intern("EXTERNAL_PARAMETER"),
|
||||
INT2NUM(XML_EXTERNAL_PARAMETER_ENTITY));
|
||||
rb_const_set(cNokogiriXmlEntityDecl, rb_intern("INTERNAL_PREDEFINED"),
|
||||
INT2NUM(XML_INTERNAL_PREDEFINED_ENTITY));
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user