`
lglovejava
  • 浏览: 33937 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
阅读更多
Normally, I use code like this to fine-tune my XMLBeans namespaces for textual output:

XmlOptions xmlOptions = new XmlOptions();
xmlOptions.setSavePrettyPrint();
HashMap suggestedPrefixes = new HashMap();
xmlOptions.setSaveAggresiveNamespaces();
suggestedPrefixes.put("http://www.w3.org/2001/XMLSchema-instance", "xsi");
xmlOptions.setSaveSuggestedPrefixes(suggestedPrefixes);
String xmlStr = doc.xmlText(xmlOptions);

The first difficulty I have is with explicit prefixes like "xmlns" in these combinations: "xmlns:tns" or "xmlns:soap". They don't seem to be accepted as specification by XMLBeans and lead to a guessed namespace abbreviation in output of XMLBeans. Omitting the "xmlns:" part works for the suggestedPrefixes HashMap - but I require them also to be explicitly mentioned with "xmlns:" prefix at least in the namespace definition section created by XMLBeans because they will later be subject to XML signing where every bit counts. I cannot achieve this so far.

My main question is: How can I specify/control how AXIS2 calls XMLBeans/SOAP for outputting the XML?

Keith Chapman commented in the WSO2 online forum:
"Axis2 allows you to pass in options to these various dataBinding frameworks by prefixing the option with -E. But going through the XMLBeans integration code in axis2 I don't see us taking note of the options you mention above. Perhaps you could raise this as a JIRA on the axis2 list."

I found the XMLBeans integration code in this directory:
src/modules/xmlbeans/src/org/apache/axis2/xmlbeans
However, the class/constructor Axis2BindingConfig in file CodeGenerationUtility just seems to configure the mapping of URIs to package names. What I need to tune are the settings when writing the data wihtin an XMLBean to a file or stream, e.g. using XmlOptions as stated above. How/where can this be added/configured/patched in AXIS2? With some hints, I might be able to do the extension/patch in AXIS2 myself.

I need to create an XML that conforms exactly to a given specification in each and every bit because it is subject to an XML signature. Since the mentioning of namespaces is not adjusted perfectly by XML canonicalization, this is a serious issue.
Since the XML structures are stored in their own class structures (and not just as simple text strings) in the SOAP libraries, I can't easily adapt/correct them.
Is there any point where I can easily add some project-specific patches to the SOAP or AXIS2 libraries to really adjust every bit of XML before signing?
The best spot for patches I can think about right now is the XML canonicalization (org.apache.xml.security.c14n) which also requires some complex attribute handling. Does anybody have some other suggestions?
Are there any interfaces or interceptors foreseen for XML fine-tuning? Are there any easily adaptable examples for using them in this scenario?
Does anybody have experience fine-tuning the XML for using XML signatures that have to be exactly compatible with a 2 years old server using some other implementation for canonicalization and XML binding?
分享到:
评论

相关推荐

    vtd-xml vtd-xml vtd-xml

    VTD-XML是一种高效、灵活且轻量级的XML处理库,由Vivtek Data Systems公司开发。这个库专门设计用于解析、导航和修改XML文档,尤其在大型XML数据处理中表现出色。VTD(Variable Token Descriptor)是该库的核心概念...

    pugixml读写XML示例

    pugixml是一款轻量级、高性能的C++库,专为XML解析和操作而设计。这个库由Artemev开发,提供了简单易用的API,使得在C++项目中处理XML文档变得非常便捷。本示例将详细介绍如何使用pugixml进行XML的读取和写入操作。 ...

    pb下读写xml文件的例子.rar_pb_pb 读取xml_pb 读取xml文件_pb9 xml_pb下读写xml文件的例子

    在PowerBuilder(简称PB)这个强大的开发环境中,处理XML文件是一项常见的任务。XML(Extensible Markup Language)是一种用于存储和传输数据的通用格式,尤其在跨平台和网络应用中广泛使用。本示例主要探讨如何在...

    tinyxml与tinyxml2

    TinyXML和TinyXML2是两个小型的开源库,专门用于解析和操作XML(eXtensible Markup Language)文档。这两个库都是用C++编写的,为C++开发者提供了方便的接口来读取、写入和操作XML数据。下面将详细介绍这两个库的...

    andxml xml解密工具

    andxml汉化版是一个xml文件反编译工具,可与APKTOOL反编译配合使用,APK文件使用APKTool反编译生成XML文件后,就可以直接通过它进行汉化编辑 注意: 1、一键机器翻译会造成某些代码出现翻译错误现象,请人工识别。...

    易语言 xml解析 易语言 xml解析 教程 带源码

    易语言XML解析是编程领域中的一个重要主题,尤其对于使用易语言进行开发的程序员来说,理解并掌握XML(可扩展标记语言)的解析方法是至关重要的。XML作为一种结构化数据存储和交换格式,广泛应用于网络通信、配置...

    XML解析工具- TinyXML2 -源代码 - C++

    TinyXML-2 是一个简单、小型、高效的 C++ XML 解析器,可以被轻松集成到其他程序中。它使用文档对象模型(DOM)的方式解析XML,可解析 XML 文档,并根据该文档构建可读取、修改和保存的文档对象模型。 作为XML解析...

    xml2axml反编译AndroidManafest文件

    使用java工具xml2axml.jar反编译AndroidManafest文件 通过xml2axml.jar工具反编译AndroidManafest文件 还原AndroidManafest.xml详细过程: 1、获取到apk 2、解压获取里面的AndroidManifest.xml文件 3、在xml2axml....

    pugixml 一个很好用的XML类

    **Pugixml详解:一个高效易用的XML解析库** 在编程中,XML(Extensible Markup Language)是一种被广泛使用的数据交换格式,特别是在跨平台通信、配置文件和数据存储等领域。为了处理XML文档,开发者通常需要依赖...

    DBMS_XMLDOM DBMS_XMLPARSER DBMS_XMLQUERY 文档

    Oracle数据库系统提供了强大的XML处理能力,这主要体现在其内置的几个PL/SQL包上,如DBMS_XMLDOM、DBMS_XMLPARSER和DBMS_XMLQUERY。这些包为开发者提供了处理XML文档的一整套工具,使得在数据库环境中进行XML数据的...

    Xml完全操作 XML增删改查

    XML(eXtensible Markup Language)是一种用于标记数据的语言,其设计目的是传输和存储数据,而非显示数据。在IT行业中,XML因其结构清晰、可扩展性强的特点,被广泛应用于数据交换、配置文件、Web服务等领域。本文...

    tinyxml2.h tinyxml2.cpp文件

    TinyXML-2,通常以tinyxml2库的形式存在,是一个轻量级的C++库,专门用于解析和操作XML文档。这个库由李·斯坦普(Lee Stemp)开发,设计简洁,易于集成到各种项目中,特别是对于嵌入式系统和资源有限的环境。在给定...

    Qt读写Xml文件,QTreeWidget显示Xml和导出Xml文件

    在Qt框架中,XML文件是一种常见的数据存储格式,它提供了结构化的数据表示方式,便于程序读取和写入。QTreeWidget是Qt提供的一种用于显示树状结构数据的控件,它可以很好地展示XML文件的层次结构。QXml是Qt中的XML...

    tinyxml2解析和创建xml样例

    TinyXML2是一个小型、快速且易于使用的C++库,用于解析和生成XML文档。这个库的设计目标是简单、高效,并且适用于嵌入式系统。在本文中,我们将深入探讨如何使用TinyXML2来解析和创建XML文件,特别是涉及到CDATA区段...

    xml转javaBean,javaBean转xml,xml标签大小写问题,以及对xml特殊符号的处理

    XML(eXtensible Markup Language)是一种用于标记数据的语言,广泛应用在软件开发、Web服务、配置文件等领域。本文将深入探讨XML与JavaBean之间的转换、XML标签的大小写规则、XML特殊符号的处理以及CDATA的生成。 ...

    tinyxml2解析XML文件读取数据

    - 库的主要类包括`XMLDocument`(XML文档对象)、`XMLElement`(XML元素)、`XMLText`(XML文本)、`XMLComment`(XML注释)和`XMLAttribute`(XML属性)等。 2. **解析XML文件** - 使用`XMLDocument::LoadFile()...

    基于tinyxml2的xml操作库再封装

    XML(eXtensible Markup Language)是一种用于标记数据的语言,广泛应用于配置文件、数据交换、文档存储等领域。TinyXML2是轻量级的C++ XML解析库,它提供了简单、直接的方式来读写XML文档。本项目是基于tinyxml2...

    根据xml schema生成xml

    XML(eXtensible Markup Language)是一种用于标记数据的语言,广泛应用于数据交换、配置文件、文档存储等领域。XML Schema(通常缩写为XSD)则是为XML文档定义结构和数据类型的规范,它允许我们对XML文档进行更严格...

    XMLParser(XML解析代码 C++版)

    XMLParser是一种用于解析XML文档的C++实现,它旨在提供简单、小巧且稳定的解决方案,以处理XML数据。XML,即可扩展标记语言,是用于存储和传输数据的标准格式,广泛应用于配置文件、数据交换和文档结构化等领域。XML...

    matlab读取XML,XML转换为matlab

    XML(eXtensible Markup Language)是一种用于存储和交换数据的标记语言,广泛应用于软件开发、数据存储和网络通信等领域。Matlab作为一个强大的数值计算和数据分析环境,也提供了与XML交互的功能,这主要通过XML ...

Global site tag (gtag.js) - Google Analytics