[elbe-devel] [PATCH] Fix xml catalog

Manuel Traut manuel.traut at linutronix.de
Tue Jun 6 12:19:09 CEST 2017


Hi Philipp,

this doesn't apply to the elbe/devel-2.0 branch.
Is there another patch you missed to post?

Regards,
    Manuel

On Tue, Jun 06, 2017 at 11:56:59AM +0200, Philipp Arras wrote:
> Add local scheme to python environment. This change is required such that
> Elbe xml validation works also in networks behind proxy servers.
> ---
>  debian/catalog.xml        | 18 ------------------
>  elbepack/directories.py   |  6 ++++++
>  elbepack/xmlpreprocess.py |  3 ++-
>  schema/catalog.xml        | 18 ++++++++++++++++++
>  4 files changed, 26 insertions(+), 19 deletions(-)
>  delete mode 100644 debian/catalog.xml
>  create mode 100644 schema/catalog.xml
> 
> diff --git a/debian/catalog.xml b/debian/catalog.xml
> deleted file mode 100644
> index d9f8377..0000000
> --- a/debian/catalog.xml
> +++ /dev/null
> @@ -1,18 +0,0 @@
> -<?xml version="1.0"?>
> -<!DOCTYPE catalog PUBLIC "-//OASIS//DTD XML Catalogs V1.0//EN"
> -  "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
> -
> -<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="public">
> -  <system systemId="http://www.w3.org/2001/03/xml.xsd"
> -	  uri="xml.xsd"/>
> -
> -  <rewriteSystem systemIdStartString="http://www.w3.org/2001/03/"
> -		 rewritePrefix="./"/>
> -
> -  <system systemId="https://www.linutronix.de/projects/Elbe/dbsfed.xsd"
> -	  uri="dbsfed.xsd"/>
> -
> -  <rewriteSystem systemIdStartString="https://www.linutronix.de/projects/Elbe"
> -		 rewritePrefix="./"/>
> -
> -</catalog>
> diff --git a/elbepack/directories.py b/elbepack/directories.py
> index 4e703c4..75d59fd 100644
> --- a/elbepack/directories.py
> +++ b/elbepack/directories.py
> @@ -37,6 +37,12 @@ def init_directories(elbe_relpath):
>      else:
>          examples_dir = os.path.join (elbe_dir, "examples")
>  
> +    # Set XML catalog
> +    xmlcat = elbe_dir + "/schema/catalog.xml"
> +    if os.environ.get('XML_CATALOG_FILES') is None:
> +        os.environ['XML_CATALOG_FILES'] = xmlcat
> +    else:
> +        os.environ['XML_CATALOG_FILES'] += xmlcat
>  
>  def get_cmdlist():
>      return [ x for _, x, _ in iter_modules(elbepack.commands.__path__) ]
> diff --git a/elbepack/xmlpreprocess.py b/elbepack/xmlpreprocess.py
> index 2952510..4425bd4 100644
> --- a/elbepack/xmlpreprocess.py
> +++ b/elbepack/xmlpreprocess.py
> @@ -19,6 +19,7 @@
>  import os
>  import sys
>  import elbepack
> +from elbepack.directories import elbe_dir
>  from lxml import etree
>  from lxml.etree import XMLParser,parse
>  
> @@ -27,7 +28,7 @@ class XMLPreprocessError(Exception):
>          Exception.__init__(self, message)
>  
>  def xmlpreprocess(fname, output):
> -    schema_file = "https://www.linutronix.de/projects/Elbe/dbsfed.xsd"
> +    schema_file = elbe_dir + "/schema/dbsfed.xsd"
>      parser = XMLParser(huge_tree=True)
>      schema_tree = etree.parse(schema_file)
>      schema = etree.XMLSchema(schema_tree)
> diff --git a/schema/catalog.xml b/schema/catalog.xml
> new file mode 100644
> index 0000000..d9f8377
> --- /dev/null
> +++ b/schema/catalog.xml
> @@ -0,0 +1,18 @@
> +<?xml version="1.0"?>
> +<!DOCTYPE catalog PUBLIC "-//OASIS//DTD XML Catalogs V1.0//EN"
> +  "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
> +
> +<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="public">
> +  <system systemId="http://www.w3.org/2001/03/xml.xsd"
> +	  uri="xml.xsd"/>
> +
> +  <rewriteSystem systemIdStartString="http://www.w3.org/2001/03/"
> +		 rewritePrefix="./"/>
> +
> +  <system systemId="https://www.linutronix.de/projects/Elbe/dbsfed.xsd"
> +	  uri="dbsfed.xsd"/>
> +
> +  <rewriteSystem systemIdStartString="https://www.linutronix.de/projects/Elbe"
> +		 rewritePrefix="./"/>
> +
> +</catalog>
> -- 
> 2.1.4
> 
> 
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel




More information about the elbe-devel mailing list