1

I am using EXIficient to convert XML data to EXI and back to XML. Here, i use their EXIficientDemo class. Sample Code:

EXIficientDemo sample = new EXIficientDemo();
sample.parseAndProofFileLocations("FilePath");
sample.codeSchemaLess();

Firstly it converted xml file to EXI then back to XML, when it generate XML from previously generated EXI's file, it loses some information about Namespace.

Actual XML File:

<?xml version="1.0" encoding="utf-8"?>
<tt xml:lang="ja" xmlns="http://www.w3.org/ns/ttml"
 xmlns:tts="http://www.w3.org/ns/ttml#styling"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<body>
    <div>
      <p xml:id="s1">
         <span tts:origin="somethings">somethings</span>
      </p>      
   </div>
</body>

Generated XML File By EXIficient

<?xml version="1.0" encoding="UTF-8"?>
<ns3:tt xmlns:ns3="http://www.w3.org/ns/ttml" 
xml:lang="ja"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<ns3:body><ns3:div>
<ns3:p xml:id="s1">
<ns3:span xmlns:ns4="http://www.w3.org/ns/ttml#styling"
ns4:origin="somethings">somethings</ns3:span>
</ns3:p>
</ns3:div></ns3:body>

In the generated XML file, it is missing xmlns:tts="http://www.w3.org/ns/ttml#styling"

How to fixed this problem? If you can, please help me.

Animesh Kumar Paul
  • 2,241
  • 4
  • 26
  • 37

2 Answers2

0

EXIficient may be suppressing unused namespaces. Your example doesn't show any use of the ttm namespace.

As you can see, it didn't retain the namespace prefix for the ttml namespace either (changed to ns3). The generated XML is perfectly valid if the ttml#metadata namespace is unused.

Update

With the updated question, where namespace ttml#styling is used by the origin attribute of the span element, the namespace is retained in the rebuilt XML, but it has been moved to the span element.

This is still a very valid XML document.

Namespace declarations (xmlns) can appear anywhere in a XML document, and applies to the element on which it appears, and all subelements (unless overridden, which is very unusual).

The same namespace can be declared many times on different elements. For simplicity and/or optimization, it is common to declare all namespaces up front, on the root element, using different prefixes, but it is not required to do so.

Andreas
  • 154,647
  • 11
  • 152
  • 247
0

I read this question by accident and rather late unfortunately. Just in case people are still struggling with this and are wondering what they can do.

As it was pointed out EXIficient behaves just fine with regards to namespace handling.

Having said that, the EXI specification allows one to preserve prefixes and namespaces (see Preserve Options).

In EXIficient one can set these options accordingly, e.g.,

EXIFactory.getFidelityOptions().setFidelity(FidelityOptions.FEATURE_PREFIX, true);
Quintin Balsdon
  • 5,484
  • 10
  • 54
  • 95